395
395
"UPDATE test SET title='whatever'")
396
396
self.assertEquals(result.rowcount, 2)
398
def test_expr_startswith(self):
399
self.connection.execute("INSERT INTO test VALUES (30, '!!_%blah')")
400
self.connection.execute("INSERT INTO test VALUES (40, '!!blah')")
401
id = Column("id", SQLToken("test"))
402
title = Column("title", SQLToken("test"))
403
expr = Select(id, title.startswith(u"!!_%"))
404
result = list(self.connection.execute(expr))
405
self.assertEquals(result, [(30,)])
407
def test_expr_endswith(self):
408
self.connection.execute("INSERT INTO test VALUES (30, 'blah_%!!')")
409
self.connection.execute("INSERT INTO test VALUES (40, 'blah!!')")
410
id = Column("id", SQLToken("test"))
411
title = Column("title", SQLToken("test"))
412
expr = Select(id, title.endswith(u"_%!!"))
413
result = list(self.connection.execute(expr))
414
self.assertEquals(result, [(30,)])
416
def test_expr_contains_string(self):
417
self.connection.execute("INSERT INTO test VALUES (30, 'blah_%!!x')")
418
self.connection.execute("INSERT INTO test VALUES (40, 'blah!!x')")
419
id = Column("id", SQLToken("test"))
420
title = Column("title", SQLToken("test"))
421
expr = Select(id, title.contains_string(u"_%!!"))
422
result = list(self.connection.execute(expr))
423
self.assertEquals(result, [(30,)])
399
426
class UnsupportedDatabaseTest(object):