Ejemplo n.º 1
0
 def testSelectTableExists(self):
     db = Database.in_memory_instance('def')
     try:
         print 'Select #1:', db.select('SELECT 1 FROM test1')
     except: pass
     db.write('CREATE TABLE test1(a PRIMARY KEY, b)')
     try:
         print 'Select #1:', db.select('SELECT 1 FROM test1')
     except: pass
     db.close()
Ejemplo n.º 2
0
 def testInMemory(self):
     db = Database.in_memory_instance('abc')
     db.write('CREATE TABLE test1(a PRIMARY KEY, b)')
     db.write('INSERT INTO test1 VALUES (1, 2)')
     
     db.close()
     
     db = Database.in_memory_instance('abc')
     db.write('CREATE TABLE test1(a PRIMARY KEY, b)')
     db.write('INSERT INTO test1 VALUES (:a, :b)', { 'a': 3, 'b': '4' })
     for s in db.select('SELECT * FROM test1'):
         print 'Row:',
         for i in s:
             print i,
         print 
         
     print 'Dumping database:'
     for d in db.dump():
         print d