commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r7618 - in trunk/gnue-common/src/datasources/drivers: Base adodba


From: reinhard
Subject: [gnue] r7618 - in trunk/gnue-common/src/datasources/drivers: Base adodbapi appserver interbase maxdb mysql oracle postgresql sqlite
Date: Sat, 18 Jun 2005 06:24:33 -0500 (CDT)

Author: reinhard
Date: 2005-06-18 06:24:31 -0500 (Sat, 18 Jun 2005)
New Revision: 7618

Modified:
   trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py
   trunk/gnue-common/src/datasources/drivers/adodbapi/Behavior.py
   trunk/gnue-common/src/datasources/drivers/appserver/Behavior.py
   trunk/gnue-common/src/datasources/drivers/interbase/Behavior.py
   trunk/gnue-common/src/datasources/drivers/maxdb/Behavior.py
   trunk/gnue-common/src/datasources/drivers/mysql/Behavior.py
   trunk/gnue-common/src/datasources/drivers/oracle/Behavior.py
   trunk/gnue-common/src/datasources/drivers/postgresql/Behavior.py
   trunk/gnue-common/src/datasources/drivers/sqlite/Behavior.py
Log:
Some changes to make eypdoc happy again.


Modified: trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py 2005-06-18 
07:52:28 UTC (rev 7617)
+++ trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py 2005-06-18 
11:24:31 UTC (rev 7618)
@@ -64,9 +64,9 @@
   to.
 
   If the RecordSet is the master in a master/detail relationship, it is aware
-  of all its details. It notifies all its detail L{GDataSource} objects
-  whenever it becomes the current record, and it posts/requeries all detail
-  L{ResultSet} objects after posting/requerying its own data.
+  of all its details. It notifies all its detail L{GDataSource.GDataSource}
+  objects whenever it becomes the current record, and it posts/requeries all
+  detail L{ResultSet} objects after posting/requerying its own data.
 
   If the RecordSet is the detail in a master/detail relationship, it is not
   aware of the master. It is the full responsibility of the master to keep its
@@ -118,9 +118,9 @@
     @param readonly: True if the RecordSet is read only. If set, an attempt to
       modify or delete this record raises an exception.
     @param details: Dictionary defining all details of this ResultSet, where
-      the key is the @L{GDataSource} object and the values are tuples
-      containing a list of primary key fields and a list of the corresponding
-      foreign key fields.
+      the key is the @L{GDataSource.GDataSource} object and the values are
+      tuples containing a list of primary key fields and a list of the
+      corresponding foreign key fields.
     @param eventController: EventController instance to notify of data events.
     """
 
@@ -360,12 +360,12 @@
 
     It is highly recommended to post this record, it's chain of master records
     and all of it's details before calling this function, so the backend is up
-    to date when executing the called backend method. L{GDataSource.postAll}
-    provides a convenient way to do this.
+    to date when executing the called backend method.
+    L{GDataSource.GDataSource.postAll} provides a convenient way to do this.
 
     It is also recommended to requery all these records afterwards, so the
     changes done to the data by the called function become visible.
-    L{GDataSource.requeryAll} provides a convenient way to do this.
+    L{GDataSource.GDataSource.requeryAll} provides a convenient way to do this.
 
     @param methodname: Name of the function to call.
     @param parameters: Dictionary with parametername/value pairs.

Modified: trunk/gnue-common/src/datasources/drivers/adodbapi/Behavior.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/adodbapi/Behavior.py      
2005-06-18 07:52:28 UTC (rev 7617)
+++ trunk/gnue-common/src/datasources/drivers/adodbapi/Behavior.py      
2005-06-18 11:24:31 UTC (rev 7618)
@@ -30,9 +30,18 @@
 
 class Behavior (Base.Behavior):
 
-  _RELKIND = {'TABLE': {'type': 'table', 'name': _('Tables')},
-              'VIEW' : {'type': 'view', 'name': _('Views')}}
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
 
+  def __init__ (self, connection):
+
+    Base.__init__ (self, connection)
+
+    self._RELKIND = {'TABLE': {'type': 'table', 'name': _('Tables')},
+                     'VIEW' : {'type': 'view', 'name': _('Views')}}
+
+
   # ---------------------------------------------------------------------------
   # Read the current connection's schema
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-common/src/datasources/drivers/appserver/Behavior.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/appserver/Behavior.py     
2005-06-18 07:52:28 UTC (rev 7617)
+++ trunk/gnue-common/src/datasources/drivers/appserver/Behavior.py     
2005-06-18 11:24:31 UTC (rev 7618)
@@ -32,12 +32,20 @@
 class Behavior (Base.Behavior):
   """
   Limitations:
