summaryrefslogtreecommitdiff
path: root/db.py
diff options
context:
space:
mode:
authorSylvain <syt@logilab.fr>2006-05-16 14:13:43 +0200
committerSylvain <syt@logilab.fr>2006-05-16 14:13:43 +0200
commit3a6834c9a5bc77d3d85a77d078e6973f7c6ce3a9 (patch)
treeb94f876ef34889ee11d5651cae6938290ffb799d /db.py
parent4763b396f7f68988087b5e27f308d3856b9f8885 (diff)
downloadlogilab-common-3a6834c9a5bc77d3d85a77d078e6973f7c6ce3a9.tar.gz
added .sql_temporary_table method to advanced func helpers
Diffstat (limited to 'db.py')
-rw-r--r--db.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/db.py b/db.py
index dad8ed9..0e3dece 100644
--- a/db.py
+++ b/db.py
@@ -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