# HG changeset patch # User Alexandre Fayolle # Date 1275495147 -7200 # Node ID 73d8a757db800e17658929b23ab147c32e0979c1 # Parent 6a90357b97693d43579e2d3354a7aa1cb51c0331 fix create_eid for sqlite (and bring back tests) diff -r 6a90357b9769 -r 73d8a757db80 server/sources/native.py --- a/server/sources/native.py Wed Jun 02 17:23:42 2010 +0000 +++ b/server/sources/native.py Wed Jun 02 18:12:27 2010 +0200 @@ -270,6 +270,7 @@ def pool_reset(cnx): cnx.close() self.pool_reset = pool_reset + self.create_eid = self.__create_eid_sqlite @property def _sqlcnx(self): @@ -729,6 +730,16 @@ sql = self.dbhelper.sql_temporary_table(table, schema, False) self.doexec(session, sql) + def __create_eid_sqlite(self, session): + self._eid_creation_lock.acquire() + try: + for sql in self.dbhelper.sqls_increment_sequence('entities_id_seq'): + cursor = self.doexec(session, sql) + return cursor.fetchone()[0] + finally: + self._eid_creation_lock.release() + + def create_eid(self, session): self.debug('create eid') # lock needed to prevent 'Connection is busy with results for another command (0)' errors with SQLServer