commit-gnue
[Top][All Lists]
Advanced

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

CVSROOT: /cvsroot/gnue


From: Jason Cater
Subject: CVSROOT: /cvsroot/gnue
Date: Tue, 18 Nov 2003 22:00:26 -0500

Module name:    gnue-common
Branch:         datasource-cleanup
Changes by:     Jason Cater <address@hidden>    03/11/18 22:00:25
Reply-to: address@hidden

CVSROOT:        /cvsroot/gnue
Module name:    gnue-common
Branch:         datasource-cleanup
Changes by:     Jason Cater <address@hidden>    03/11/18 22:00:25

Modified files:
        src/datasources: GConnections.py GDataObjects.py 
                         GIntrospection.py 
        src/datasources/drivers/adodbapi/Schema/Discovery: 
                                                           Introspection.py 
        src/datasources/drivers/appserver/Schema/Discovery: 
                                                            Introspection.py 
        src/datasources/drivers/db2/Schema/Discovery: Introspection.py 
        src/datasources/drivers/dbf/Schema/Discovery: Introspection.py 
        src/datasources/drivers/gadfly/Schema/Discovery: 
                                                         Introspection.py 
        src/datasources/drivers/mysql/Schema/Discovery: Introspection.py 
        src/datasources/drivers/oracle/Base: DataObject.py RecordSet.py 
                                             ResultSet.py 
        src/datasources/drivers/oracle/Schema/Discovery: 
                                                         Introspection.py 
        src/datasources/drivers/oracle/dcoracle: Driver.py 
        src/datasources/drivers/postgresql/Base: DataObject.py 
        src/datasources/drivers/postgresql/Schema/Discovery: 
                                                             Introspection.py 
        src/datasources/drivers/sapdb/Schema/Discovery: Introspection.py 
        src/datasources/drivers/sqlite/Schema/Discovery: 
                                                         Introspection.py 

Log message:
        more fixes for the Introspection classes and some work on Oracle

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/GConnections.py.diff?only_with_tag=datasource-cleanup&tr1=1.52.2.5&tr2=1.52.2.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/GDataObjects.py.diff?only_with_tag=datasource-cleanup&tr1=1.72.2.3&tr2=1.72.2.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/GIntrospection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/adodbapi/Schema/Discovery/Introspection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.2&tr2=1.1.2.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/db2/Schema/Discovery/Introspection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/dbf/Schema/Discovery/Introspection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/gadfly/Schema/Discovery/Introspection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/mysql/Schema/Discovery/Introspection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/oracle/Base/DataObject.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/oracle/Base/RecordSet.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/oracle/Base/ResultSet.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/oracle/Schema/Discovery/Introspection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/oracle/dcoracle/Driver.py.diff?only_with_tag=datasource-cleanup&tr1=1.24.2.1&tr2=1.24.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/postgresql/Base/DataObject.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.2&tr2=1.1.2.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/postgresql/Schema/Discovery/Introspection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/sapdb/Schema/Discovery/Introspection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/datasources/drivers/sqlite/Schema/Discovery/Introspection.py.diff?only_with_tag=datasource-cleanup&tr1=1.1.2.1&tr2=1.1.2.2&r1=text&r2=text

Patches:
Index: gnue-common/src/datasources/GConnections.py
diff -c gnue-common/src/datasources/GConnections.py:1.52.2.5 
gnue-common/src/datasources/GConnections.py:1.52.2.6
*** gnue-common/src/datasources/GConnections.py:1.52.2.5        Tue Nov 18 
21:15:16 2003
--- gnue-common/src/datasources/GConnections.py Tue Nov 18 22:00:23 2003
***************
*** 183,189 ****
  
  
  
!   def getConnection(self, connection_name):
  
  
      connection_name = connection_name.lower()
--- 183,189 ----
  
  
  
!   def getConnection(self, connection_name, login=0):
  
  
      connection_name = connection_name.lower()
***************
*** 221,227 ****
      dbdriver = None
  
      basemodule = _find_base_driver(basedriver, ALLDRIVERS)
-     print "base=" + basemodule
      GDebug.printMesg(1,'Using %s as base driver for %s' %  (basemodule, 
driver))
  
      if basemodule:
--- 221,226 ----
***************
*** 234,241 ****
  
      conn = dbdriver.Connection(self, connection_name, parameters)
      self._openConnections[connection_name] = conn
-     return conn
  
  
  
    #
--- 233,246 ----
  
      conn = dbdriver.Connection(self, connection_name, parameters)
      self._openConnections[connection_name] = conn
  
+     if login:
+       self.loginToConnection(conn)
+ 
+     # TODO: Process the behavior = and
+     # TODO: set conn.behavior= to the
+     # TODO: specific Introspection class
+     return conn
  
  
    #
***************
*** 403,408 ****
--- 408,421 ----
              tmsg = _("User canceled the login request.")
              raise Exceptions.LoginError, tmsg
  
+     # Create the introspection instance
+     try:
+       behavior = connection.behavior
+     except AttributeError:
+       behavior = connection.defaultBehavior
+     connection.introspector = behavior(connection)
+ 
+     # Done
      connection.__connected = 1
  
  
Index: gnue-common/src/datasources/GDataObjects.py
diff -c gnue-common/src/datasources/GDataObjects.py:1.72.2.3 
gnue-common/src/datasources/GDataObjects.py:1.72.2.4
*** gnue-common/src/datasources/GDataObjects.py:1.72.2.3        Tue Nov 18 
21:07:06 2003
--- gnue-common/src/datasources/GDataObjects.py Tue Nov 18 22:00:23 2003
***************
*** 37,60 ****
  # Used to store schema data
  # TODO: Is this used anywhere??
  import string
- class Schema:
-   def __init__(self, attrs={}, getChildSchema=None):
-     self.name = ''
-     self.type = ''
-     self.__dict__.update(attrs)
-     if getChildSchema != None:
-       self.getChildSchema = getChildSchema
- 
-   def __cmp__(self, other):
-     if not isinstance(other, Schema):
-       return 1
-     elif id(other) == id(self):
-       return 0
-     else:
-       return cmp(string.lower(self.name), string.lower(other.name)) or 1
- 
-   def getChildSchema(self, parent):
-     return ()
- 
- 
- 
--- 37,39 ----
Index: gnue-common/src/datasources/GIntrospection.py
diff -c gnue-common/src/datasources/GIntrospection.py:1.1.2.1 
gnue-common/src/datasources/GIntrospection.py:1.1.2.2
*** gnue-common/src/datasources/GIntrospection.py:1.1.2.1       Thu Oct  9 
21:21:09 2003
--- gnue-common/src/datasources/GIntrospection.py       Tue Nov 18 22:00:23 2003
***************
*** 34,40 ****
  #    connection.schema.<function>
  #
  
! 
  
  
  #
--- 34,40 ----
  #    connection.schema.<function>
  #
  
! import string
  
  
  #
***************
*** 42,47 ****
--- 42,50 ----
  #
  class Introspection:
  
+   def __init__(self, connection):
+     self._connection = connection
+ 
    # Return a list of the types of Schema objects this driver provides
    # Contains tuples of (key, description, dataSource??)
    # dataSource?? is true if this schema type can be a datasource
***************
*** 61,66 ****
--- 64,91 ----
    def write(self,obj,overwrite=0):
      tmsg = _("This database adapter doesn't have 'schema writing' support")
      raise NoWriteSchemaSupport, tmsg
+ 
+ 
+ 
+ # Used by the introspection classes
+ class Schema:
+   def __init__(self, attrs={}, getChildSchema=None):
+     self.name = ''
+     self.type = ''
+     self.__dict__.update(attrs)
+     if getChildSchema != None:
+       self.getChildSchema = getChildSchema
+ 
+   def __cmp__(self, other):
+     if not isinstance(other, Schema):
+       return 1
+     elif id(other) == id(self):
+       return 0
+     else:
+       return cmp(string.lower(self.name), string.lower(other.name)) or 1
+ 
+   def getChildSchema(self, parent):
+     return ()
  
  
  
Index: 
gnue-common/src/datasources/drivers/adodbapi/Schema/Discovery/Introspection.py
diff -c 
gnue-common/src/datasources/drivers/adodbapi/Schema/Discovery/Introspection.py:1.1.2.1
 
