Author: shawkins
Date: 2011-11-04 08:11:35 -0400 (Fri, 04 Nov 2011)
New Revision: 3612
Modified:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/SQLConversionVisitor.java
trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties
Log:
TEIID-669 refining escaping
Modified:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/SQLConversionVisitor.java
===================================================================
---
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/SQLConversionVisitor.java 2011-11-04
03:46:49 UTC (rev 3611)
+++
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/SQLConversionVisitor.java 2011-11-04
12:11:35 UTC (rev 3612)
@@ -229,22 +229,22 @@
}
private List<Object> parseNativeQueryParts(String nativeQuery) {
- Pattern pattern = Pattern.compile("\\$(\\$\\$)*\\d+"); //$NON-NLS-1$
+ Pattern pattern = Pattern.compile("\\$+\\d+"); //$NON-NLS-1$
List<Object> parts = new LinkedList<Object>();
Matcher m = pattern.matcher(nativeQuery);
for (int i = 0; i < nativeQuery.length(); i++) {
if (!m.find(i)) {
- parts.add(nativeQuery.substring(i).replaceAll("\\$\\$", "\\$"));
//$NON-NLS-1$ //$NON-NLS-2$
+ parts.add(nativeQuery.substring(i));
break;
}
if (m.start() != i) {
- parts.add(nativeQuery.substring(i, m.start()).replaceAll("\\$\\$",
"\\$")); //$NON-NLS-1$ //$NON-NLS-2$
+ parts.add(nativeQuery.substring(i, m.start()));
}
String match = m.group();
int end = match.lastIndexOf('$');
if ((end&0x1) == 1) {
//escaped
- parts.add(match.replaceAll("\\$\\$", "\\$")); //$NON-NLS-1$
//$NON-NLS-2$
+ parts.add(match.substring((end+1)/2));
} else {
if (end != 0) {
parts.add(match.substring(0, end/2));
Modified:
trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties
===================================================================
---
trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties 2011-11-04
03:46:49 UTC (rev 3611)
+++
trunk/connectors/translator-jdbc/src/main/resources/org/teiid/translator/jdbc/i18n.properties 2011-11-04
12:11:35 UTC (rev 3612)
@@ -28,6 +28,6 @@
JDBCQueryExecution.Error_executing_query__1 = ''{0}'' error executing
statement(s): {1}
SQLConversionVisitor.invalid_parameter=Invalid parameter {0}. Must be between 1 and
{1}.
SQLConversionVisitor.not_in_parameter=Invalid parameter {0}. Native query procedures
cannot use non IN parameters.
-
+OraleExecutionFactory.invalid_hint=Not using oracle execution payload {0} as hint, since
it apprears to contain more than just a single comment.
ConnectionListener.failed_to_report_jdbc_connection_details=Failed to report the JDBC
driver and connection information
JDBCMetadataProcessor.not_unique=Teiid runtime names, which are case insensitive, for the
imported metadata are not unique. If not already set, use the setting
importer.useFullSchemaName to create Teiid names that include the source schema.
\ No newline at end of file