Пример #1
0
 def test_insert(self):
     db = Sql('sqlite:memory:')
     tr = db.transaction(logger=error)
     c = tr.cursor()
     c.execute('CREATE TABLE test (value text)')
     c.execute("INSERT INTO test (value) VALUES (%s)", 'cc')
     c.execute("INSERT INTO test (value) VALUES (%s)", 'čč')
     c.execute("INSERT INTO test (value) VALUES (%s)", u'čč')
     c.execute(u"INSERT INTO test (value) VALUES (%s)", 'čč')
     c.execute(u"INSERT INTO test (value) VALUES (%s)", u'čč')
Пример #2
0
 def test_select(self):
     db = Sql('sqlite:memory:')
     tr = db.transaction(logger=error)
     c = tr.cursor()
     c.execute("SELECT DATE('2015-12-24') WHERE 1 == %d", 1)
     assert c.fetchone()[0] == '2015-12-24'