Author: brmeyer
Date: 2013-01-22 21:05:29 -0500 (Tue, 22 Jan 2013)
New Revision: 21102
Added:
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/testsuite/src/main/
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/testsuite/src/main/java/
Modified:
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/core/src/main/java/org/hibernate/engine/query/ParameterParser.java
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/parent/pom.xml
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
Log:
JBPAPP-10579 EAP 5.1.2 Support patch for HHH-2697 - Can't use := for variable
assignment within a SQL-Statement
Modified:
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/core/src/main/java/org/hibernate/engine/query/ParameterParser.java
===================================================================
---
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/core/src/main/java/org/hibernate/engine/query/ParameterParser.java 2013-01-23
01:18:27 UTC (rev 21101)
+++
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/core/src/main/java/org/hibernate/engine/query/ParameterParser.java 2013-01-23
02:05:29 UTC (rev 21102)
@@ -82,6 +82,10 @@
inQuote = true;
recognizer.other( c );
}
+ else if ( '\\' == c ) {
+ // skip sending the backslash and instead send then next character, treating is as a
literal
+ recognizer.other( sqlString.charAt( ++indx ) );
+ }
else {
if ( c == ':' ) {
// named parameter
Modified: core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/parent/pom.xml
===================================================================
--- core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/parent/pom.xml 2013-01-23 01:18:27
UTC (rev 21101)
+++ core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/parent/pom.xml 2013-01-23 02:05:29
UTC (rev 21102)
@@ -235,6 +235,75 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
+ <!--This plugin's configuration is used to store Eclipse m2e
settings only. It has no influence on the Maven build itself.-->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.jboss.maven.plugins
+ </groupId>
+ <artifactId>
+ maven-test-ext-plugin
+ </artifactId>
+ <versionRange>
+ [1.1.0,)
+ </versionRange>
+ <goals>
+ <goal>extend</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.jboss.maven.plugins
+ </groupId>
+ <artifactId>
+ maven-injection-plugin
+ </artifactId>
+ <versionRange>
+ [1.0.2,)
+ </versionRange>
+ <goals>
+ <goal>bytecode</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ org.codehaus.mojo
+ </groupId>
+ <artifactId>
+ antlr-maven-plugin
+ </artifactId>
+ <versionRange>
+ [2.1,)
+ </versionRange>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
</build>
Modified:
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
===================================================================
---
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2013-01-23
01:18:27 UTC (rev 21101)
+++
core/patches/hibernate-3.3.2.GA_CP04_JBPAPP-10579/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2013-01-23
02:05:29 UTC (rev 21102)
@@ -13,10 +13,13 @@
import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.Query;
+import org.hibernate.QueryException;
+import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.MySQL5Dialect;
import org.hibernate.junit.functional.FunctionalTestCase;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
import org.hibernate.test.sql.hand.Dimension;
@@ -678,4 +681,18 @@
return result;
}
}
+
+ public void testEscapeColonInSQL() throws QueryException {
+ if ( ! ( getDialect() instanceof MySQL5Dialect ) ) {
+ return;
+ }
+
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ SQLQuery query = s.createSQLQuery("SELECT @row \\:= 1");
+ List list = query.list();
+ assertTrue(list.get(0).toString().equals("1"));
+ t.commit();
+ s.close();
+ }
}
Show replies by date