commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r5940 - in trunk/gnue-common/src/datasources/drivers: Base/Schema/Creati


From: johannes
Subject: r5940 - in trunk/gnue-common/src/datasources/drivers: Base/Schema/Creation DBSIG2/Schema/Creation sqlite/sqlite
Date: Wed, 7 Jul 2004 17:14:18 -0500 (CDT)

Author: johannes
Date: 2004-07-05 04:54:57 -0500 (Mon, 05 Jul 2004)
New Revision: 5940

Modified:
   trunk/gnue-common/src/datasources/drivers/Base/Schema/Creation/Creation.py
   trunk/gnue-common/src/datasources/drivers/DBSIG2/Schema/Creation/Creation.py
   trunk/gnue-common/src/datasources/drivers/sqlite/sqlite/Connection.py
Log:
Don't add the same constraint/indices multple times


Modified: 
trunk/gnue-common/src/datasources/drivers/Base/Schema/Creation/Creation.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/Schema/Creation/Creation.py  
2004-07-05 09:09:22 UTC (rev 5939)
+++ trunk/gnue-common/src/datasources/drivers/Base/Schema/Creation/Creation.py  
2004-07-05 09:54:57 UTC (rev 5940)
@@ -124,6 +124,7 @@
   def __init__ (self, connection = None, introspector = None):
     self.connection   = connection
     self.introspector = introspector
+    self.lookup       = {}
 
     if connection is not None and introspector is None:
       self.introspector = connection.introspector

Modified: 
trunk/gnue-common/src/datasources/drivers/DBSIG2/Schema/Creation/Creation.py
===================================================================
--- 
trunk/gnue-common/src/datasources/drivers/DBSIG2/Schema/Creation/Creation.py    
    2004-07-05 09:09:22 UTC (rev 5939)
+++ 
trunk/gnue-common/src/datasources/drivers/DBSIG2/Schema/Creation/Creation.py    
    2004-07-05 09:54:57 UTC (rev 5940)
@@ -96,6 +96,7 @@
     if not codeOnly:
       self._executeCodeTuple (res)
 
+    self.lookup = {}
     return res
 
 
@@ -149,6 +150,7 @@
     if not codeOnly:
       self._executeCodeTuple (res)
 
+    self.lookup = {}
     return res
 
 
@@ -227,6 +229,9 @@
     unique = indexDefinition.has_key ('unique') and indexDefinition ['unique']
     indexName = self._shortenName (indexDefinition ['name'])
 
+    if self.lookup.has_key ("INDEX_%s" % indexName):
+      return ([], [], [])
+
     body = res [1]
     body.append (u"CREATE %sINDEX %s ON %s (%s)%s" % \
         (unique and "UNIQUE " or "", indexName, tableName,
@@ -235,6 +240,8 @@
     if not codeOnly:
       self._executeCodeTuple (res)
 
+    self.lookup ["INDEX_%s" % indexName] = True
+
     return res
 
 
@@ -257,6 +264,9 @@
     res = Base.Creation.createConstraint (self, tableName, constraintDef,
                                           codeOnly)
     cName     = self._shortenName (constraintDef ['name'])
+    if self.lookup.has_key ("CONSTRAINT_%s" % cName):
+      return ([], [], [])
+
     fields    = constraintDef ['fields']
     reftable  = constraintDef ['reftable']
     reffields = constraintDef ['reffields']
@@ -267,6 +277,8 @@
          (tableName, cName, string.join (fields, ", "), reftable,
           string.join (reffields, ", "), self.END_COMMAND))
 
+    self.lookup ["CONSTRAINT_%s" % cName] = True
+
     if not codeOnly:
       self._executeCodeTuple (res)
 

Modified: trunk/gnue-common/src/datasources/drivers/sqlite/sqlite/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sqlite/sqlite/Connection.py       
2004-07-05 09:09:22 UTC (rev 5939)
+++ trunk/gnue-common/src/datasources/drivers/sqlite/sqlite/Connection.py       
2004-07-05 09:54:57 UTC (rev 5940)
@@ -94,7 +94,8 @@
   def connect (self, connectData):
     """
     """
-    GDebug.printMesg(1,"SQLite database driver initializing")
+    GDebug.printMesg(1,"SQLite database driver initializing <%s>" \
+        % hex (id (self)))
 
     if not hasattr (self, '_DatabaseError'):
       try:
@@ -104,7 +105,7 @@
 
     try:
       self.native = SIG2api.connect (db = connectData['dbname'],
-                                     mode = 077,
+                                     mode = 0777,
                                      encoding = self._encoding)
 
     except self._DatabaseError, value:





reply via email to

[Prev in Thread] Current Thread [Next in Thread]