gnue-common/src/datasources/drivers/adodbapi/Schema/Discovery/Introspection.py:1.1.2.2
*** 
gnue-common/src/datasources/drivers/adodbapi/Schema/Discovery/Introspection.py:1.1.2.1
      Thu Oct  9 21:21:11 2003
--- 
gnue-common/src/datasources/drivers/adodbapi/Schema/Discovery/Introspection.py  
    Tue Nov 18 22:00:24 2003
***************
*** 69,75 ****
    # Return a list of Schema objects
    def getSchemaList(self, type=None):
      QueryType = adSchemaTables
!     rs = self.adoConn.OpenSchema(QueryType)
  
      rs.MoveFirst()
      tables = []
--- 69,75 ----
    # Return a list of Schema objects
    def getSchemaList(self, type=None):
      QueryType = adSchemaTables
!     rs = self._connection.native.OpenSchema(QueryType)
  
      rs.MoveFirst()
      tables = []
***************
*** 82,88 ****
  
      list = []
      for t in tables:
!       list.append(GDataObjects.Schema(attrs={'id':t[0], 'name':t[0],
                           'type':t[1],
                         'primarykey': self.__getPrimaryKey(t[0])},
                           getChildSchema=self.__getFieldSchema))
--- 82,88 ----
  
      list = []
      for t in tables:
!       list.append(GIntrospection.Schema(attrs={'id':t[0], 'name':t[0],
                           'type':t[1],
                         'primarykey': self.__getPrimaryKey(t[0])},
                           getChildSchema=self.__getFieldSchema))
***************
*** 91,97 ****
    # Find a schema object with specified name
    def getSchemaByName(self, name, type=None):
  
!     schema = GDataObjects.Schema(attrs={'id':name, 'name':name,
                           'type':'table',
                         'primarykey': self.__getPrimaryKey(name)},
                           getChildSchema=self.__getFieldSchema)
--- 91,97 ----
    # Find a schema object with specified name
    def getSchemaByName(self, name, type=None):
  
!     schema = GIntrospection.Schema(attrs={'id':name, 'name':name,
                           'type':'table',
                         'primarykey': self.__getPrimaryKey(name)},
                           getChildSchema=self.__getFieldSchema)
***************
*** 106,112 ****
    def __getFieldSchema(self, parent):
      statement = "select * from %s where 0=1" % (parent.name)
  
!     cursor = self.cursor()
      cursor.execute(statement)
  
      list = []
--- 106,112 ----
    def __getFieldSchema(self, parent):
      statement = "select * from %s where 0=1" % (parent.name)
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
***************
*** 133,139 ****
        else:
          attrs['datatype']='text'
  
!       list.append(GDataObjects.Schema(attrs=attrs))
  
      cursor.close()
      return list
--- 133,139 ----
        else:
          attrs['datatype']='text'
  
!       list.append(GIntrospection.Schema(attrs=attrs))
  
      cursor.close()
      return list
Index: 
gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py
diff -c 
gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py:1.1.2.2
 
gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py:1.1.2.3
*** 
gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py:1.1.2.2
     Fri Nov  7 11:14:20 2003
--- 
gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py 
    Tue Nov 18 22:00:24 2003
***************
*** 68,74 ****
          return []
  
        try:
