From 36b55cf209618a95b217a78c578b9cecdf9db792 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 14 Aug 2012 22:28:42 +0200 Subject: [PATCH] Proper fix for an Issue #145 --- lib/core/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core/common.py b/lib/core/common.py index cc0dc3c75..34654df9c 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -2732,6 +2732,7 @@ def normalizeUnicode(value): def safeSQLIdentificatorNaming(name, isTable=False): """ Returns a safe representation of SQL identificator name (internal data format) + Reference: http://stackoverflow.com/questions/954884/what-special-characters-are-allowed-in-t-sql-column-retVal """ retVal = name @@ -2743,7 +2744,7 @@ def safeSQLIdentificatorNaming(name, isTable=False): if _: retVal = re.sub(r"(?i)\A%s\." % DEFAULT_MSSQL_SCHEMA, "", retVal) - if not re.match(r"\A[A-Za-z0-9_@.\$]+\Z", retVal): # Reference: http://stackoverflow.com/questions/954884/what-special-characters-are-allowed-in-t-sql-column-retVal + if not re.match(r"\A[A-Za-z0-9_@%s\$]+\Z" % ("." if _ else ""), retVal): # MsSQL is the only DBMS where we automatically prepend schema to table name (dot is normal) if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.ACCESS): retVal = "`%s`" % retVal.strip("`") elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.PGSQL, DBMS.DB2):