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 |
|
|
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 |
|
|
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: |
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 |
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 |