commit-gnue
[Top][All Lists]
Advanced

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

r6388 - in trunk/gnue-common/src/datasources: . drivers/Base drivers/DBS


From: jcater
Subject: r6388 - in trunk/gnue-common/src/datasources: . drivers/Base drivers/DBSIG2 drivers/oracle/Base
Date: Thu, 23 Sep 2004 23:43:02 -0500 (CDT)

Author: jcater
Date: 2004-09-23 23:43:00 -0500 (Thu, 23 Sep 2004)
New Revision: 6388

Modified:
   trunk/gnue-common/src/datasources/GConnections.py
   trunk/gnue-common/src/datasources/GDataSource.py
   trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py
   trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py
   trunk/gnue-common/src/datasources/drivers/DBSIG2/RecordSet.py
   trunk/gnue-common/src/datasources/drivers/oracle/Base/Connection.py
Log:
 * More cruft left over from datasource case sensitivity. (Yes, I'm yelling at 
this point!)
 * Added primarykeyseq support (though I can't test it because datasource 
trigger namespace appears to be broken in forms :( )
 * Started on Requery support in Data Sources




Modified: trunk/gnue-common/src/datasources/GConnections.py
===================================================================
--- trunk/gnue-common/src/datasources/GConnections.py   2004-09-24 04:31:27 UTC 
(rev 6387)
+++ trunk/gnue-common/src/datasources/GConnections.py   2004-09-24 04:43:00 UTC 
(rev 6388)
@@ -215,7 +215,7 @@
 
 
   # ---------------------------------------------------------------------------
-  # get a connection instance on optionally log into it
+  # get a connection instance and optionally log into it
   # ---------------------------------------------------------------------------
 
   def getConnection (self, connection_name, login = False):
@@ -338,7 +338,7 @@
 
 
   # ---------------------------------------------------------------------------
-  # logon to a connection
+  # login to a connection
   # ---------------------------------------------------------------------------
 
   def loginToConnection (self, connection):
@@ -492,7 +492,7 @@
     """
     This function commits all transactions
     """
-    for connection in self._openConnections.values ():
+    for connection in self._openConnections.values():
       connection.commit()
 
 
@@ -500,7 +500,7 @@
     """
     This function rolls back all transactions
     """
-    for connection in self._openConnections.values ():
+    for connection in self._openConnections.values():
       connection.rollback()
 
 
@@ -508,6 +508,6 @@
     """
     This function closes all open connections.
     """
-    for connection in self._openConnections.values ():
+    for connection in self._openConnections.values():
       connection.close()
     self._openConnections = {}

Modified: trunk/gnue-common/src/datasources/GDataSource.py
===================================================================
--- trunk/gnue-common/src/datasources/GDataSource.py    2004-09-24 04:31:27 UTC 
(rev 6387)
+++ trunk/gnue-common/src/datasources/GDataSource.py    2004-09-24 04:43:00 UTC 
(rev 6388)
@@ -28,7 +28,6 @@
 #
 # HISTORY:
 #
-# $Id: $
 
 from gnue.common.apps import i18n, errors
 from gnue.common.datasources import GDataObjects
@@ -42,14 +41,16 @@
 
 ########################################################################
 #
-# Class that handles DataSources.  This is a subclass of GObj, which
-# means this class can be created from XML markup and stored in an
-# Object tree (e.g., a Forms tree).
 #
+#
 ########################################################################
 
 class GDataSource(GObjects.GObj):
-
+  """
+  Class that handles DataSources.  This is a subclass of GObj, which
+  means this class can be created from XML markup and stored in an
+  Object tree (e.g., a Forms tree).
+  """
   def __init__(self, parent=None, type="GDataSource"):
     GObjects.GObj.__init__(self, parent, type)
     self.type = "object"
@@ -60,12 +61,13 @@
     self._fieldReferences = {}
     self._unboundFieldReferences = {}
     self._defaultValues = {}
+    self._ignoreDispatchEvent = None
 
     self._inits =[self.primaryInit, self.secondaryInit, self.tertiaryInit]
     self._currentResultSet = None
     self._resultSetListeners = []
     self._toplevelParent = None # Needs to be set by subclass
-                                      # so that _topObject gets set
+                                # so that _topObject gets set
     self._topObject = None
 
     #
@@ -94,6 +96,17 @@
                                                'direct':1},
                                }
 