-
-  * Appserver cannot reproduce indices
+    - Appserver cannot reproduce indices
   """
 
-  _RELTYPE = {'type': 'object', 'name': u_('Business Object Class')}
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
 
+  def __init__ (self, connection):
+
+    Base.__init__ (self, connection)
+
+    _RELTYPE = {'type': 'object', 'name': u_('Business Object Class')}
+
+
   # ---------------------------------------------------------------------------
   # Read the connection's schema
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-common/src/datasources/drivers/interbase/Behavior.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/interbase/Behavior.py     
2005-06-18 07:52:28 UTC (rev 7617)
+++ trunk/gnue-common/src/datasources/drivers/interbase/Behavior.py     
2005-06-18 11:24:31 UTC (rev 7618)
@@ -34,25 +34,10 @@
 class Behavior (DBSIG2.Behavior):
   """
   Limitations:
-
-  * Interbase/Firebird has no native boolean datatype. That's why this
-    introspection module treats the domain 'BOOLEAN' as boolean data types.
+    - Interbase/Firebird has no native boolean datatype. That's why this
+      introspection module treats the domain 'BOOLEAN' as boolean data types.
   """
 
-  _RELTYPE  = {False: {'type': 'table', 'name': _('Tables')},
-               True : {'type': 'view' , 'name': _('Views')}}
-
-  _TYPEMAP  = {'DATE': 'date', 'TIME': 'time', 'TIMESTAMP': 'datetime'}
-  _NOW      = re.compile ("'(NOW\s*\(\)\s*)'", re.IGNORECASE)
-  _GENFIELD = re.compile ('^.*NEW\.(\w+)\s*=\s*GEN_ID\s*\(.*\)', re.IGNORECASE)
-
-  _maxIdLength   = 31
-  _alterMultiple = False
-  _maxVarchar    = 10921
-  _numbers       = [[(4, 'SMALLINT'), (9, 'INTEGER')], "NUMERIC(%s)",
-                    "NUMERIC (%(length)s,%(scale)s)"]
-
-
   # ---------------------------------------------------------------------------
   # Constructor
   # ---------------------------------------------------------------------------
@@ -60,6 +45,21 @@
   def __init__ (self, connection):
 
     DBSIG2.Behavior.__init__ (self, connection)
+
+    self._RELTYPE  = {False: {'type': 'table', 'name': _('Tables')},
+                      True : {'type': 'view' , 'name': _('Views')}}
+
+    self._TYPEMAP  = {'DATE': 'date', 'TIME': 'time', 'TIMESTAMP': 'datetime'}
+    self._NOW      = re.compile ("'(NOW\s*\(\)\s*)'", re.IGNORECASE)
+    self._GENFIELD = re.compile ('^.*NEW\.(\w+)\s*=\s*GEN_ID\s*\(.*\)',
+        re.IGNORECASE)
+
+    self._maxIdLength   = 31
+    self._alterMultiple = False
+    self._maxVarchar    = 10921
+    self._numbers       = [[(4, 'SMALLINT'), (9, 'INTEGER')], "NUMERIC(%s)",
+                           "NUMERIC (%(length)s,%(scale)s)"]
+
     self._type2native ['datetime'] = 'timestamp'
     self._type2native ['boolean']  = 'boolean'
 

Modified: trunk/gnue-common/src/datasources/drivers/maxdb/Behavior.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/maxdb/Behavior.py 2005-06-18 
07:52:28 UTC (rev 7617)
+++ trunk/gnue-common/src/datasources/drivers/maxdb/Behavior.py 2005-06-18 
11:24:31 UTC (rev 7618)
@@ -33,21 +33,9 @@
 class Behavior (DBSIG2.Behavior):
   """
   Limitations:
