commit-gnue
[Top][All Lists]
Advanced

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

r5838 - trunk/gnue-common/src/schema/scripter/processors


From: btami
Subject: r5838 - trunk/gnue-common/src/schema/scripter/processors
Date: Thu, 27 May 2004 15:35:31 -0500 (CDT)

Author: btami
Date: 2004-05-27 15:35:30 -0500 (Thu, 27 May 2004)
New Revision: 5838

Modified:
   trunk/gnue-common/src/schema/scripter/processors/SQL.py
Log:
truncated constraint names with MAX_NAME_LENGTH

Modified: trunk/gnue-common/src/schema/scripter/processors/SQL.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/processors/SQL.py     2004-05-27 
18:02:56 UTC (rev 5837)
+++ trunk/gnue-common/src/schema/scripter/processors/SQL.py     2004-05-27 
20:35:30 UTC (rev 5838)
@@ -119,6 +119,8 @@
     definition.
     """
     pkDef = tableDef.primaryKey
+    if len (pkDef.name) > self.MAX_NAME_LENGTH:
+      print pkDef.name, 'is too long. Truncated...'
     flist = join ([pkf.name for pkf in pkDef.fields], ", ")
 
     phase = tableDef.getPhase (0)
@@ -126,7 +128,7 @@
       phase.body [-1] += u","
 
     phase.body.append (u"  CONSTRAINT %s PRIMARY KEY (%s)" % \
-                        (pkDef.name, flist))
+                        (pkDef.name[:self.MAX_NAME_LENGTH], flist))
 
 
   # ---------------------------------------------------------------------------
@@ -181,14 +183,16 @@
     are put into the second phase.
     """
     if constraint.kind == "foreignkey":
+      if len(constraint.name) > self.MAX_NAME_LENGTH:
+        print constraint.name, 'is too long. Truncated...'
       phase = tableDef.getPhase (1)
 
       phase.body.append (u"")
-      phase.body.extend (self.comment ("CONSTRAINT '%s'" % constraint.name))
+      phase.body.extend (self.comment ("CONSTRAINT '%s'" % 
constraint.name[:self.MAX_NAME_LENGTH]))
       phase.body.append ("ALTER TABLE %s ADD" % tableDef.name)
 
       phase.body.append ("  CONSTRAINT %s FOREIGN KEY (%s)" % \
-        (constraint.name, join ([cf.name for cf in constraint.fields], ", ")))
+        (constraint.name[:self.MAX_NAME_LENGTH], join ([cf.name for cf in 
constraint.fields], ", ")))
       phase.body.append ("    REFERENCES %s (%s)%s" % \
         (constraint.reftable, 
          join ([rf.name for rf in constraint.reffields], ", "), 





reply via email to

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