+  def _ignoreDispatchEvent(self, *args, **parms):
+    """
+    A dummy method that _dispatchEvent is initially set to; does nothing
+    """
+    pass
+
+  def setEventListener(self, listener):
+    self._dispatchEvent = listener
+    if self._dataObject:
+      self._dataObject._dispatchEvent = listener
+
   def __getattr__(self, attr):
     if self._dataObject and attr[1] != '_' and hasattr(self._dataObject,attr):
       return getattr(self._dataObject,attr)
@@ -227,8 +240,10 @@
          self._connections.getDataObject(self.connection, self.type)
       gDebug (7, "GDataSource.py bound to %s " % dataObject)
 
-    self.name = string.lower(self.name)
     self._topObject._datasourceDictionary[self.name]=self
+    # TODO: This added so we don't break old code by
+    # TODO: removing the case-insensitivity :(
+    self._topObject._datasourceDictionary[self.name.lower()]=self
 
     dataObject._fieldReferences = self._fieldReferences
     dataObject._unboundFieldReferences = self._unboundFieldReferences
@@ -317,7 +332,7 @@
 
 
   #
-  # The following are a simple wrapper around the datasource's dataobject
+  # The following is a simple wrapper around the datasource's dataobject
   # to hide the dataobject from the app programmer
   #
   def hasMaster(self):
@@ -375,7 +390,6 @@
 
     if hasattr(self, 'master') and self.master:
 
-      self.master = string.lower(self.master)
       gDebug (3, "Linking detail '%s' to master '%s'" \
                  % (self.name, self.master))
 
@@ -456,7 +470,6 @@
     self._inits =[self.initialize]
 
   def _buildObject(self):
-    self.name = string.lower(self.name)
     return GObjects.GObj._buildObject(self)
 
   def initialize(self):
