diff options
author | Sylvain <syt@logilab.fr> | 2006-05-16 14:13:43 +0200 |
---|---|---|
committer | Sylvain <syt@logilab.fr> | 2006-05-16 14:13:43 +0200 |
commit | 3a6834c9a5bc77d3d85a77d078e6973f7c6ce3a9 (patch) | |
tree | b94f876ef34889ee11d5651cae6938290ffb799d /db.py | |
parent | 4763b396f7f68988087b5e27f308d3856b9f8885 (diff) | |
download | logilab-common-3a6834c9a5bc77d3d85a77d078e6973f7c6ce3a9.tar.gz |
added .sql_temporary_table method to advanced func helpers
Diffstat (limited to 'db.py')
-rw-r--r-- | db.py | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -375,6 +375,10 @@ INSERT INTO %s VALUES (0);''' % (seq_name, seq_name) return ('UPDATE %s SET last=last+1;' % seq_name, 'SELECT last FROM %s;' % seq_name) + def sql_temporary_table(self, table_name, table_schema): + return "CREATE TEMPORARY TABLE %s (%s);" % (table_name, + table_schema) + def increment_sequence(self, cursor, seq_name): for sql in self.sqls_increment_sequence(seq_name): cursor.execute(sql) @@ -397,7 +401,11 @@ class _PGAdvFuncHelper(_GenericAdvFuncHelper): def sqls_increment_sequence(self, seq_name): return ("SELECT nextval('%s');" % seq_name,) - + + def sql_temporary_table(self, table_name, table_schema): + return "CREATE TEMPORARY TABLE %s (%s) ON COMMIT DROP;" % (table_name, + table_schema) + class _SqliteAdvFuncHelper(_GenericAdvFuncHelper): """Generic helper, trying to provide generic way to implement |