-  * MaxDB has no named primary keys, so we build them from "pk_<tablename>"
+    - MaxDB has no named primary keys, so we build them from "pk_<tablename>"
   """
 
-  _RELKIND = {'TABLE'  : {'type': 'table'  , 'name': _('Tables')},
-              'VIEW'   : {'type': 'view'   , 'name': _('Views')},
-              # 'SYNONYM': {'type': 'synonym', 'name': _('Synonyms')},
-              # 'RESULT' : {'type': 'result' , 'name': _('Result Table')}
-              }
-
-  _maxIdLength = 32
-  _maxVarchar  = 3999
-  _numbers = [[(5, 'SMALLINT'), (10, 'INTEGER')],
-              "FIXED (%s)",
-              "FIXED (%(length)s,%(scale)s)"]
-
   # ---------------------------------------------------------------------------
   # Constructor
   # ---------------------------------------------------------------------------
@@ -56,6 +44,18 @@
 
     DBSIG2.Behavior.__init__ (self, connection)
 
+    self._RELKIND = {'TABLE'  : {'type': 'table'  , 'name': _('Tables')},
+                     'VIEW'   : {'type': 'view'   , 'name': _('Views')},
+                     # 'SYNONYM': {'type': 'synonym', 'name': _('Synonyms')},
+                     # 'RESULT' : {'type': 'result' , 'name': _('Result 
Table')}
+                     }
+
+    self._maxIdLength = 32
+    self._maxVarchar  = 3999
+    self._numbers = [[(5, 'SMALLINT'), (10, 'INTEGER')],
+                     "FIXED (%s)",
+                     "FIXED (%(length)s,%(scale)s)"]
+
     self._type2native.update ({'boolean' : 'BOOLEAN',
                                'datetime': 'TIMESTAMP'})
 

Modified: trunk/gnue-common/src/datasources/drivers/mysql/Behavior.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/mysql/Behavior.py 2005-06-18 
07:52:28 UTC (rev 7617)
+++ trunk/gnue-common/src/datasources/drivers/mysql/Behavior.py 2005-06-18 
11:24:31 UTC (rev 7618)
@@ -32,30 +32,16 @@
 
 class Behavior (DBSIG2.Behavior):
   """
