##// END OF EJS Templates
fix message when trying new table due to mismatch in SQLiteDB...
MinRK -
Show More
@@ -226,15 +226,16 b' class SQLiteDB(BaseDB):'
226 # isolation_level = None)#,
226 # isolation_level = None)#,
227 cached_statements=64)
227 cached_statements=64)
228 # print dir(self._db)
228 # print dir(self._db)
229 first_table = self.table
229 first_table = previous_table = self.table
230 i=0
230 i=0
231 while not self._check_table():
231 while not self._check_table():
232 i+=1
232 i+=1
233 self.table = first_table+'_%i'%i
233 self.table = first_table+'_%i'%i
234 self.log.warn(
234 self.log.warn(
235 "Table %s exists and doesn't match db format, trying %s"%
235 "Table %s exists and doesn't match db format, trying %s"%
236 (first_table,self.table)
236 (previous_table, self.table)
237 )
237 )
238 previous_table = self.table
238
239
239 self._db.execute("""CREATE TABLE IF NOT EXISTS %s
240 self._db.execute("""CREATE TABLE IF NOT EXISTS %s
240 (msg_id text PRIMARY KEY,
241 (msg_id text PRIMARY KEY,
@@ -18,6 +18,7 b' Authors:'
18
18
19 from __future__ import division
19 from __future__ import division
20
20
21 import logging
21 import os
22 import os
22 import tempfile
23 import tempfile
23 import time
24 import time
@@ -226,7 +227,9 b' class TestSQLiteBackend(TestDictBackend):'
226 @dec.skip_without('sqlite3')
227 @dec.skip_without('sqlite3')
227 def create_db(self):
228 def create_db(self):
228 location, fname = os.path.split(temp_db)
229 location, fname = os.path.split(temp_db)
229 return SQLiteDB(location=location, fname=fname)
230 log = logging.getLogger('test')
231 log.setLevel(logging.CRITICAL)
232 return SQLiteDB(location=location, fname=fname, log=log)
230
233
231 def tearDown(self):
234 def tearDown(self):
232 self.db._db.close()
235 self.db._db.close()
General Comments 0
You need to be logged in to leave comments. Login now