/[gnue]/gnue-common/src/datasources/drivers/gadfly/Schema/Discovery/Introspection.py
ViewVC logotype

Diff of /gnue-common/src/datasources/drivers/gadfly/Schema/Discovery/Introspection.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.1 by jcater, Fri Oct 10 01:21:15 2003 UTC revision 1.1.2.2 by jcater, Wed Nov 19 03:00:24 2003 UTC
# Line 67  class Introspection(GIntrospection.Intro Line 67  class Introspection(GIntrospection.Intro
67    
68      statement = "select * from __table_names__"      statement = "select * from __table_names__"
69    
70      cursor = self.cursor()      cursor = self._connection.native.cursor()
71      GDebug.printMesg(1,"** Executing: %s **" % statement)      GDebug.printMesg(1,"** Executing: %s **" % statement)
72      cursor.execute(statement)      cursor.execute(statement)
73    
# Line 75  class Introspection(GIntrospection.Intro Line 75  class Introspection(GIntrospection.Intro
75      for rs in cursor.fetchall():      for rs in cursor.fetchall():
76        # exclude any system tables and views. f.e. __table_names__        # exclude any system tables and views. f.e. __table_names__
77        if rs[1][:2]!="__":        if rs[1][:2]!="__":
78          list.append(GDataObjects.Schema(attrs={'id':rs[1], 'name':rs[1], \          list.append(GIntrospection.Schema(attrs={'id':rs[1], 'name':rs[1], \
79                                  'type':rs[0] == 1 and 'view' or 'table',},                                  'type':rs[0] == 1 and 'view' or 'table',},
80                                         getChildSchema=self.__getFieldSchema))                                         getChildSchema=self.__getFieldSchema))
81    
# Line 87  class Introspection(GIntrospection.Intro Line 87  class Introspection(GIntrospection.Intro
87    def getSchemaByName(self, name, type=None):    def getSchemaByName(self, name, type=None):
88      statement = "SELECT * from __table_names__ WHERE TABLE_NAME='%s'" % (name)      statement = "SELECT * from __table_names__ WHERE TABLE_NAME='%s'" % (name)
89    
90      cursor = self.cursor()      cursor = self._connection.native.cursor()
91      GDebug.printMesg(1,"** Executing: %s **" % statement)      GDebug.printMesg(1,"** Executing: %s **" % statement)
92      cursor.execute(statement)      cursor.execute(statement)
93    
94      rs = cursor.fetchone()      rs = cursor.fetchone()
95      if rs:      if rs:
96        schema = GDataObjects.Schema(attrs={'id':rs[1], 'name':rs[1], \        schema = GIntrospection.Schema(attrs={'id':rs[1], 'name':rs[1], \
97                                  'type':rs[0] == 1 and 'view' or 'table',},                                  'type':rs[0] == 1 and 'view' or 'table',},
98                                         getChildSchema=self.__getFieldSchema)                                         getChildSchema=self.__getFieldSchema)
99      else:      else:
# Line 111  class Introspection(GIntrospection.Intro Line 111  class Introspection(GIntrospection.Intro
111            
112      statement = "SELECT * FROM __COLUMNS__ WHERE TABLE_NAME='%s'" % parent.id      statement = "SELECT * FROM __COLUMNS__ WHERE TABLE_NAME='%s'" % parent.id
113    
114      cursor = self.cursor()      cursor = self._connection.native.cursor()
115      GDebug.printMesg(1,"** Executing: %s **" % statement)      GDebug.printMesg(1,"** Executing: %s **" % statement)
116      cursor.execute(statement)      cursor.execute(statement)
117      columns = cursor.description      columns = cursor.description
# Line 145  class Introspection(GIntrospection.Intro Line 145  class Introspection(GIntrospection.Intro
145        #except ValueError:        #except ValueError:
146        #  GDebug.printMesg(1,'WARNING: mysql native type error: %s' % nativetype)        #  GDebug.printMesg(1,'WARNING: mysql native type error: %s' % nativetype)
147    
148        list.append(GDataObjects.Schema(attrs=attrs))        list.append(GIntrospection.Schema(attrs=attrs))
149    
150      cursor.close()      cursor.close()
151      return list      return list

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26