-  Known bugs/problems:
-
-    1. MySQL does not support booleans, nor does it have column checks. So a
-       'boolean' column will be transformed into a 'number' silently.
-
-    2. MySQL does not give us a chance to find out anything about foreign key
-       constraints. (Even with InnoDB it's quite hard to parse it from SHOW
-       CREATE TABLE or SHOW TABLE STATUS)
-
-    3. MySQL does *not* store the name of a primary key, instead this is always
-       'PRIMARY'. That's why we lose the original primary key's names.
+  Limitations
+    - MySQL does not support booleans, nor does it have column checks. So a
+      'boolean' column will be transformed into a 'number' silently.
+    - MySQL does not give us a chance to find out anything about foreign key
+      constraints. (Even with InnoDB it's quite hard to parse it from SHOW
+      CREATE TABLE or SHOW TABLE STATUS)
+    - MySQL does *not* store the name of a primary key, instead this is always
+      'PRIMARY'. That's why we lose the original primary key's names.
   """
 
-  _TYPEMAP = {'string'   : ('string', 'string'),
-              'date'     : ('date', 'date'),
-              'time'     : ('date', 'time'),
-              'timestamp': ('date', 'timestamp'),
-              'datetime' : ('date', 'datetime')}
-
-  _maxIdLength = 64
-  _numbers     = [[(4, 'smallint'), (9, 'int'), (18, 'bigint')],
-                  "decimal (%s,0)", "decimal (%(length)s,%(scale)s)"]
-
-
   # ---------------------------------------------------------------------------
   # Constructor
   # ---------------------------------------------------------------------------
@@ -64,11 +50,21 @@
 
     DBSIG2.Behavior.__init__ (self, *args, **kwargs)
 
+    self._TYPEMAP = {'string'   : ('string', 'string'),
+                     'date'     : ('date', 'date'),
+                     'time'     : ('date', 'time'),
+                     'timestamp': ('date', 'timestamp'),
+                     'datetime' : ('date', 'datetime')}
+
     # Update the typemap with numeric types
     for t in ['int','integer','bigint','mediumint',
               'smallint','tinyint','float','real', 'double','decimal']:
       self._TYPEMAP [t] = ('number', 'number')
 
+    self._maxIdLength = 64
+    self._numbers     = [[(4, 'smallint'), (9, 'int'), (18, 'bigint')],
+                         "decimal (%s,0)", "decimal (%(length)s,%(scale)s)"]
+
     self._type2native ['boolean'] = "tinyint (1) unsigned"
 
 

Modified: trunk/gnue-common/src/datasources/drivers/oracle/Behavior.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/oracle/Behavior.py        
2005-06-18 07:52:28 UTC (rev 7617)
+++ trunk/gnue-common/src/datasources/drivers/oracle/Behavior.py        
2005-06-18 11:24:31 UTC (rev 7618)
@@ -32,11 +32,18 @@
 class Behavior (DBSIG2.Behavior):
   """
   Limitations:
-
-  * does not detect primary keys, indices and constraints
+    - does not detect primary keys, indices and constraints
   """
 
-  _RELKIND = {
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
+
+  def __init__ (self, *args, **kwargs):
+
+    DBSIG2.Behavior.__init__ (self, *args, **kwargs)
+
+    self._RELKIND = {
      'user_table'  : {'type': 'usertable',   'name': _("User Tables")},
      'user_view'   : {'type': 'userview',    'name': _("User Views")},
      'user_synonym': {'type': 'usersynonym', 'name': _("User Synonyms")},
@@ -44,19 +51,11 @@
      'all_view'    : {'type': 'allview',     'name': _('System Views')},
      'all_synonym' : {'type': 'allsynonym',  'name': _('System Synonyms')}}
 
-  _pkPrecision   = 10
-  _maxIdLength   = 31
-  _alterMultiple = False
-  _numbers       = [[], "number (%s)", "number (%(length)s,%(scale)s)"]
+    self._pkPrecision   = 10
+    self._maxIdLength   = 31
+    self._alterMultiple = False
+    self._numbers       = [[], "number (%s)", "number (%(length)s,%(scale)s)"]
 
-
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
-
-  def __init__ (self, *args, **kwargs):
-
-    DBSIG2.Behavior.__init__ (self, *args, **kwargs)
     self._type2native.update ({'datetime': 'date', 'time': 'date'})
 
 

Modified: trunk/gnue-common/src/datasources/drivers/postgresql/Behavior.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/postgresql/Behavior.py    
2005-06-18 07:52:28 UTC (rev 7617)
+++ trunk/gnue-common/src/datasources/drivers/postgresql/Behavior.py    
2005-06-18 11:24:31 UTC (rev 7618)
@@ -33,15 +33,6 @@
 
 class Behavior (DBSIG2.Behavior):
 
-  _RELKIND = {'v': {'type': 'view',  'name': _("Views")},
-              'r': {'type': 'table', 'name': _("Tables")}}
-
-  _maxIdLength   = 31
-  _alterMultiple = False
-  _numbers       = [[(4, 'smallint'), (9, 'integer'), (18, 'bigint')],
-                    "numeric (%s,0)", "numeric (%(length)s,%(scale)s)"]
-
-
   # ---------------------------------------------------------------------------
   # Constructor
   # ---------------------------------------------------------------------------
@@ -50,6 +41,14 @@
 
     DBSIG2.Behavior.__init__ (self, *args, **kwargs)
 
+    self._RELKIND = {'v': {'type': 'view',  'name': _("Views")},
+                     'r': {'type': 'table', 'name': _("Tables")}}
+
+    self._maxIdLength   = 31
+    self._alterMultiple = False
+    self._numbers       = [[(4, 'smallint'), (9, 'integer'), (18, 'bigint')],
+                           "numeric (%s,0)", "numeric (%(length)s,%(scale)s)"]
+
     # Build  typemap: {nativetype: (group, fieldtype)}
     self._TYPEMAP = {'date'  : ('date', 'date'),
                      'bool'  : ('boolean', 'boolean'),

Modified: trunk/gnue-common/src/datasources/drivers/sqlite/Behavior.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sqlite/Behavior.py        
2005-06-18 07:52:28 UTC (rev 7617)
+++ trunk/gnue-common/src/datasources/drivers/sqlite/Behavior.py        
2005-06-18 11:24:31 UTC (rev 7618)
@@ -48,10 +48,6 @@
 _SQLCODE     = re.compile ('\s*SELECT\s+(.*)\s+FROM\s+(\w+).*', re.I)
 _CMD         = re.compile ('(.*?)\((.*)\)(.*)')
 
-RELTYPE = {'table': {'type': 'table', 'name': _("Tables")},
-           'view' : {'type': 'view',  'name': _("Views")}}
-
-
 # =============================================================================
 # Excpetions
 # =============================================================================
@@ -74,19 +70,14 @@
 class Behavior (DBSIG2.Behavior):
   """
   Limitations:
