commit-gnue
[Top][All Lists]
Advanced

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

r5929 - trunk/gnue-common/src/datasources/drivers/interbase/Schema/Creat


From: johannes
Subject: r5929 - trunk/gnue-common/src/datasources/drivers/interbase/Schema/Creation
Date: Wed, 7 Jul 2004 17:14:09 -0500 (CDT)

Author: johannes
Date: 2004-06-23 07:03:54 -0500 (Wed, 23 Jun 2004)
New Revision: 5929

Modified:
   
trunk/gnue-common/src/datasources/drivers/interbase/Schema/Creation/Creation.py
Log:
Create boolean domain automatically on database creation. Type transformation
of 'boolean' now results in this new boolean domain


Modified: 
trunk/gnue-common/src/datasources/drivers/interbase/Schema/Creation/Creation.py
===================================================================
--- 
trunk/gnue-common/src/datasources/drivers/interbase/Schema/Creation/Creation.py 
    2004-06-23 11:58:56 UTC (rev 5928)
+++ 
trunk/gnue-common/src/datasources/drivers/interbase/Schema/Creation/Creation.py 
    2004-06-23 12:03:54 UTC (rev 5929)
@@ -80,7 +80,13 @@
        u"create database '%s' user '%s' password '%s'"
         % (dburl, username, password))
 
+    self.connection.manager.loginToConnection (self.connection)
 
+    code = u"CREATE DOMAIN boolean AS smallint CHECK (value IN (0,1));"
+    self.connection.makecursor (code)
+    self.connection.commit ()
+
+
   # ---------------------------------------------------------------------------
   # Process a defaultwith attribute
   # ---------------------------------------------------------------------------
@@ -179,14 +185,13 @@
 
   def boolean (self, fieldDefinition):
     """
-    This funciton returns a smallint, since interbase/firebird has no native
-    boolean type. Using a domain won't work by now, due to limitations on the
-    introspection. Even adding a CHECK-clause to the datatype doesn't work.
+    This funciton returns a boolean, since this domain is created using the
+    createDatabase () function.
 
     @param fieldDefinition: dictionary describing the field
-    @return: 'smallint'
+    @return: 'boolean'
     """
-    return "smallint"
+    return "boolean"
 
 
   # ---------------------------------------------------------------------------





reply via email to

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