[CalendarServer-changes] [7143] CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 7 19:05:42 PST 2011
Revision: 7143
http://trac.macosforge.org/projects/calendarserver/changeset/7143
Author: glyph at apple.com
Date: 2011-03-07 19:05:41 -0800 (Mon, 07 Mar 2011)
Log Message:
-----------
only quote 'access' in oracle, since quoting in postgres causes reverse case folding
Modified Paths:
--------------
CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/syntax.py
CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/test/test_sqlsyntax.py
Modified: CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/syntax.py
===================================================================
--- CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/syntax.py 2011-03-08 03:05:30 UTC (rev 7142)
+++ CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/syntax.py 2011-03-08 03:05:41 UTC (rev 7143)
@@ -449,7 +449,7 @@
# XXX This, and 'model', could in principle conflict with column names.
# Maybe do something about that.
name = self.model.name
- if name.lower() in _KEYWORDS:
+ if metadata.dialect == ORACLE_DIALECT and name.lower() in _KEYWORDS:
name = '"%s"' % (name,)
for tableSyntax in allTables:
Modified: CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/test/test_sqlsyntax.py
===================================================================
--- CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/test/test_sqlsyntax.py 2011-03-08 03:05:30 UTC (rev 7142)
+++ CalendarServer/branches/users/glyph/oracle/twext/enterprise/dal/test/test_sqlsyntax.py 2011-03-08 03:05:41 UTC (rev 7143)
@@ -559,15 +559,26 @@
def test_quotingOnKeywordConflict(self):
"""
'access' is a keyword, so although our schema parser will leniently
- accept it, it must be quoted in any outgoing SQL.
+ accept it, it must be quoted in any outgoing SQL. (This is only done in
+ the Oracle dialect, because it isn't necessary in postgres, and
+ idiosyncratic case-folding rules make it challenging to do it in both.)
"""
self.assertEquals(
Insert({self.schema.LEVELS.ACCESS: 1,
- self.schema.LEVELS.USERNAME: "hi"}).toSQL(),
+ self.schema.LEVELS.USERNAME:
+ "hi"}).toSQL(FixedPlaceholder(ORACLE_DIALECT, "?")),
SQLFragment(
'insert into LEVELS ("ACCESS", USERNAME) values (?, ?)',
[1, "hi"])
)
+ self.assertEquals(
+ Insert({self.schema.LEVELS.ACCESS: 1,
+ self.schema.LEVELS.USERNAME:
+ "hi"}).toSQL(FixedPlaceholder(POSTGRES_DIALECT, "?")),
+ SQLFragment(
+ 'insert into LEVELS (ACCESS, USERNAME) values (?, ?)',
+ [1, "hi"])
+ )
def test_updateReturning(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110307/58bb2bf1/attachment-0001.html>
More information about the calendarserver-changes
mailing list