comparison roundup/backends/back_sqlite.py @ 3306:ae1093684ef5

merge from maint-0-7
author Richard Jones <richard@users.sourceforge.net>
date Mon, 02 May 2005 01:05:15 +0000
parents a9b0fe809d16
children 3518d1ffd940
comparison
equal deleted inserted replaced
3303:520eef0e0e91 3306:ae1093684ef5
1 # $Id: back_sqlite.py,v 1.40 2005-02-14 04:37:24 richard Exp $ 1 # $Id: back_sqlite.py,v 1.41 2005-05-02 01:05:15 richard Exp $
2 '''Implements a backend for SQLite. 2 '''Implements a backend for SQLite.
3 3
4 See https://pysqlite.sourceforge.net/ for pysqlite info 4 See https://pysqlite.sourceforge.net/ for pysqlite info
5 5
6 6
323 return str(newid) 323 return str(newid)
324 324
325 def setid(self, classname, setid): 325 def setid(self, classname, setid):
326 ''' Set the id counter: used during import of database 326 ''' Set the id counter: used during import of database
327 327
328 We add one to make it behave like the seqeunces in postgres. 328 We add one to make it behave like the sequences in postgres.
329 ''' 329 '''
330 sql = 'update ids set num=%s where name=%s'%(self.arg, self.arg) 330 sql = 'update ids set num=%s where name=%s'%(self.arg, self.arg)
331 vals = (int(setid)+1, classname) 331 vals = (int(setid)+1, classname)
332 self.sql(sql, vals) 332 self.sql(sql, vals)
333
334 def clear(self):
335 # set the id counters to 0 (setid adds one) so we start at 1
336 rdbms_common.Database.clear(self)
337 for cn in self.classes.keys():
338 self.setid(cn, 0)
333 339
334 def create_class(self, spec): 340 def create_class(self, spec):
335 rdbms_common.Database.create_class(self, spec) 341 rdbms_common.Database.create_class(self, spec)
336 sql = 'insert into ids (name, num) values (%s, %s)' 342 sql = 'insert into ids (name, num) values (%s, %s)'
337 vals = (spec.classname, 1) 343 vals = (spec.classname, 1)

Roundup Issue Tracker: http://roundup-tracker.org/