[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5483 - trunk/gnue-common/src/schema/scripter/processors
From: |
reinhard |
Subject: |
r5483 - trunk/gnue-common/src/schema/scripter/processors |
Date: |
Tue, 23 Mar 2004 13:42:33 -0600 (CST) |
Author: reinhard
Date: 2004-03-23 13:42:31 -0600 (Tue, 23 Mar 2004)
New Revision: 5483
Modified:
trunk/gnue-common/src/schema/scripter/processors/SQL.py
trunk/gnue-common/src/schema/scripter/processors/mysql.py
trunk/gnue-common/src/schema/scripter/processors/oracle.py
trunk/gnue-common/src/schema/scripter/processors/postgresql.py
Log:
Respect different escaping rules for different databases.
Modified: trunk/gnue-common/src/schema/scripter/processors/SQL.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/processors/SQL.py 2004-03-23
19:11:47 UTC (rev 5482)
+++ trunk/gnue-common/src/schema/scripter/processors/SQL.py 2004-03-23
19:42:31 UTC (rev 5483)
@@ -37,7 +37,8 @@
END_COMMAND = ";" # Symbol used to terminate a command
END_BATCH = "" # Symbol used to terminate a command-sequence
- QUOTECHAR = "'"
+ QUOTECHAR = "'" # Character used to quote a string
+ ESCAPECHAR = "'" # Character used to escape a quote character
# ---------------------------------------------------------------------------
@@ -277,7 +278,10 @@
"""
Usually we escape the quote-character by a preceeding backslash.
"""
- res = aString.replace (self.QUOTECHAR, "\\%s" % self.QUOTECHAR)
+ res = aString
+ if self.QUOTECHAR != self.ESCAPECHAR:
+ res = res.replace (self.ESCAPECHAR, self.ESCAPECHAR * 2)
+ res = res.replace (self.QUOTECHAR, self.ESCAPECHAR + self.QUOTECHAR)
return res
Modified: trunk/gnue-common/src/schema/scripter/processors/mysql.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/processors/mysql.py 2004-03-23
19:11:47 UTC (rev 5482)
+++ trunk/gnue-common/src/schema/scripter/processors/mysql.py 2004-03-23
19:42:31 UTC (rev 5483)
@@ -34,6 +34,7 @@
class Processor (SQLProcessor):
MAX_NAME_LENGTH = 64
+ ESCAPECHAR = '\\'
# ---------------------------------------------------------------------------
Modified: trunk/gnue-common/src/schema/scripter/processors/oracle.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/processors/oracle.py 2004-03-23
19:11:47 UTC (rev 5482)
+++ trunk/gnue-common/src/schema/scripter/processors/oracle.py 2004-03-23
19:42:31 UTC (rev 5483)
@@ -35,6 +35,7 @@
COMMENT_BEGIN = "REM ** "
MAX_NAME_LENGTH = 31
_PK_PRECISION = 10
+ ESCAPECHAR = '\\'
# ---------------------------------------------------------------------------
# add a GSField instance to the table definition
Modified: trunk/gnue-common/src/schema/scripter/processors/postgresql.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/processors/postgresql.py
2004-03-23 19:11:47 UTC (rev 5482)
+++ trunk/gnue-common/src/schema/scripter/processors/postgresql.py
2004-03-23 19:42:31 UTC (rev 5483)
@@ -35,6 +35,7 @@
MAX_NAME_LENGTH = 31
+ ESCAPECHAR = '\\'
# ---------------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5483 - trunk/gnue-common/src/schema/scripter/processors,
reinhard <=