!         listcursor = 
self._dataConnection.request('gnue_class',[],['gnue_module'],['gnue_name','gnue_comment','gnue_module'])
        except Exception, msg:
          print "error %s" %msg
          GDebug.printMesg(1,_("Error creating introspection module list \n\n 
--- %s ---)") % msg)
--- 68,74 ----
          return []
  
        try:
!         listcursor = 
self._connection.native.request('gnue_class',[],['gnue_module'],['gnue_name','gnue_comment','gnue_module'])
        except Exception, msg:
          print "error %s" %msg
          GDebug.printMesg(1,_("Error creating introspection module list \n\n 
--- %s ---)") % msg)
***************
*** 80,86 ****
          data = listcursor.fetch()
          for classdef in data:
            print classdef
!           schema = 
GDataObjects.Schema(attrs={'id':string.lower(classdef['gnue_name']),
                                                'name':classdef['gnue_name'],
                                                'type':'object',
                                                'gnue_id':classdef['gnue_id']},
--- 80,86 ----
          data = listcursor.fetch()
          for classdef in data:
            print classdef
!           schema = 
GIntrospection.Schema(attrs={'id':string.lower(classdef['gnue_name']),
                                                'name':classdef['gnue_name'],
                                                'type':'object',
                                                'gnue_id':classdef['gnue_id']},
***************
*** 99,105 ****
    
    def getSchemaByName(self, name, type=None): 
        try:
!         listcursor = self._dataConnection.request('gnue_class', [["eq", ""], 
["field", "gnue_name"], ["const", name]],
                                                    
['gnue_module'],['gnue_name','gnue_comment','gnue_module'])
        except Exception, msg:
          print "error %s" %msg
--- 99,105 ----
    
    def getSchemaByName(self, name, type=None): 
        try:
!         listcursor = self._connection.native.request('gnue_class', [["eq", 
""], ["field", "gnue_name"], ["const", name]],
                                                    
['gnue_module'],['gnue_name','gnue_comment','gnue_module'])
        except Exception, msg:
          print "error %s" %msg
***************
*** 110,116 ****
        if len(data):
          classdef = data[0]
          print classdef
!         schema = 
GDataObjects.Schema(attrs={'id':string.lower(classdef['gnue_name']),
                                              'name':classdef['gnue_name'],
                                              'type':'object',
                                              'gnue_id':classdef['gnue_id']},
--- 110,116 ----
        if len(data):
          classdef = data[0]
          print classdef
!         schema = 
GIntrospection.Schema(attrs={'id':string.lower(classdef['gnue_name']),
                                              'name':classdef['gnue_name'],
                                              'type':'object',
                                              'gnue_id':classdef['gnue_id']},
***************
*** 127,133 ****
    def __getChildSchema(self, parent):
        try:
          # fetch all properties used by class "parent"
!         listcursor = self._dataConnection.request('gnue_property',  # class
                                                    [["eq", ""], ["field", 
"gnue_class"],
                                                                 ["const", 
parent.gnue_id]], # condition
                                                    ['gnue_module'],  # sort
--- 127,133 ----
    def __getChildSchema(self, parent):
        try:
          # fetch all properties used by class "parent"
!         listcursor = self._connection.native.request('gnue_property',  # class
                                                    [["eq", ""], ["field", 
"gnue_class"],
                                                                 ["const", 
parent.gnue_id]], # condition
                                                    ['gnue_module'],  # sort
***************
*** 159,165 ****
            else:
              attrs['length'] =  propdef['gnue_length']
  
!           list.append(GDataObjects.Schema(attrs=attrs))
  
        listcursor.close()
  
--- 159,165 ----
            else:
              attrs['length'] =  propdef['gnue_length']
  
!           list.append(GIntrospection.Schema(attrs=attrs))
  
        listcursor.close()
  
Index: gnue-common/src/datasources/drivers/db2/Schema/Discovery/Introspection.py
diff -c 
gnue-common/src/datasources/drivers/db2/Schema/Discovery/Introspection.py:1.1.2.1
 
gnue-common/src/datasources/drivers/db2/Schema/Discovery/Introspection.py:1.1.2.2
*** 
gnue-common/src/datasources/drivers/db2/Schema/Discovery/Introspection.py:1.1.2.1
   Thu Oct  9 21:21:12 2003
--- gnue-common/src/datasources/drivers/db2/Schema/Discovery/Introspection.py   
Tue Nov 18 22:00:24 2003
***************
*** 86,97 ****
  
      GDebug.printMesg(5,statement)
  
!     cursor = self.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GDataObjects.Schema(attrs={'id':string.lower(rs[0]), 
'name':rs[1],
                           'type':rs[2]},
                           getChildSchema=self.__getFieldSchema))
  
--- 86,97 ----
  
      GDebug.printMesg(5,statement)
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GIntrospection.Schema(attrs={'id':string.lower(rs[0]), 
'name':rs[1],
                           'type':rs[2]},
                           getChildSchema=self.__getFieldSchema))
  
***************
*** 120,131 ****
  
      GDebug.printMesg(5,statement)
  
!     cursor = self.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GDataObjects.Schema(attrs={'id':string.lower(rs[0]), 
'name':rs[1],
                           'type':rs[2]},
                           getChildSchema=self.__getFieldSchema))
  
--- 120,131 ----
  
      GDebug.printMesg(5,statement)
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GIntrospection.Schema(attrs={'id':string.lower(rs[0]), 
'name':rs[1],
                           'type':rs[2]},
                           getChildSchema=self.__getFieldSchema))
  
***************
*** 146,152 ****
  
      schema, name, type = string.split(parent.id,'.')
  
!     cursor = self.cursor()
  
      if type == 'a':
        statement = "select base_tabschema, base_tabname " + \
--- 146,152 ----
  
      schema, name, type = string.split(parent.id,'.')
  
!     cursor = self._connection.native.cursor()
  
      if type == 'a':
        statement = "select base_tabschema, base_tabname " + \
***************
*** 190,196 ****
        if rs[5] != 0:
          attrs['length'] = rs[4]
  
!       list.append(GDataObjects.Schema(attrs=attrs))
  
      cursor.close()
      return tuple(list)
--- 190,196 ----
        if rs[5] != 0:
          attrs['length'] = rs[4]
  
!       list.append(GIntrospection.Schema(attrs=attrs))
  
      cursor.close()
      return tuple(list)
Index: gnue-common/src/datasources/drivers/dbf/Schema/Discovery/Introspection.py
diff -c 
gnue-common/src/datasources/drivers/dbf/Schema/Discovery/Introspection.py:1.1.2.1
 
gnue-common/src/datasources/drivers/dbf/Schema/Discovery/Introspection.py:1.1.2.2
*** 
gnue-common/src/datasources/drivers/dbf/Schema/Discovery/Introspection.py:1.1.2.1
   Thu Oct  9 21:21:14 2003
--- gnue-common/src/datasources/drivers/dbf/Schema/Discovery/Introspection.py   
Tue Nov 18 22:00:24 2003
***************
*** 62,68 ****
    # Return a list of Schema objects
    # Return a list of Schema objects
    def getSchemaList(self, type=None):
!     tablename=self.native.fname
      if tablename[-4:]=='.dbf':
          tablename=tablename[:-4]
  
--- 62,68 ----
    # Return a list of Schema objects
    # Return a list of Schema objects
    def getSchemaList(self, type=None):
!     tablename=self._connection.native.fname
      if tablename[-4:]=='.dbf':
          tablename=tablename[:-4]
  
***************
*** 75,81 ****
  
    # Find a schema object with specified name
    def getSchemaByName(self, name, type=None):
!     tablename=self.native.fname
      if tablename[-4:]=='.dbf':
          tablename=tablename[:-4]
  
--- 75,81 ----
  
    # Find a schema object with specified name
    def getSchemaByName(self, name, type=None):
!     tablename=self._connection.native.fname
      if tablename[-4:]=='.dbf':
          tablename=tablename[:-4]
  
***************
*** 88,94 ****
    def __getFieldSchema(self, parent):
  
      list = []
!     for field in self.native.fields:
  
        fname=string.lower(field[0])
  
--- 88,94 ----
    def __getFieldSchema(self, parent):
  
      list = []
!     for field in self._connection.native.fields:
  
        fname=string.lower(field[0])
  
Index: 
gnue-common/src/datasources/drivers/gadfly/Schema/Discovery/Introspection.py
diff -c 
gnue-common/src/datasources/drivers/gadfly/Schema/Discovery/Introspection.py:1.1.2.1
 
gnue-common/src/datasources/drivers/gadfly/Schema/Discovery/Introspection.py:1.1.2.2
*** 
gnue-common/src/datasources/drivers/gadfly/Schema/Discovery/Introspection.py:1.1.2.1
        Thu Oct  9 21:21:15 2003
--- 
gnue-common/src/datasources/drivers/gadfly/Schema/Discovery/Introspection.py    
    Tue Nov 18 22:00:24 2003
***************
*** 67,73 ****
  
      statement = "select * from __table_names__"
  
!     cursor = self.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
  
--- 67,73 ----
  
      statement = "select * from __table_names__"
  
!     cursor = self._connection.native.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
  
***************
*** 75,81 ****
      for rs in cursor.fetchall():
        # exclude any system tables and views. f.e. __table_names__
        if rs[1][:2]!="__":
!         list.append(GDataObjects.Schema(attrs={'id':rs[1], 'name':rs[1], \
                                  'type':rs[0] == 1 and 'view' or 'table',},
                                         getChildSchema=self.__getFieldSchema))
  
--- 75,81 ----
      for rs in cursor.fetchall():
        # exclude any system tables and views. f.e. __table_names__
        if rs[1][:2]!="__":
!         list.append(GIntrospection.Schema(attrs={'id':rs[1], 'name':rs[1], \
                                  'type':rs[0] == 1 and 'view' or 'table',},
                                         getChildSchema=self.__getFieldSchema))
  
***************
*** 87,99 ****
    def getSchemaByName(self, name, type=None):
      statement = "SELECT * from __table_names__ WHERE TABLE_NAME='%s'" % (name)
  
!     cursor = self.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
  
      rs = cursor.fetchone()
      if rs:
!       schema = GDataObjects.Schema(attrs={'id':rs[1], 'name':rs[1], \
                                  'type':rs[0] == 1 and 'view' or 'table',},
                                         getChildSchema=self.__getFieldSchema)
      else:
--- 87,99 ----
    def getSchemaByName(self, name, type=None):
      statement = "SELECT * from __table_names__ WHERE TABLE_NAME='%s'" % (name)
  
!     cursor = self._connection.native.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
  
      rs = cursor.fetchone()
      if rs:
!       schema = GIntrospection.Schema(attrs={'id':rs[1], 'name':rs[1], \
                                  'type':rs[0] == 1 and 'view' or 'table',},
                                         getChildSchema=self.__getFieldSchema)
      else:
***************
*** 111,117 ****
      
      statement = "SELECT * FROM __COLUMNS__ WHERE TABLE_NAME='%s'" % parent.id
  
!     cursor = self.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
      columns = cursor.description
--- 111,117 ----
      
      statement = "SELECT * FROM __COLUMNS__ WHERE TABLE_NAME='%s'" % parent.id
  
!     cursor = self._connection.native.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
      columns = cursor.description
***************
*** 145,151 ****
        #except ValueError:
        #  GDebug.printMesg(1,'WARNING: mysql native type error: %s' % 
nativetype)
  
!       list.append(GDataObjects.Schema(attrs=attrs))
  
      cursor.close()
      return list
--- 145,151 ----
        #except ValueError:
        #  GDebug.printMesg(1,'WARNING: mysql native type error: %s' % 
nativetype)
  
!       list.append(GIntrospection.Schema(attrs=attrs))
  
      cursor.close()
      return list
Index: 
gnue-common/src/datasources/drivers/mysql/Schema/Discovery/Introspection.py
diff -c 
gnue-common/src/datasources/drivers/mysql/Schema/Discovery/Introspection.py:1.1.2.1
 
gnue-common/src/datasources/drivers/mysql/Schema/Discovery/Introspection.py:1.1.2.2
*** 
gnue-common/src/datasources/drivers/mysql/Schema/Discovery/Introspection.py:1.1.2.1
 Thu Oct  9 21:21:20 2003
--- gnue-common/src/datasources/drivers/mysql/Schema/Discovery/Introspection.py 
Tue Nov 18 22:00:24 2003
***************
*** 70,81 ****
      # TODO: This excludes any system tables and views. Should it?
      statement = "SHOW TABLES"
  
!     cursor = self.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GDataObjects.Schema(attrs={'id':rs[0], 'name':rs[0],
                           'type':'table',
                           'primarykey': self.__getPrimaryKey(rs[0])},
                           getChildSchema=self.__getFieldSchema))
--- 70,81 ----
      # TODO: This excludes any system tables and views. Should it?
      statement = "SHOW TABLES"
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GIntrospection.Schema(attrs={'id':rs[0], 'name':rs[0],
                           'type':'table',
                           'primarykey': self.__getPrimaryKey(rs[0])},
                           getChildSchema=self.__getFieldSchema))