-
-  * Since SQLite is typeless we cannot derive a 'length' for columns specified
-    as 'integer' or 'text' without any further information.
-  * SQLite does not support referential constraints
-  * SQLite has no real concept of a serial
-  * SQLite has no concept of a 'default with timestamp'
-  * Name of Primary Keys is not available
+    - Since SQLite is typeless we cannot derive a 'length' for columns
+      specified as 'integer' or 'text' without any further information.
+    - SQLite does not support referential constraints
+    - SQLite has no real concept of a serial
+    - SQLite has no concept of a 'default with timestamp'
+    - Name of Primary Keys is not available
   """
 
-  _maxIdLength   = 31
-  _alterMutliple = False
-  _numbers       = [[(None, 'integer')], "", "numeric (%(length)s,%(scale)s)"]
-
   # ---------------------------------------------------------------------------
   # Constructor
   # ---------------------------------------------------------------------------
@@ -94,6 +85,14 @@
   def __init__ (self, connection):
 
     DBSIG2.Behavior.__init__ (self, connection)
+
+    self._maxIdLength = 31
+    self._alterMutliple = False
+    self._numbers = [[(None, 'integer')], "", "numeric (%(length)s,%(scale)s)"]
+
+    self._RELTYPE = {'table': {'type': 'table', 'name': _("Tables")},
+                     'view' : {'type': 'view',  'name': _("Views")}}
+
     self._type2native.update ({'boolean': 'integer'})
 
 
@@ -139,11 +138,12 @@
 
     try:
       for (reltype, name, sql) in cursor.fetchall ():
-        if not reltype in RELTYPE:
+        if not reltype in self._RELTYPE:
           continue
 
         if not reltype in masters:
-          masters [reltype] = GSchema.GSTables (parent, **RELTYPE [reltype])
+          masters [reltype] = GSchema.GSTables (parent,
+              **self._RELTYPE [reltype])
 
         key = name.lower ()
         result [key] = GSchema.GSTable (masters [reltype], name = name,





reply via email to

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