Removed use of locals for print formatting in Oracle backend.

This commit is contained in:
Curtis Maloney 2016-01-11 09:06:33 +11:00 committed by Tim Graham
parent c8d970a548
commit 3792e291e6
1 changed files with 8 additions and 6 deletions

View File

@ -44,10 +44,12 @@ END;
def autoinc_sql(self, table, column): def autoinc_sql(self, table, column):
# To simulate auto-incrementing primary keys in Oracle, we have to # To simulate auto-incrementing primary keys in Oracle, we have to
# create a sequence and a trigger. # create a sequence and a trigger.
sq_name = self._get_sequence_name(table) args = {
tr_name = self._get_trigger_name(table) 'sq_name': self._get_sequence_name(table),
tbl_name = self.quote_name(table) 'tr_name': self._get_trigger_name(table),
col_name = self.quote_name(column) 'tbl_name': self.quote_name(table),
'col_name': self.quote_name(column),
}
sequence_sql = """ sequence_sql = """
DECLARE DECLARE
i INTEGER; i INTEGER;
@ -58,7 +60,7 @@ BEGIN
EXECUTE IMMEDIATE 'CREATE SEQUENCE "%(sq_name)s"'; EXECUTE IMMEDIATE 'CREATE SEQUENCE "%(sq_name)s"';
END IF; END IF;
END; END;
/""" % locals() /""" % args
trigger_sql = """ trigger_sql = """
CREATE OR REPLACE TRIGGER "%(tr_name)s" CREATE OR REPLACE TRIGGER "%(tr_name)s"
BEFORE INSERT ON %(tbl_name)s BEFORE INSERT ON %(tbl_name)s
@ -68,7 +70,7 @@ WHEN (new.%(col_name)s IS NULL)
SELECT "%(sq_name)s".nextval SELECT "%(sq_name)s".nextval
INTO :new.%(col_name)s FROM dual; INTO :new.%(col_name)s FROM dual;
END; END;
/""" % locals() /""" % args
return sequence_sql, trigger_sql return sequence_sql, trigger_sql
def cache_key_culling_sql(self): def cache_key_culling_sql(self):