***************
*** 88,99 ****
    def getSchemaByName(self, name, type=None):
      statement = "DESCRIBE %s" % (name)
  
!     cursor = self.native.cursor()
      cursor.execute(statement)
  
      rs = cursor.fetchone()
      if rs:
!       schema = GDataObjects.Schema(attrs={'id':name, 'name':name,
                             'type':'table',
                             'primarykey': self.__getPrimaryKey(name,cursor)},
                             getChildSchema=self.__getFieldSchema)
--- 88,99 ----
    def getSchemaByName(self, name, type=None):
      statement = "DESCRIBE %s" % (name)
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      rs = cursor.fetchone()
      if rs:
!       schema = GIntrospection.Schema(attrs={'id':name, 'name':name,
                             'type':'table',
                             'primarykey': self.__getPrimaryKey(name,cursor)},
                             getChildSchema=self.__getFieldSchema)
***************
*** 107,113 ****
    def __getPrimaryKey(self, id, cursor=None):
      statement = "DESCRIBE %s" % id
      if not cursor:
!       cursor = self.native.cursor()
        close_cursor = 1
      else:
        close_cursor = 0
--- 107,113 ----
    def __getPrimaryKey(self, id, cursor=None):
      statement = "DESCRIBE %s" % id
      if not cursor:
!       cursor = self._connection.native.cursor()
        close_cursor = 1
      else:
        close_cursor = 0
***************
*** 128,134 ****
  
      statement = "DESCRIBE %s" % parent.id
  
!     cursor = self.native.cursor()
      cursor.execute(statement)
  
      list = []
--- 128,134 ----
  
      statement = "DESCRIBE %s" % parent.id
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
***************
*** 171,177 ****
          attrs['defaulttype'] = 'serial'
  
  
!       list.append(GDataObjects.Schema(attrs=attrs))
  
      cursor.close()
      return list
--- 171,177 ----
          attrs['defaulttype'] = 'serial'
  
  
!       list.append(GIntrospection.Schema(attrs=attrs))
  
      cursor.close()
      return list
Index: gnue-common/src/datasources/drivers/oracle/Base/DataObject.py
diff -c gnue-common/src/datasources/drivers/oracle/Base/DataObject.py:1.1.2.1 
gnue-common/src/datasources/drivers/oracle/Base/DataObject.py:1.1.2.2
*** gnue-common/src/datasources/drivers/oracle/Base/DataObject.py:1.1.2.1       
Thu Oct  9 21:21:23 2003
--- gnue-common/src/datasources/drivers/oracle/Base/DataObject.py       Tue Nov 
18 22:00:24 2003
***************
*** 32,237 ****
  #     service=    This is the Oracle TNS name for your connection  (required)
  #
  
! import sys, string
! from gnue.common.datasources import GDataObjects, GConditions
! from gnue.common.apps import GDebug
  
- class Oracle_Schema:
- 
-   def __init__(self):
-     pass
- 
-   def _postConnect(self):
-     self.triggerExtensions = TriggerExtensions(self._dataConnection)
- 
-   #
-   # Schema (metadata) functions
-   #
- 
-   # Return a list of the types of Schema objects this driver provides
-   def getSchemaTypes(self):
-     return [ ('user_table',   _('User Tables'),1),
-              ('user_view',    _('User Views'),1),
-              ('user_synonym', _('User Synonyms'),1),
-              ('all_table',    _('System Tables'),1),
-              ('all_view',     _('System Views'),1),
-              ('all_synonym',  _('System Synonyms'),1) ]
- 
-   # Return a list of Schema objects
-   def getSchemaList(self, type=None):
- 
-     where_user = ""
-     if type == None:
-       where_type = ['TABLE', 'VIEW', 'SYNONYM']
-     else:
-       scope, type = string.split(type,'_')
-       where_type = [string.upper(type)]
-       if scope == 'user':
-         where_user = " AND OWNER = USER"
- 
- 
-     statement = \
-       "select owner||'.'||table_name||'.'||table_type full_name, \n" + \
-       "  decode(owner,user,null,owner||'.')||table_name table_name, \n" + \
-       "  decode(owner,user,'user_','all_')||lower(table_type) table_type \n" 
+ \
-       "  from all_catalog where table_type in ('%s') %s \n" \
-               % (string.join(where_type,"','"), where_user) + \
-       "  order by table_name "
- 
-     GDebug.printMesg(5,statement)
- 
-     cursor = self._dataConnection.cursor()
-     cursor.execute(statement)
- 
-     list = []
-     for rs in cursor.fetchall():
-       list.append(GDataObjects.Schema(attrs={'id':rs[0], 
'name':string.lower(rs[1]),
-                          'type':rs[2]},
-                          getChildSchema=self.__getFieldSchema))
- 
-     cursor.close()
-     return list
- 
- 
-   # Find a schema object with specified name
-   def getSchemaByName(self, name, type=None):
- 
-     spl = string.split(string.upper(name),'.')
-     where = "TABLE_NAME='%s'" % spl[-1]
-     if len(spl) > 1:
-       where += " AND OWNER='%s'" % spl[-2]
- 
-     statement = \
-       "select owner||'.'||table_name||'.'||table_type full_name, \n" + \
-       "  decode(owner,user,null,owner||'.')||table_name table_name, \n" + \
-       "  decode(owner,user,'user_','all_')||lower(table_type) table_type \n" 
+ \
-       "  from all_catalog where %s " \
-               % (where)
- 
-     GDebug.printMesg(5,statement)
- 
-     cursor = self._dataConnection.cursor()
-     cursor.execute(statement)
- 
-     list = []
-     rs = cursor.fetchone()
-     if rs:
-       rv = GDataObjects.Schema(attrs={'id':rs[0], 'name':string.lower(rs[1]),
-                          'type':rs[2]},
-                          getChildSchema=self.__getFieldSchema)
-     else:
-       rv = None
- 
-     cursor.close()
-     return rv
- 
- 
-   # Get fields for a table
-   def __getFieldSchema(self, parent):
- 
-     owner, name, type = string.split(parent.id,'.')
- 
-     cursor = self._dataConnection.cursor()
- 
-     if type == 'SYNONYM':
-       statement = "select table_owner, table_name, " + \
-                   "decode(db_link,null,'','@'||db_link) name " + \
-                   "from all_synonyms " + \
-                   "where owner = '%s' and synonym_name='%s'" % (owner, name)
- 
-       GDebug.printMesg(5,statement)
- 
-       cursor.execute(statement)
-       rs = cursor.fetchone()
-       owner, name, link = rs
-       if link is None:
-         link = ""
-     else:
-       link = ""
- 
-     statement = \
-        "select owner||'.'||table_name||'.'||column_name||'.%s', " % (link) + \
-        "column_name, data_type, nullable, data_length, data_scale, 
data_precision " + \
-        "from all_tab_columns%s " % (link) + \
-        "where owner = '%s' and table_name = '%s' " % (owner, name) + \
-        "order by column_id"
- 
-     GDebug.printMesg(5,statement)
- 
-     cursor.execute(statement)
- 
-     list = []
-     for rs in cursor.fetchall():
- 
-       attrs={'id': rs[0], 'name': string.lower(rs[1]),
-              'type':'field', 'nativetype': rs[2],
-              'required': rs[3] == 'N'}
- 
-       if rs[2] in ('NUMBER',):
-         attrs['precision'] = int(rs[5])
-         attrs['datatype'] = 'number'
-         attrs['length'] = int(rs[6])
-       elif rs[2] in ('DATE',):
-         attrs['datatype'] = 'date'
-       else:
-         attrs['datatype'] = 'text'
-         if int(rs[4]):
-           attrs['length'] = int(rs[4])
- 
-       list.append(GDataObjects.Schema(attrs=attrs))
- 
-     cursor.close()
-     return tuple(list)
- 
- 
- #
- #  Extensions to Trigger Namespaces
- #
- class TriggerExtensions:
- 
-   def __init__(self, connection):
-     self.__connection = connection
- 
-   # Return the current date, according to database
-   def getTimeStamp(self):
-     return self.__singleQuery("select sysdate from dual")
- 
-   # Return a sequence number from sequence 'name'
-   def getSequence(self, name):
-     return self.__singleQuery("select %s.nextval from dual" % name)
- 
-   # Run the SQL statement 'statement'
-   def sql(self, statement):
-     cursor = self.__connection.cursor()
-     try:
-       cursor.execute(statement)
-       cursor.close()
-     except:
-       cursor.close()
-       raise
-     try: 
-       return cursor.fetchall()
-     except: 
-       return None
- 
-   # Used internally
-   def __singleQuery(self, statement):
-     cursor = self.__connection.cursor()
-     try:
-       cursor.execute(statement)
-       rv = cursor.fetchone()
-       cursor.close()
-     except mesg:
-       GDebug.printMesg(1,"**** Unable to execute extension query")
-       GDebug.printMesg(1,"**** %s" % mesg)
-       cursor.close()
-       return None
- 
-     try:
-       return rv[0]
-     except:
-       return None
  
  
  
  
--- 32,48 ----
  #     service=    This is the Oracle TNS name for your connection  (required)
  #
  
