commit-gnue
[Top][All Lists]
Advanced

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

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


From: reinhard
Subject: r5388 - trunk/gnue-common/src/schema/scripter/processors
Date: Fri, 19 Mar 2004 15:30:15 -0600 (CST)

Author: reinhard
Date: 2004-03-19 15:30:14 -0600 (Fri, 19 Mar 2004)
New Revision: 5388

Modified:
   trunk/gnue-common/src/schema/scripter/processors/interbase.py
Log:
Create a "boolean" domain for boolean values.


Modified: trunk/gnue-common/src/schema/scripter/processors/interbase.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/processors/interbase.py       
2004-03-19 21:03:18 UTC (rev 5387)
+++ trunk/gnue-common/src/schema/scripter/processors/interbase.py       
2004-03-19 21:30:14 UTC (rev 5388)
@@ -80,6 +80,20 @@
     epi.append ("SET TERM ; ^")
 
 
+  # ---------------------------------------------------------------------------
+  # On start of schema dump, define boolean domain
+  # ---------------------------------------------------------------------------
+
+  def startSchema (self):
+    """
+    Defines the 'boolean' domain.
+    """
+    self._writeText ("\n")
+    self._writeText (self.comment ("Define the domain for boolean values"))
+    self._writeText ("CREATE DOMAIN boolean AS "
+                     "smallint CHECK (value IN (0,1))\n")
+
+
   # ===========================================================================
   # Datatype translation
   # ===========================================================================
@@ -141,14 +155,9 @@
 
   def boolean (self, gsField):
     """
-    Interbase doesn't support booleans, so we use a 'smallint' with a CHECK
-    constraint, which allows only 0, 1 and NULLs.
+    We use the 'boolean' domain that we create.
     """
-    if gsField.nullable:
-      return "smallint CHECK (%s IS NULL OR %s IN (0,1))" % \
-             (gsField.name, gsField.name)
-    else:
-      return "smallint CHECK (%s IN (0,1))" % gsField.name
+    return "boolean"
 
 
   # ---------------------------------------------------------------------------





reply via email to

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