@@ -529,7 +542,7 @@
                               'contains the name of the master datasource.',
                'Typecast': GTypecast.name },
             'masterlink':  {
-               'Label': _('M/D Master Field'),
+               'Label': _('M/D Master Field(s)'),
                'Description': 'If this datasource is the child in a '
                               'master/detail relationship, this property '
                               'contains a comma-separated list of the '
@@ -537,7 +550,7 @@
                               'linking.',
                'Typecast': GTypecast.text },
             'detaillink':  {
-               'Label': _('M/D Detail Field'),
+               'Label': _('M/D Detail Field(s)'),
                'Description': 'If this datasource is the child in a '
                               'master/detail relationship, this property '
                               'contains a comma-separated list of the '
@@ -551,8 +564,26 @@
                'Typecast': GTypecast.text },
             'primarykey': {
                'Label': _('Primary Key Field(s)'),
-               'Description': 'Comma-separated list of the fields that make up 
the primary key.',
-               'Typecast': GTypecast.text } },
+               'Description': 'Comma-separated list of the fields that '
+                              'make up the primary key.',
+               'Typecast': GTypecast.text },
+            'primarykeyseq': {
+               'Label': _('Primary Key Sequence'),
+               'Description': 'Name of the sequence used to populate a '
+                              'primary key (only applies to relational '
+                              'backends that support sequences; requires '
+                              'a single {primarykey} value.',
+               'Typecast': GTypecast.text },
+            'requery': {
+               'Label': _('Re-query on commit?'),
+               'Default': True,
+               'Description': 'Requery a record after posting it; requires '
+                              '{primarykey} support and a non-null primary '
+                              'key value at the time of update (whether '
+                              'via a trigger or by the use of '
+                              '{primarykeyseq}.',
+               'Typecast': GTypecast.text }
+               },
          'ParentTags': None },
       'staticset': {
          'BaseClass': GStaticSet,

Modified: trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py 2004-09-24 
04:31:27 UTC (rev 6387)
+++ trunk/gnue-common/src/datasources/drivers/Base/RecordSet.py 2004-09-24 
04:43:00 UTC (rev 6388)
@@ -43,8 +43,8 @@
   def __init__(self, parent, initialData={}, dbIdentifier=None, 
defaultData={}):
     self._detailObjects = []
     self._dbIdentifier = dbIdentifier
-    self._deleteFlag = 0
-    self._updateFlag = 0
+    self._deleteFlag = False
+    self._updateFlag = False
     self._parent = parent
     self._fieldOrder = {}
     self._modifiedFlags = {}      # If field name is present as a key,
@@ -55,13 +55,13 @@
     self._initialData = initialData
 
     if self._initialData and len(self._initialData):
-      self._insertFlag = 0
-      self._emptyFlag = 0
+      self._insertFlag = False
+      self._emptyFlag = False
       self._fields = {}
       self._fields.update(initialData)
     else:
-      self._insertFlag = 1
-      self._emptyFlag = 1
+      self._insertFlag = True
+      self._emptyFlag = True
       self._fields = {}
       self._fields.update(defaultData)
 
@@ -80,7 +80,7 @@
     # The _insertFlag and _deleteFlag takes care of records that
     # were inserted, but then deleted before a save (i.e., nothing to do)
     if self._emptyFlag or self._insertFlag and self._deleteFlag:
-      return 0
+      return False
     else:
       return self._insertFlag or self._deleteFlag or self._updateFlag
 
@@ -88,7 +88,7 @@
   # Returns 1=Record is pending a deletion
   def isDeleted(self):
     if self._emptyFlag:
-      return 0
+      return False
     else:
       return self._deleteFlag and not self._insertFlag
 
@@ -96,7 +96,7 @@
   # Returns 1=Record is pending an update
   def isModified(self):
     if self._emptyFlag or self._insertFlag:
-      return 0
+      return False
     else:
       return self._updateFlag
 
@@ -104,7 +104,7 @@
   # Returns 1=Record is pending an insertion
   def isInserted(self):
     if self._emptyFlag:
-      return 0
+      return False
     else:
       return self._insertFlag and not self._deleteFlag
 
@@ -117,7 +117,7 @@
   # Returns current value of "field"
   def getField(self, field):
     if self._parent._dataObject and self._parent._dataObject._connection:
-      field = self._parent._dataObject._connection.identifier (field)
+      field = self._parent._dataObject._connection.identifier(field)
     try:
       return self._fields[field]
     except KeyError:
@@ -140,8 +140,9 @@
   # Sets current value of "field"
   # If trackMod is set to 0 then the modification flag isn't raised
   def setField(self, field, value, trackMod = 1):
-    if self._parent._dataObject and self._parent._dataObject._connection:
-      field = self._parent._dataObject._connection.identifier (field)
+    do = self._parent._dataObject
+    if do and do._connection:
+      field = do._connection.identifier(field)
     gDebug (3, "setField: %s to %s" % (field, value))
     # If this field is bound to a datasource and the datasource is read only,
     # generate an error.
@@ -158,15 +159,15 @@
       # self._fields[fn] = value
       # new code:
       self._fields[field] = value
-      if trackMod == 1:
+      if trackMod:
         if self._parent.isFieldBound(field):
-          self._emptyFlag = 0
-          self._updateFlag = 1
+          self._emptyFlag = False
+          self._updateFlag = True
           # self._modifiedFlags[fn] = 1
-          self._modifiedFlags[field] = 1
+          self._modifiedFlags[field] = True
 
           try:
-            self._parent._dataObject._dataSource._onModification(self)
+            do._dataSource._onModification(self)
           except AttributeError:
             pass
     return value
@@ -195,12 +196,10 @@
 
   # Returns 1=Field has been modified
   def isFieldModified(self, fieldName):
-    if self._modifiedFlags.has_key (fieldName):
-      return 1
-    else:
-      #TODO: the string.lower() line should never be called but is left here
-      #TODO: until the code is clean
-      return self._modifiedFlags.has_key (string.lower(fieldName))
+    #TODO: the string.lower() line should never be called but is left here
+    #TODO: until the code is clean
+    return self._modifiedFlags.has_key(fieldName) or \
+           self._modifiedFlags.has_key (string.lower(fieldName))
 
 
   # Mark the current record as deleted
@@ -210,7 +209,7 @@
       tmsg = _("Attempted to delete from a read only datasource")
       raise Exceptions.ReadOnlyError, tmsg
     else:
-      self._deleteFlag = 1
+      self._deleteFlag = True
 
 
   # Posts changes to database

Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py      
2004-09-24 04:31:27 UTC (rev 6387)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/DataObject.py      
2004-09-24 04:43:00 UTC (rev 6388)
@@ -22,8 +22,10 @@
 # DBSIG2/DataObject.py
 #
 # DESCRIPTION:
-# Generic implementation of dbdriver using Python DB-SIG v2
-# specification.
+"""
+Generic implementation of dbdriver using Python DB-SIG v2
+specification.
+"""
 #
 # NOTES:
 # The classes below are meant to be extended
@@ -39,6 +41,7 @@
 import string
 import types
 import mx.DateTime
+from string import join, replace
 
 from ResultSet import ResultSet
 
@@ -103,9 +106,9 @@
 
 
     # TODO: uh, hmm..
-    self._strictQueryCount = 1   # strictQueryCount
+    self._strictQueryCount = True   # strictQueryCount
 
-    self.distinct = 0
+    self.distinct = False
 
     # If possible, this will contain the field names used in the last select
     # in the same order used in the SELECT statement.
@@ -113,7 +116,7 @@
 
     # Internal flag to avoid consistently doing the same check
     # If this is set to 1 initially, then the
-    self._primaryIdChecked = 1  # Internal flag
+    self._primaryIdChecked = False  # Internal flag
 
 
 
@@ -144,12 +147,12 @@
         if self._unicodeMode:
           GDebug.printMesg(0,'WARNING: non-unicode passed to the dbdriver 
(%s)' % value)
 
-        return "'%s'" % string.replace(value,
+        return "'%s'" % replace(value,
                                        "'",
                                        "%s'" % self._escapeSingleQuote)
 
       elif type(value) == types.UnicodeType:
-        return "'%s'" % string.replace(value,
+        return "'%s'" % replace(value,
                                        "'",
                                        "%s'" % self._escapeSingleQuote)
 
@@ -165,25 +168,25 @@
         # FIXME: raise an error instead of just printing a warning, after some 
transition time
         #raise GDataObjects.UnknownDataType, err
         GDebug.printMesg (0,err)
-        return "'%s'" % string.replace(str(value),
+        return "'%s'" % replace(str(value),
                                        "'",
                                        "%s'" % self._escapeSingleQuote)
 
 
   # Used by drivers with a unique id (like rowid) (see Oracle for example)
   def _checkForPrimaryId(self):
-    self._primaryIdChecked = 1
+    self._primaryIdChecked = True
 
 
-  def _createResultSet(self, conditions={}, readOnly=0,
+  def _createResultSet(self, conditions={}, readOnly=False,
                        masterRecordSet=None,sql=""):
 
     # Used by drivers with a unique id (like rowid)
     if not self._primaryIdChecked: self._checkForPrimaryId()
 
     try:
-      query = self._buildQuery (conditions, additionalSQL = sql)
-      cursor = self._connection.makecursor (query)
+      query = self._buildQuery(conditions, additionalSQL = sql)
+      cursor = self._connection.makecursor(query)
       cursor.arraysize = self.cache
 
       # pull a record count
@@ -284,7 +287,7 @@
           return self.conditionElements[otype][2] % tuple(result)
         else:
           return self.conditionElements[otype][2] % \
-            (string.join(result, self.conditionElements[otype][3]))
+            (join(result, self.conditionElements[otype][3]))
       else:
         tmsg = u_('Condition clause "%s" is not supported by this db driver.') 
% otype
         raise Exceptions.ConditionNotSupported, tmsg
@@ -318,15 +321,13 @@
 
     if forDetail:
       q = "(%s) in (SELECT %s FROM %s%s)" % \
-                     (string.join(self._masterfields,","),
-                      string.join(self._detailfields,","),
+                     (join(self._masterfields,","),
+                      join(self._detailfields,","),
                       self.table, whereClause)
-    elif len(self._fieldReferences):
-      self._fieldOrder = fields = []
-      for field in self._fieldReferences.keys():
-        fields.append(field)
+    elif self._fieldReferences:
+      self._fieldOrder = fields = self._fieldReferences.keys()
       q = "SELECT %s%s%s FROM %s%s" % \
-           (distinct, pis, string.join(fields,","), self.table,
+           (distinct, pis, join(fields,","), self.table,
             whereClause)
       if pis:
         self._fieldOrder.insert(0,None)

Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/RecordSet.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/RecordSet.py       
2004-09-24 04:31:27 UTC (rev 6387)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/RecordSet.py       
2004-09-24 04:43:00 UTC (rev 6388)
@@ -22,8 +22,10 @@
 # _dbsig/DBdriver.py
 #
 # DESCRIPTION:
-# Generic implementation of dbdriver using Python DB-SIG v2
-# specification.
+"""
+Generic implementation of dbdriver using Python DB-SIG v2
+specification.
+"""
 #
 # NOTES:
 # The classes below are meant to be extended
@@ -36,7 +38,7 @@
 from gnue.common.datasources import GConditions, Exceptions
 from gnue.common.datasources.drivers.Base import RecordSet as BaseRecordSet
 from gnue.common.apps import GDebug
-import string
+from string import join
 
 
 ######################################################################
@@ -46,10 +48,22 @@
 class RecordSet(BaseRecordSet):
 
   def _postChanges(self):
+    do = self._parent._dataObject
     if not self.isPending(): return
+
     if self._deleteFlag:
       s = self._buildDeleteStatement()
     elif self._insertFlag:
+      #
+      # Check for empty primary key and set with the sequence value if so
+      #
+      if do.primarykey and do.primarykeyseq and ',' not in do.primarykey and \
+         hasattr(do._connection,'getsequence') and \
+         self.getField(do.primarykey) is None:
+        try:
+          
self.setField(do.primarykey,do._connection.getsequence(do.primarykeyseq))
+        except do._connection._DatabaseError, err:
+          raise exceptions.InvalidDatasourceDefintion, err
       s = self._buildInsertStatement()
     elif self._updateFlag:
       s = self._buildUpdateStatement()
@@ -64,21 +78,20 @@
     GDebug.printMesg(5, "_postChanges: statement=%s" % statement)
 
     try:
-      self._parent._dataObject._connection.sql (statement, parameters)
+      do._connection.sql (statement, parameters)
 
       # Set _initialData to be the just-now posted values
       if not self._deleteFlag:
-        self._initialData = {}
-        self._initialData.update(self._fields)
+        self._initialData = {}.update(self._fields)
 
-    except self._parent._dataObject._connection._DatabaseError, err:
+    except do._connection._DatabaseError, err:
       raise Exceptions.ConnectionError, err
 
-    self._updateFlag = 0
-    self._insertFlag = 0
-    self._deleteFlag = 0
+    self._updateFlag = False
+    self._insertFlag = False
+    self._deleteFlag = False
 
-    return 1
+    return True
 
 
   # If a vendor can do any of these more efficiently (i.e., use a known
@@ -88,9 +101,10 @@
 
   # This function is only used with "useParameters" set in gnue.conf
   def _where (self):
-    if self._initialData.has_key(self._parent._dataObject._primaryIdField):
-      where = [self._parent._dataObject._primaryIdFormat % \
-               self._initialData [self._parent._dataObject._primaryIdField]]
+    do = self._parent._dataObject
+    if self._initialData.has_key(do._primaryIdField):
+      where = [do._primaryIdFormat % \
+               self._initialData [do._primaryIdField]]
       parameters = {}
     else:
       where = []
@@ -104,18 +118,19 @@
             where.append ("%s=%%(%s)s" % (field, key))
             parameters [key] = self._initialData [field]
 
-    return (string.join (where, ' AND '), parameters)
+    return (join (where, ' AND '), parameters)
 
   def _buildDeleteStatement(self):
+    do = self._parent._dataObject
     if gConfig ('useParameters'):
       (where, parameters) = self._where ()
       statement = 'DELETE FROM %s WHERE %s' % \
-                  (self._parent._dataObject.table, where)
+                  (do.table, where)
       return (statement, parameters)
     else:
-      if self._initialData.has_key(self._parent._dataObject._primaryIdField):
-        where = [self._parent._dataObject._primaryIdFormat % \
-            self._initialData[self._parent._dataObject._primaryIdField]  ]
+      if self._initialData.has_key(do._primaryIdField):
+        where = [do._primaryIdFormat % \
+            self._initialData[do._primaryIdField]  ]
       else:
         where = []
         for field in self._initialData.keys():
@@ -124,13 +139,14 @@
               where.append ("%s IS NULL" % field)
             else:
               where.append ("%s=%s" % (field,
-                
self._parent._dataObject._toSqlString(self._initialData[field])))
+                do._toSqlString(self._initialData[field])))
 
       statement = "DELETE FROM %s WHERE %s" % \
-         (self._parent._dataObject.table, string.join(where,' AND ') )
+         (do.table, join(where,' AND ') )
       return statement
 
   def _buildInsertStatement(self):
+    do = self._parent._dataObject
     if gConfig ('useParameters'):
       fields = []
       values = []
@@ -144,9 +160,9 @@
           parameters [key] = self._fields [field]
 
       statement = "INSERT INTO %s (%s) VALUES (%s)" % \
-                  (self._parent._dataObject.table,
-                   string.join (fields,', '),
-                   string.join (values,', '))
+                  (do.table,
+                   join (fields,', '),
+                   join (values,', '))
 
       return (statement, parameters)
     else:
@@ -159,43 +175,70 @@
           if self._fields[field] == None or self._fields[field] == '':
             vals.append ("NULL") #  % (self._fields[field]))
           else:
-            vals.append 
(self._parent._dataObject._toSqlString(self._fields[field]))
+            vals.append (do._toSqlString(self._fields[field]))
 
       return "INSERT INTO %s (%s) VALUES (%s)" % \
-         (self._parent._dataObject.table, string.join(fields,','), \
-          string.join(vals,',') )
+         (do.table, join(fields,','), \
+          join(vals,',') )
 
   def _buildUpdateStatement(self):
+    do = self._parent._dataObject
     if gConfig ('useParameters'):
       (where, parameters) = self._where ()
       updates = []
       for field in self._modifiedFlags.keys():
         key = 'new_' + field
         updates.append ("%s=%%(%s)s" % (field, key))
-        parameters [key] = self._fields [field]
+        parameters[key] = self._fields [field]
 
       statement = "UPDATE %s SET %s WHERE %s" % \
-                  (self._parent._dataObject.table,
-                   string.join (updates, ', '),
+                  (do.table,
+                   join(updates, ', '),
                    where)
       return (statement, parameters)
     else:
       updates = []
       for field in self._modifiedFlags.keys():
         updates.append ("%s=%s" % (field,
-           self._parent._dataObject._toSqlString(self._fields[field])))
+           do._toSqlString(self._fields[field])))
 
-      if self._parent._dataObject._primaryIdField:
-        where = [self._parent._dataObject._primaryIdFormat % \
-            self._initialData[self._parent._dataObject._primaryIdField]  ]
+      if do._primaryIdField:
+        where = [do._primaryIdFormat % \
+            self._initialData[do._primaryIdField]  ]
       else:
         where = []
         for field in self._initialData.keys():
           if self._initialData[field] == None:
             where.append ("%s IS NULL" % field)
           else:
-            where.append ("%s=%s" % (field, 
self._parent._dataObject._toSqlString(self._initialData[field])))
+            where.append ("%s=%s" % (field, 
do._toSqlString(self._initialData[field])))
 
       return "UPDATE %s SET %s WHERE %s" % \
-         (self._parent._dataObject.table, string.join(updates,','), \
-          string.join(where,' AND ') )
+         (do.table, join(updates,','), \
+          join(where,' AND ') )
+
+  def _requery(self):
+    """
+    Requery a posted record to capture any changes made by the database
+    """
+    return  # TODO: Will test tomorrow
+
+    do = self._parent._dataObject
+    if not do.primarykey or not do._fieldReferences or \
+       self._fields.get(key,None) is None :
+      return False
+    fields = self._fieldReferences.keys()
+    where = []
+    for key in do.primarykeys.split(','):
+      where.append("%s=%s"%(key,do._toSqlString(self._fields[key])))
+    select = "SELECT %s FROM %s WHERE %s" % (
+            join(fields,','), do.table, join(where,' and '))
+    print select
+    try:
+      cursor = self._connection.makecursor(select)
+      f = cursor.fetchone()
+      for i in range(len(f)):
+        self.setField(fields[i], f[i], False)
+    except do._connection._DatabaseError, err:
+      raise Exceptions.ConnectionError, err
+    return True

Modified: trunk/gnue-common/src/datasources/drivers/oracle/Base/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/oracle/Base/Connection.py 
2004-09-24 04:31:27 UTC (rev 6387)
+++ trunk/gnue-common/src/datasources/drivers/oracle/Base/Connection.py 
2004-09-24 04:43:00 UTC (rev 6388)
@@ -22,8 +22,10 @@
 # Oracle/Base/Connection.py
 #
 # DESCRIPTION:
-# Driver to provide access to data via Computronix's Oracle/Python Driver
-# Requires cx_Oracle 2.2+ (http://www.computronix.com/utilities/)
+"""
+Driver to provide access to data via Computronix's Oracle/Python Driver
+Requires cx_Oracle 2.2+ (http://www.computronix.com/utilities/)
+"""
 #
 # NOTES:
 #





reply via email to

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