! __all__ = ['DataObject_SQL','DataObject_Object']
  
  
+ from gnue.common.datasources.drivers import DBSIG2
  
+ class _Base:
+   _escapeSingleQuote = ''''
+   _dateTimeFormat = "'%Y-%m-%d %H:%M:%S'"
  
+ class DataObject_SQL(_Base, DBSIG2.DataObject_SQL):
+   pass
  
+ class DataObject_Object(_Base, DBSIG2.DataObject_Object):
+   pass
Index: gnue-common/src/datasources/drivers/oracle/Base/RecordSet.py
diff -c gnue-common/src/datasources/drivers/oracle/Base/RecordSet.py:1.1.2.1 
gnue-common/src/datasources/drivers/oracle/Base/RecordSet.py:1.1.2.2
*** gnue-common/src/datasources/drivers/oracle/Base/RecordSet.py:1.1.2.1        
Thu Oct  9 21:21:23 2003
--- gnue-common/src/datasources/drivers/oracle/Base/RecordSet.py        Tue Nov 
18 22:00:24 2003
***************
*** 36,237 ****
  from gnue.common.datasources import GDataObjects, GConditions
  from gnue.common.apps import GDebug
  
- class Oracle_Schema:
- 
-   def __init__(self):
-     pass
- 
-   def _postConnect(self):
-     self.triggerExtensions = TriggerExtensions(self._dataConnection)
- 
-   #
-   # Schema (metadata) functions
-   #
- 
-   # Return a list of the types of Schema objects this driver provides
-   def getSchemaTypes(self):
-     return [ ('user_table',   _('User Tables'),1),
-              ('user_view',    _('User Views'),1),
-              ('user_synonym', _('User Synonyms'),1),
-              ('all_table',    _('System Tables'),1),
-              ('all_view',     _('System Views'),1),
-              ('all_synonym',  _('System Synonyms'),1) ]
- 
-   # Return a list of Schema objects
-   def getSchemaList(self, type=None):
- 
-     where_user = ""
-     if type == None:
-       where_type = ['TABLE', 'VIEW', 'SYNONYM']
-     else:
-       scope, type = string.split(type,'_')
-       where_type = [string.upper(type)]
-       if scope == 'user':
-         where_user = " AND OWNER = USER"
- 
- 
-     statement = \
-       "select owner||'.'||table_name||'.'||table_type full_name, \n" + \
-       "  decode(owner,user,null,owner||'.')||table_name table_name, \n" + \
-       "  decode(owner,user,'user_','all_')||lower(table_type) table_type \n" 
+ \
-       "  from all_catalog where table_type in ('%s') %s \n" \
-               % (string.join(where_type,"','"), where_user) + \
-       "  order by table_name "
- 
-     GDebug.printMesg(5,statement)
- 
-     cursor = self._dataConnection.cursor()
-     cursor.execute(statement)
- 
-     list = []
-     for rs in cursor.fetchall():
-       list.append(GDataObjects.Schema(attrs={'id':rs[0], 
'name':string.lower(rs[1]),
-                          'type':rs[2]},
-                          getChildSchema=self.__getFieldSchema))
- 
-     cursor.close()
-     return list
- 
- 
-   # Find a schema object with specified name
-   def getSchemaByName(self, name, type=None):
- 
-     spl = string.split(string.upper(name),'.')
-     where = "TABLE_NAME='%s'" % spl[-1]
-     if len(spl) > 1:
-       where += " AND OWNER='%s'" % spl[-2]
- 
-     statement = \
-       "select owner||'.'||table_name||'.'||table_type full_name, \n" + \
-       "  decode(owner,user,null,owner||'.')||table_name table_name, \n" + \
-       "  decode(owner,user,'user_','all_')||lower(table_type) table_type \n" 
+ \
-       "  from all_catalog where %s " \
-               % (where)
- 
-     GDebug.printMesg(5,statement)
- 
-     cursor = self._dataConnection.cursor()
-     cursor.execute(statement)
- 
-     list = []
-     rs = cursor.fetchone()
-     if rs:
-       rv = GDataObjects.Schema(attrs={'id':rs[0], 'name':string.lower(rs[1]),
-                          'type':rs[2]},
-                          getChildSchema=self.__getFieldSchema)
-     else:
-       rv = None
- 
-     cursor.close()
-     return rv
- 
- 
-   # Get fields for a table
-   def __getFieldSchema(self, parent):
- 
-     owner, name, type = string.split(parent.id,'.')
- 
-     cursor = self._dataConnection.cursor()
- 
-     if type == 'SYNONYM':
-       statement = "select table_owner, table_name, " + \
-                   "decode(db_link,null,'','@'||db_link) name " + \
-                   "from all_synonyms " + \
-                   "where owner = '%s' and synonym_name='%s'" % (owner, name)
- 
-       GDebug.printMesg(5,statement)
- 
-       cursor.execute(statement)
-       rs = cursor.fetchone()
-       owner, name, link = rs
-       if link is None:
-         link = ""
-     else:
-       link = ""
- 
-     statement = \
-        "select owner||'.'||table_name||'.'||column_name||'.%s', " % (link) + \
-        "column_name, data_type, nullable, data_length, data_scale, 
data_precision " + \
-        "from all_tab_columns%s " % (link) + \
-        "where owner = '%s' and table_name = '%s' " % (owner, name) + \
-        "order by column_id"
- 
-     GDebug.printMesg(5,statement)
- 
-     cursor.execute(statement)
- 
-     list = []
-     for rs in cursor.fetchall():
- 
-       attrs={'id': rs[0], 'name': string.lower(rs[1]),
-              'type':'field', 'nativetype': rs[2],
-              'required': rs[3] == 'N'}
- 
-       if rs[2] in ('NUMBER',):
-         attrs['precision'] = int(rs[5])
-         attrs['datatype'] = 'number'
-         attrs['length'] = int(rs[6])
-       elif rs[2] in ('DATE',):
-         attrs['datatype'] = 'date'
-       else:
-         attrs['datatype'] = 'text'
-         if int(rs[4]):
-           attrs['length'] = int(rs[4])
- 
-       list.append(GDataObjects.Schema(attrs=attrs))
- 
-     cursor.close()
-     return tuple(list)
- 
- 
- #
- #  Extensions to Trigger Namespaces
- #
- class TriggerExtensions:
- 
-   def __init__(self, connection):
-     self.__connection = connection
- 
-   # Return the current date, according to database
-   def getTimeStamp(self):
-     return self.__singleQuery("select sysdate from dual")
- 
-   # Return a sequence number from sequence 'name'
-   def getSequence(self, name):
-     return self.__singleQuery("select %s.nextval from dual" % name)
- 
-   # Run the SQL statement 'statement'
-   def sql(self, statement):
-     cursor = self.__connection.cursor()
-     try:
-       cursor.execute(statement)
-       cursor.close()
-     except:
-       cursor.close()
-       raise
-     try: 
-       return cursor.fetchall()
-     except: 
-       return None
- 
-   # Used internally
-   def __singleQuery(self, statement):
-     cursor = self.__connection.cursor()
-     try:
-       cursor.execute(statement)
-       rv = cursor.fetchone()
-       cursor.close()
-     except mesg:
-       GDebug.printMesg(1,"**** Unable to execute extension query")
-       GDebug.printMesg(1,"**** %s" % mesg)
-       cursor.close()
-       return None
- 
-     try:
-       return rv[0]
-     except:
-       return None
- 
- 
- 
- 
--- 36,38 ----
Index: gnue-common/src/datasources/drivers/oracle/Base/ResultSet.py
diff -c gnue-common/src/datasources/drivers/oracle/Base/ResultSet.py:1.1.2.1 
gnue-common/src/datasources/drivers/oracle/Base/ResultSet.py:1.1.2.2
*** gnue-common/src/datasources/drivers/oracle/Base/ResultSet.py:1.1.2.1        
Thu Oct  9 21:21:23 2003
--- gnue-common/src/datasources/drivers/oracle/Base/ResultSet.py        Tue Nov 
18 22:00:24 2003
***************
*** 19,237 ****
  # Copyright 2000-2003 Free Software Foundation
  #
  # FILE:
! # cxoracle/DBdriver.py
  #
  # DESCRIPTION:
- # Driver to provide access to data via Computronix's Oracle/Python Driver
- # Requires cx_Oracle 2.2+ (http://www.computronix.com/utilities/)
  #
- # NOTES:
- #
- #   Supported attributes (via connections.conf or <database> tag)
- #
- #     service=    This is the Oracle TNS name for your connection  (required)
- #
- 
- import sys, string
- from gnue.common.datasources import GDataObjects, GConditions
- from gnue.common.apps import GDebug
- 
- class Oracle_Schema:
- 
-   def __init__(self):
-     pass
- 
-   def _postConnect(self):
-     self.triggerExtensions = TriggerExtensions(self._dataConnection)
- 
-   #
-   # Schema (metadata) functions
-   #
- 
-   # Return a list of the types of Schema objects this driver provides
-   def getSchemaTypes(self):
-     return [ ('user_table',   _('User Tables'),1),
-              ('user_view',    _('User Views'),1),
-              ('user_synonym', _('User Synonyms'),1),
-              ('all_table',    _('System Tables'),1),
-              ('all_view',     _('System Views'),1),
-              ('all_synonym',  _('System Synonyms'),1) ]
- 
-   # Return a list of Schema objects
-   def getSchemaList(self, type=None):
- 
-     where_user = ""
-     if type == None:
-       where_type = ['TABLE', 'VIEW', 'SYNONYM']
-     else:
-       scope, type = string.split(type,'_')
-       where_type = [string.upper(type)]
-       if scope == 'user':
-         where_user = " AND OWNER = USER"
- 
- 
-     statement = \
-       "select owner||'.'||table_name||'.'||table_type full_name, \n" + \
-       "  decode(owner,user,null,owner||'.')||table_name table_name, \n" + \
-       "  decode(owner,user,'user_','all_')||lower(table_type) table_type \n" 
+ \
-       "  from all_catalog where table_type in ('%s') %s \n" \
-               % (string.join(where_type,"','"), where_user) + \
-       "  order by table_name "
- 
-     GDebug.printMesg(5,statement)
- 
-     cursor = self._dataConnection.cursor()
-     cursor.execute(statement)
- 
-     list = []
-     for rs in cursor.fetchall():
-       list.append(GDataObjects.Schema(attrs={'id':rs[0], 
'name':string.lower(rs[1]),
-                          'type':rs[2]},
-                          getChildSchema=self.__getFieldSchema))
- 
-     cursor.close()
-     return list
- 
- 
-   # Find a schema object with specified name
-   def getSchemaByName(self, name, type=None):
- 
-     spl = string.split(string.upper(name),'.')
-     where = "TABLE_NAME='%s'" % spl[-1]
-     if len(spl) > 1:
-       where += " AND OWNER='%s'" % spl[-2]
- 
-     statement = \
-       "select owner||'.'||table_name||'.'||table_type full_name, \n" + \
-       "  decode(owner,user,null,owner||'.')||table_name table_name, \n" + \
-       "  decode(owner,user,'user_','all_')||lower(table_type) table_type \n" 
+ \
-       "  from all_catalog where %s " \
-               % (where)
- 
-     GDebug.printMesg(5,statement)
- 
-     cursor = self._dataConnection.cursor()
-     cursor.execute(statement)
- 
-     list = []
-     rs = cursor.fetchone()
-     if rs:
-       rv = GDataObjects.Schema(attrs={'id':rs[0], 'name':string.lower(rs[1]),
-                          'type':rs[2]},
-                          getChildSchema=self.__getFieldSchema)
-     else:
-       rv = None
- 
-     cursor.close()
-     return rv
- 
- 
-   # Get fields for a table
-   def __getFieldSchema(self, parent):
- 
-     owner, name, type = string.split(parent.id,'.')
- 
-     cursor = self._dataConnection.cursor()
- 
-     if type == 'SYNONYM':
-       statement = "select table_owner, table_name, " + \
-                   "decode(db_link,null,'','@'||db_link) name " + \
-                   "from all_synonyms " + \
-                   "where owner = '%s' and synonym_name='%s'" % (owner, name)
- 
-       GDebug.printMesg(5,statement)
- 
-       cursor.execute(statement)
-       rs = cursor.fetchone()
-       owner, name, link = rs
-       if link is None:
-         link = ""
-     else:
-       link = ""
- 
-     statement = \
-        "select owner||'.'||table_name||'.'||column_name||'.%s', " % (link) + \
-        "column_name, data_type, nullable, data_length, data_scale, 
data_precision " + \
-        "from all_tab_columns%s " % (link) + \
-        "where owner = '%s' and table_name = '%s' " % (owner, name) + \
-        "order by column_id"
- 
-     GDebug.printMesg(5,statement)
- 
-     cursor.execute(statement)
- 
-     list = []
-     for rs in cursor.fetchall():
- 
-       attrs={'id': rs[0], 'name': string.lower(rs[1]),
-              'type':'field', 'nativetype': rs[2],
-              'required': rs[3] == 'N'}
- 
-       if rs[2] in ('NUMBER',):
-         attrs['precision'] = int(rs[5])
-         attrs['datatype'] = 'number'
-         attrs['length'] = int(rs[6])
-       elif rs[2] in ('DATE',):
-         attrs['datatype'] = 'date'
-       else:
-         attrs['datatype'] = 'text'
-         if int(rs[4]):
-           attrs['length'] = int(rs[4])
- 
-       list.append(GDataObjects.Schema(attrs=attrs))
- 
-     cursor.close()
-     return tuple(list)
- 
- 
- #
- #  Extensions to Trigger Namespaces
- #
- class TriggerExtensions:
- 
-   def __init__(self, connection):
-     self.__connection = connection
- 
-   # Return the current date, according to database
-   def getTimeStamp(self):
-     return self.__singleQuery("select sysdate from dual")
- 
-   # Return a sequence number from sequence 'name'
-   def getSequence(self, name):
-     return self.__singleQuery("select %s.nextval from dual" % name)
- 
-   # Run the SQL statement 'statement'
-   def sql(self, statement):
-     cursor = self.__connection.cursor()
-     try:
-       cursor.execute(statement)
-       cursor.close()
-     except:
-       cursor.close()
-       raise
-     try: 
-       return cursor.fetchall()
-     except: 
-       return None
- 
-   # Used internally
-   def __singleQuery(self, statement):
-     cursor = self.__connection.cursor()
-     try:
-       cursor.execute(statement)
-       rv = cursor.fetchone()
-       cursor.close()
-     except mesg:
-       GDebug.printMesg(1,"**** Unable to execute extension query")
-       GDebug.printMesg(1,"**** %s" % mesg)
-       cursor.close()
-       return None
- 
-     try:
-       return rv[0]
-     except:
-       return None
  
  
  
  
--- 19,36 ----
  # Copyright 2000-2003 Free Software Foundation
  #
  # FILE:
! # oracle/DBdriver.py
  #
  # DESCRIPTION:
  #
  
+ __all__ = ['ResultSet']
  
+ from gnue.common.datasources.drivers import DBSIG2
+ from RecordSet import RecordSet
  
+ class ResultSet(DBSIG2.ResultSet):
+   _uniqueIdField = "__GNUeF__uniqueKey_%s" % (self._dataObject.table)
+   _uniqueIdFormat = "ROWID='%s'"
+   _recordSetClass = RecordSet
  
Index: 
gnue-common/src/datasources/drivers/oracle/Schema/Discovery/Introspection.py
diff -c 
gnue-common/src/datasources/drivers/oracle/Schema/Discovery/Introspection.py:1.1.2.1
 
gnue-common/src/datasources/drivers/oracle/Schema/Discovery/Introspection.py:1.1.2.2
*** 
gnue-common/src/datasources/drivers/oracle/Schema/Discovery/Introspection.py:1.1.2.1
        Thu Oct  9 21:21:24 2003
--- 
gnue-common/src/datasources/drivers/oracle/Schema/Discovery/Introspection.py    
    Tue Nov 18 22:00:24 2003
***************
*** 87,98 ****
  
      GDebug.printMesg(5,statement)
  
!     cursor = self.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GDataObjects.Schema(attrs={'id':rs[0], 
'name':string.lower(rs[1]),
                           'type':rs[2]},
                           getChildSchema=self.__getFieldSchema))
  
--- 87,98 ----
  
      GDebug.printMesg(5,statement)
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GIntrospection.Schema(attrs={'id':rs[0], 
'name':string.lower(rs[1]),
                           'type':rs[2]},
                           getChildSchema=self.__getFieldSchema))
  
***************
*** 117,129 ****
  
      GDebug.printMesg(5,statement)
  
!     cursor = self.native.cursor()
      cursor.execute(statement)
  
      list = []
      rs = cursor.fetchone()
      if rs:
!       rv = GDataObjects.Schema(attrs={'id':rs[0], 'name':string.lower(rs[1]),
                           'type':rs[2]},
                           getChildSchema=self.__getFieldSchema)
      else:
--- 117,129 ----
  
      GDebug.printMesg(5,statement)
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
      rs = cursor.fetchone()
      if rs:
!       rv = GIntrospection.Schema(attrs={'id':rs[0], 
'name':string.lower(rs[1]),
                           'type':rs[2]},
                           getChildSchema=self.__getFieldSchema)
      else:
***************
*** 138,144 ****
  
      owner, name, type = string.split(parent.id,'.')
  
!     cursor = self.native.cursor()
  
      if type == 'SYNONYM':
        statement = "select table_owner, table_name, " + \
--- 138,144 ----
  
      owner, name, type = string.split(parent.id,'.')
  
!     cursor = self._connection.native.cursor()
  
      if type == 'SYNONYM':
        statement = "select table_owner, table_name, " + \
***************
*** 185,191 ****
          if int(rs[4]):
            attrs['length'] = int(rs[4])
  
!       list.append(GDataObjects.Schema(attrs=attrs))
  
      cursor.close()
      return tuple(list)
--- 185,191 ----
          if int(rs[4]):
            attrs['length'] = int(rs[4])
  
!       list.append(GIntrospection.Schema(attrs=attrs))
  
      cursor.close()
      return tuple(list)
Index: gnue-common/src/datasources/drivers/oracle/dcoracle/Driver.py
diff -c gnue-common/src/datasources/drivers/oracle/dcoracle/Driver.py:1.24.2.1 
gnue-common/src/datasources/drivers/oracle/dcoracle/Driver.py:1.24.2.2
*** gnue-common/src/datasources/drivers/oracle/dcoracle/Driver.py:1.24.2.1      
Thu Oct  9 21:21:25 2003
--- gnue-common/src/datasources/drivers/oracle/dcoracle/Driver.py       Tue Nov 
18 22:00:24 2003
***************
*** 50,70 ****
  
  
  
- class Oracle_RecordSet(DBSIG2.RecordSet):
-   pass
- 
- 
  class Oracle_ResultSet(DBSIG2.ResultSet):
!   def __init__(self, dataObject, cursor=None, defaultValues={}, 
masterRecordSet=None):
!     DBSIG2.ResultSet.__init__(self, dataObject, \
!             cursor, defaultValues, masterRecordSet)
!     self._recordSetClass = Oracle_RecordSet
!     self._uniqueIdField = "__GNUeF__uniqueKey_%s" % (self._dataObject.table)
!     self._uniqueIdFormat = "ROWID='%s'"
  
  
  
! class Oracle_DataObject(Oracle_Schema, DBSIG2.DataObject):
    def __init__(self):
      Oracle_Schema.__init__(self)
      DBSIG2.DataObject.__init__(self)
--- 50,62 ----
  
  
  
  class Oracle_ResultSet(DBSIG2.ResultSet):
!   _uniqueIdField = "__GNUeF__uniqueKey_%s" % (self._dataObject.table)
!   _uniqueIdFormat = "ROWID='%s'"
  
  
  
! class Oracle_DataObject(DBSIG2.DataObject):
    def __init__(self):
      Oracle_Schema.__init__(self)
      DBSIG2.DataObject.__init__(self)
***************
*** 85,91 ****
      if connectData.has_key('datetimeformat'):
        self._dateTimeFormat = "'%s'" % connectData['datetimeformat']
  
-     self._postConnect()
  
  
  
--- 77,82 ----
Index: gnue-common/src/datasources/drivers/postgresql/Base/DataObject.py
diff -c 
gnue-common/src/datasources/drivers/postgresql/Base/DataObject.py:1.1.2.2 
gnue-common/src/datasources/drivers/postgresql/Base/DataObject.py:1.1.2.3
*** gnue-common/src/datasources/drivers/postgresql/Base/DataObject.py:1.1.2.2   
Tue Nov 18 21:07:08 2003
--- gnue-common/src/datasources/drivers/postgresql/Base/DataObject.py   Tue Nov 
18 22:00:24 2003
***************
*** 38,46 ****
    _dateTimeFormat = "'%Y-%m-%d %H:%M:%S'"
  
  class DataObject_SQL(_Base, DBSIG2.DataObject_SQL):
!   def __init__(self, *args, **parms):
!     DBSIG2.DataObject_SQL.__init__(self, *args, **parms)
! 
  class DataObject_Object(_Base, DBSIG2.DataObject_Object):
    pass
  
--- 38,45 ----
    _dateTimeFormat = "'%Y-%m-%d %H:%M:%S'"
  
  class DataObject_SQL(_Base, DBSIG2.DataObject_SQL):
!   pass
!   
  class DataObject_Object(_Base, DBSIG2.DataObject_Object):
    pass
  
Index: 
gnue-common/src/datasources/drivers/postgresql/Schema/Discovery/Introspection.py
diff -c 
gnue-common/src/datasources/drivers/postgresql/Schema/Discovery/Introspection.py:1.1.2.1
 
gnue-common/src/datasources/drivers/postgresql/Schema/Discovery/Introspection.py:1.1.2.2
*** 
gnue-common/src/datasources/drivers/postgresql/Schema/Discovery/Introspection.py:1.1.2.1
    Thu Oct  9 21:21:27 2003
--- 
gnue-common/src/datasources/drivers/postgresql/Schema/Discovery/Introspection.py
    Tue Nov 18 22:00:25 2003
***************
*** 77,88 ****
              "and relname not like 'pg_%' " + \
              "order by relname"
  
!     cursor = self._dataConnection.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GDataObjects.Schema(attrs={'id':rs[2], 'name':rs[0],
                           'type':rs[1] == 'v' and 'view' or 'table',
                           'primarykey': self.__getPrimaryKey(cursor, rs[2])},
                           getChildSchema=self.__getFieldSchema))
--- 77,88 ----
              "and relname not like 'pg_%' " + \
              "order by relname"
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GIntrospection.Schema(attrs={'id':rs[2], 'name':rs[0],
                           'type':rs[1] == 'v' and 'view' or 'table',
                           'primarykey': self.__getPrimaryKey(cursor, rs[2])},
                           getChildSchema=self.__getFieldSchema))
***************
*** 97,108 ****
      statement = "select relname, relkind, oid from pg_class " + \
              "where relname = '%s'" % (name)
  
!     cursor = self._dataConnection.cursor()
      cursor.execute(statement)
  
      rs = cursor.fetchone()
      if rs:
!       schema = GDataObjects.Schema(attrs={'id':rs[2], 'name':rs[0],
                             'type':rs[1] == 'v' and 'view' or 'table',
                             'primarykey': self.__getPrimaryKey(cursor, rs[2]) 
},
                             getChildSchema=self.__getFieldSchema)
--- 97,108 ----
      statement = "select relname, relkind, oid from pg_class " + \
              "where relname = '%s'" % (name)
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      rs = cursor.fetchone()
      if rs:
!       schema = GIntrospection.Schema(attrs={'id':rs[2], 'name':rs[0],
                             'type':rs[1] == 'v' and 'view' or 'table',
                             'primarykey': self.__getPrimaryKey(cursor, rs[2]) 
},
                             getChildSchema=self.__getFieldSchema)
***************
*** 113,119 ****
      return schema
  
    def __getPrimaryKey(self, cursor, oid):
!     cursor = self._dataConnection.cursor()
      cursor.execute("select indkey from pg_index where indrelid=%s" % oid)
      rs = cursor.fetchone()
      statement = "select attname from pg_attribute " \
--- 113,119 ----
      return schema
  
    def __getPrimaryKey(self, cursor, oid):
!     cursor = self._connection.native.cursor()
      cursor.execute("select indkey from pg_index where indrelid=%s" % oid)
      rs = cursor.fetchone()
      statement = "select attname from pg_attribute " \
***************
*** 139,145 ****
              "pg_type.oid = atttypid and attnum >= 0" + \
              "order by attnum"
  
!     cursor = self._dataConnection.cursor()
      cursor.execute(statement)
  
      list = []
--- 139,145 ----
              "pg_type.oid = atttypid and attnum >= 0" + \
              "order by attnum"
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
***************
*** 180,186 ****
              attrs['defaulttype'] = 'constant'
              attrs['defaultval'] = dflt
  
!       list.append(GDataObjects.Schema(attrs=attrs))
  
      cursor.close()
      return list
--- 180,186 ----
              attrs['defaulttype'] = 'constant'
              attrs['defaultval'] = dflt
  
!       list.append(GIntrospection.Schema(attrs=attrs))
  
      cursor.close()
      return list
Index: 
gnue-common/src/datasources/drivers/sapdb/Schema/Discovery/Introspection.py
diff -c 
gnue-common/src/datasources/drivers/sapdb/Schema/Discovery/Introspection.py:1.1.2.1
 
gnue-common/src/datasources/drivers/sapdb/Schema/Discovery/Introspection.py:1.1.2.2
*** 
gnue-common/src/datasources/drivers/sapdb/Schema/Discovery/Introspection.py:1.1.2.1
 Thu Oct  9 21:21:30 2003
--- gnue-common/src/datasources/drivers/sapdb/Schema/Discovery/Introspection.py 
Tue Nov 18 22:00:25 2003
***************
*** 83,94 ****
  
      GDebug.printMesg(5,statement)
  
!     cursor = self.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GDataObjects.Schema(attrs={'id':rs[0], 'name':rs[1],
                           'type':string.lower(rs[2])},
                           getChildSchema=self.__getFieldSchema))
  
--- 83,94 ----
  
      GDebug.printMesg(5,statement)
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GIntrospection.Schema(attrs={'id':rs[0], 'name':rs[1],
                           'type':string.lower(rs[2])},
                           getChildSchema=self.__getFieldSchema))
  
***************
*** 118,129 ****
  
      GDebug.printMesg(5,statement)
  
!     cursor = self.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GDataObjects.Schema(attrs={'id':string.lower(rs[0]), 
'name':rs[1],
                           'type':rs[2], 'sapdbId': (rs [3], rs [4])},
                           getChildSchema=self.__getFieldSchema))
  
--- 118,129 ----
  
      GDebug.printMesg(5,statement)
  
!     cursor = self._connection.native.cursor()
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
!       list.append(GIntrospection.Schema(attrs={'id':string.lower(rs[0]), 
'name':rs[1],
                           'type':rs[2], 'sapdbId': (rs [3], rs [4])},
                           getChildSchema=self.__getFieldSchema))
  
***************
*** 144,150 ****
  
      schema, name, type = string.split(parent.id,'.')
      owner, basename = parent.sapdbId
!     cursor = self.native.cursor()
  
  #    if type == 'synonym':
  #      statement = "select base_tabschema, base_tabname " + \
--- 144,150 ----
  
      schema, name, type = string.split(parent.id,'.')
      owner, basename = parent.sapdbId
!     cursor = self._connection.native.cursor()
  
  #    if type == 'synonym':
  #      statement = "select base_tabschema, base_tabname " + \
***************
*** 186,192 ****
        if rs[5] != 0:
          attrs['length'] = rs[4]
  
!       list.append(GDataObjects.Schema(attrs=attrs))
  
      cursor.close()
      return tuple(list)
--- 186,192 ----
        if rs[5] != 0:
          attrs['length'] = rs[4]
  
!       list.append(GIntrospection.Schema(attrs=attrs))
  
      cursor.close()
      return tuple(list)
Index: 
gnue-common/src/datasources/drivers/sqlite/Schema/Discovery/Introspection.py
diff -c 
gnue-common/src/datasources/drivers/sqlite/Schema/Discovery/Introspection.py:1.1.2.1
 
gnue-common/src/datasources/drivers/sqlite/Schema/Discovery/Introspection.py:1.1.2.2
*** 
gnue-common/src/datasources/drivers/sqlite/Schema/Discovery/Introspection.py:1.1.2.1
        Thu Oct  9 21:21:32 2003
--- 
gnue-common/src/datasources/drivers/sqlite/Schema/Discovery/Introspection.py    
    Tue Nov 18 22:00:25 2003
***************
*** 72,85 ****
                  "SELECT type,name,tbl_name,sql FROM temp_master "+\
                  where+" ORDER BY name;"
  
!     cursor = self.native.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
        if rs[0] in ('table','view'):
!         list.append(GDataObjects.Schema(attrs={'id':rs[1], 'name':rs[1], \
                                                 'type':rs[0],},
                                          getChildSchema=self.__getFieldSchema))
  
--- 72,85 ----
                  "SELECT type,name,tbl_name,sql FROM temp_master "+\
                  where+" ORDER BY name;"
  
!     cursor = self._connection.native.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
  
      list = []
      for rs in cursor.fetchall():
        if rs[0] in ('table','view'):
!         list.append(GIntrospection.Schema(attrs={'id':rs[1], 'name':rs[1], \
                                                 'type':rs[0],},
                                          getChildSchema=self.__getFieldSchema))
  
***************
*** 101,113 ****
                   "SELECT type,name,tbl_name,sql FROM temp_master "+\
                   "WHERE name='%s' "+where+" ORDER BY name;") % (name,name)
  
!     cursor = self.native.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
  
      rs = cursor.fetchone()
      if rs and rs[0] in ('table','view'):
!       schema = GDataObjects.Schema(attrs={'id':rs[1], 'name':rs[1], \
                                            'type':rs[0],},
                                     getChildSchema=self.__getFieldSchema)
      else:
--- 101,113 ----
                   "SELECT type,name,tbl_name,sql FROM temp_master "+\
                   "WHERE name='%s' "+where+" ORDER BY name;") % (name,name)
  
!     cursor = self._connection.native.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
  
      rs = cursor.fetchone()
      if rs and rs[0] in ('table','view'):
!       schema = GIntrospection.Schema(attrs={'id':rs[1], 'name':rs[1], \
                                            'type':rs[0],},
                                     getChildSchema=self.__getFieldSchema)
      else:
***************
*** 131,137 ****
                   "and name='%s' ORDER BY name;") % (parent.type,parent.id,\
                                                      parent.type,parent.id)
  
!     cursor = self.native.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
      columns = cursor.description
--- 131,137 ----
                   "and name='%s' ORDER BY name;") % (parent.type,parent.id,\
                                                      parent.type,parent.id)
  
!     cursor = self._connection.native.cursor()
      GDebug.printMesg(1,"** Executing: %s **" % statement)
      cursor.execute(statement)
      columns = cursor.description
***************
*** 184,190 ****
          else:
            attrs['datatype']='text'
  
!         list.append(GDataObjects.Schema(attrs=attrs))
  
      return list
  
--- 184,190 ----
          else:
            attrs['datatype']='text'
  
!         list.append(GIntrospection.Schema(attrs=attrs))
  
      return list
  




reply via email to

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