From 0c7250a4740b26875d94fc9a1cb714fc970ea700 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 31 Aug 2006 18:58:22 +0000 Subject: - added case_sensitive argument to MetaData, Table, Column, determines itself automatically based on if a parent schemaitem has a non-None setting for the flag, or if not, then whether the identifier name is all lower case or not. when set to True, quoting is applied to identifiers with mixed or uppercase identifiers. quoting is also applied automatically in all cases to identifiers that are known to be reserved words or contain other non-standard characters. various database dialects can override all of this behavior, but currently they are all using the default behavior. tested with postgres, mysql, sqlite. needs more testing with firebird, oracle, ms-sql. part of the ongoing work with [ticket:155] --- test/sql/quote.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'test/sql/quote.py') diff --git a/test/sql/quote.py b/test/sql/quote.py index af279ffdb..02a501003 100644 --- a/test/sql/quote.py +++ b/test/sql/quote.py @@ -12,14 +12,12 @@ class QuoteTest(PersistTest): table1 = Table('WorstCase1', metadata, Column('lowercase', Integer, primary_key=True), Column('UPPERCASE', Integer), - Column('MixedCase', Integer, quote=True), - Column('ASC', Integer, quote=True), - quote=True) + Column('MixedCase', Integer), + Column('ASC', Integer)) table2 = Table('WorstCase2', metadata, - Column('desc', Integer, quote=True, primary_key=True), - Column('Union', Integer, quote=True), - Column('MixedCase', Integer, quote=True), - quote=True) + Column('desc', Integer, primary_key=True), + Column('Union', Integer), + Column('MixedCase', Integer)) table1.create() table2.create() @@ -67,6 +65,19 @@ class QuoteTest(PersistTest): res2 = select([table2.c.desc, table2.c.Union, table2.c.MixedCase], use_labels=True).execute().fetchall() print res2 assert(res2==[(1,2,3),(2,2,3),(4,3,2)]) + + def testcascade(self): + lcmetadata = MetaData(case_sensitive=False) + t1 = Table('SomeTable', lcmetadata, + Column('UcCol', Integer), + Column('normalcol', String)) + t2 = Table('othertable', lcmetadata, + Column('UcCol', Integer), + Column('normalcol', String, ForeignKey('SomeTable.normalcol'))) + assert lcmetadata.case_sensitive is False + assert t1.c.UcCol.case_sensitive is False + assert t2.c.normalcol.case_sensitive is False + if __name__ == "__main__": testbase.main() -- cgit v1.2.1