Update of /cvsroot/webware/Webware/MiddleKit/Design
In directory sc8-pr-cvs1:/tmp/cvs-serv9063
Modified Files:
MSSQLSQLGenerator.py MySQLSQLGenerator.py
PostgreSQLSQLGenerator.py SQLGenerator.py
Log Message:
Fixed bug introduced by PostgreSQL patch. PostgreSQL uses '\d' for listing
database tables, but MySQL doesn't understand this (and neither, I suspect
does MSSQL).
Fixed by creating a new method listTablesSQL() which returns
'' by default but which each database can override to provide the appropriate
command.
Index: MSSQLSQLGenerator.py
===================================================================
RCS file: /cvsroot/webware/Webware/MiddleKit/Design/MSSQLSQLGenerator.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** MSSQLSQLGenerator.py 15 Jan 2003 00:02:31 -0000 1.11
--- MSSQLSQLGenerator.py 7 Mar 2003 17:38:34 -0000 1.12
***************
*** 143,153 ****
# wr('go\n\n')
- def didWriteCreateSQL(self, generator, out):
- sql = generator.setting('PostSQL', None)
- if sql:
- out.write('/* PostSQL start */\n' + sql + '\n/* PostSQL end */\n\n')
- # out.write('sp_tables\n\n') # not real effective
- out.write('/* end of generated SQL */\n')
-
--- 143,146 ----
Index: MySQLSQLGenerator.py
===================================================================
RCS file: /cvsroot/webware/Webware/MiddleKit/Design/MySQLSQLGenerator.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** MySQLSQLGenerator.py 26 Jan 2002 02:13:29 -0000 1.9
--- MySQLSQLGenerator.py 7 Mar 2003 17:38:36 -0000 1.10
***************
*** 32,35 ****
--- 32,38 ----
return 'use %s;\n\n' % dbName
+ def listTablesSQL(self):
+ return 'show tables\n\n'
+
class Klass:
Index: PostgreSQLSQLGenerator.py
===================================================================
RCS file: /cvsroot/webware/Webware/MiddleKit/Design/PostgreSQLSQLGenerator.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PostgreSQLSQLGenerator.py 6 Mar 2003 18:06:32 -0000 1.1
--- PostgreSQLSQLGenerator.py 7 Mar 2003 17:38:37 -0000 1.2
***************
*** 33,36 ****
--- 33,39 ----
return '\c "%s"\n\n' % dbName
+ def listTablesSQL(self):
+ return '\d\n\n'
+
class Klass:
Index: SQLGenerator.py
===================================================================
RCS file: /cvsroot/webware/Webware/MiddleKit/Design/SQLGenerator.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** SQLGenerator.py 6 Mar 2003 18:06:32 -0000 1.31
--- SQLGenerator.py 7 Mar 2003 17:38:38 -0000 1.32
***************
*** 331,339 ****
wr('\n')
def didWriteCreateSQL(self, generator, out):
sql = generator.setting('PostSQL', None)
if sql:
out.write('/* PostSQL start */\n' + sql + '\n/* PostSQL end */\n\n')
! out.write('\d\n\n')
out.write('/* end of generated SQL */\n')
--- 331,345 ----
wr('\n')
+
+ def listTablesSQL(self):
+ # return a SQL command to list all tables in the database
+ # this is database-specific, so by default we return nothing
+ return ''
+
def didWriteCreateSQL(self, generator, out):
sql = generator.setting('PostSQL', None)
if sql:
out.write('/* PostSQL start */\n' + sql + '\n/* PostSQL end */\n\n')
! out.write(self.listTablesSQL())
out.write('/* end of generated SQL */\n')
|