This commit is contained in:
yumoqing 2025-10-19 18:06:00 +08:00
parent 85f3980582
commit f6eb868e77

View File

@ -76,7 +76,7 @@ class MySqlor(SQLor):
limit $[from_line]$,$[rows]$""" limit $[from_line]$,$[rows]$"""
def tablesSQL(self): def tablesSQL(self):
sqlcmd = """SELECT lower(TABLE_NAME) as name, lower(TABLE_COMMENT) as title FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '%s'""" % self.dbdesc.get('dbname','unknown') sqlcmd = """SELECT lower(TABLE_NAME) as name, lower(TABLE_COMMENT) as title FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '%s'""" % self.dbname
return sqlcmd return sqlcmd
def fieldsSQL(self,tablename=None): def fieldsSQL(self,tablename=None):
@ -91,7 +91,7 @@ limit $[from_line]$,$[rows]$"""
lower(is_nullable) as nullable, lower(is_nullable) as nullable,
column_comment as title, column_comment as title,
lower(table_name) as table_name lower(table_name) as table_name
from information_schema.columns where lower(TABLE_SCHEMA) = '%s' """ % self.dbdesc.get('dbname','unknown').lower() from information_schema.columns where lower(TABLE_SCHEMA) = '%s' """ % self.dbname
if tablename is not None: if tablename is not None:
sqlcmd = sqlcmd + """and lower(table_name)='%s';""" % tablename.lower() sqlcmd = sqlcmd + """and lower(table_name)='%s';""" % tablename.lower()
return sqlcmd return sqlcmd
@ -115,7 +115,7 @@ limit $[from_line]$,$[rows]$"""
AND R.REFERENCED_TABLE_NAME = C.REFERENCED_TABLE_NAME AND R.REFERENCED_TABLE_NAME = C.REFERENCED_TABLE_NAME
WHERE C.REFERENCED_TABLE_NAME IS NOT NULL ; WHERE C.REFERENCED_TABLE_NAME IS NOT NULL ;
and C.TABLE_SCHEMA = '%s' and C.TABLE_SCHEMA = '%s'
""" % self.dbdesc.get('dbname','unknown').lower() """ % self.dbname
if tablename is not None: if tablename is not None:
sqlcmd = sqlcmd + " and C.REFERENCED_TABLE_NAME = '%s'" % tablename.lower() sqlcmd = sqlcmd + " and C.REFERENCED_TABLE_NAME = '%s'" % tablename.lower()
return sqlcmd return sqlcmd
@ -136,7 +136,7 @@ limit $[from_line]$,$[rows]$"""
FROM FROM
information_schema.statistics information_schema.statistics
WHERE WHERE
table_schema = '%s'""" % self.dbdesc.get('dbname','unknown') table_schema = '%s'""" % self.dbname
if tablename is not None: if tablename is not None:
sqlcmd = sqlcmd + """ AND table_name = '%s'""" % tablename.lower() sqlcmd = sqlcmd + """ AND table_name = '%s'""" % tablename.lower()
return sqlcmd return sqlcmd