merge stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Wed, 02 Jun 2010 18:12:47 +0200
branchstable
changeset 5645 052eb526b939
parent 5643 fd240f98a3ee (current diff)
parent 5644 73d8a757db80 (diff)
child 5647 b21655cfc835
merge
server/sources/native.py
--- a/server/sources/native.py	Wed Jun 02 17:26:26 2010 +0200
+++ b/server/sources/native.py	Wed Jun 02 18:12:47 2010 +0200
@@ -272,6 +272,7 @@
             def pool_reset(cnx):
                 cnx.close()
             self.pool_reset = pool_reset
+            self.create_eid = self.__create_eid_sqlite
 
     @property
     def _sqlcnx(self):
@@ -730,6 +731,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