List:Internals« Previous MessageNext Message »
From:mmatthews Date:July 7 2005 9:26pm
Subject:Connector/J commit: r3911 - in branches/branch_3_1/connector-j: . src/com/mysql/jdbc src/testsuite/regression
View as plain text  
Added:
  
branches/branch_3_1/connector-j/src/testsuite/regression/EscapeProcessorRegressionTest.java
Modified:
   branches/branch_3_1/connector-j/CHANGES
   branches/branch_3_1/connector-j/src/com/mysql/jdbc/EscapeTokenizer.java
Log:
Fixed BUG#11797 - Escape tokenizer doesn't respect stacked single quotes
	  for escapes.

Modified: branches/branch_3_1/connector-j/CHANGES
===================================================================
--- branches/branch_3_1/connector-j/CHANGES	2005-07-07 16:04:00 UTC (rev 3910)
+++ branches/branch_3_1/connector-j/CHANGES	2005-07-07 19:26:08 UTC (rev 3911)
@@ -17,6 +17,9 @@
       integers where within the range of the positive signed type.
     
     - Moved source code to svn repo.
+    
+    - Fixed BUG#11797 - Escape tokenizer doesn't respect stacked single quotes
+	  for escapes.
       
 06-23-05 - Version 3.1.10-stable
 

Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/EscapeTokenizer.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/EscapeTokenizer.java	2005-07-07
16:04:00 UTC (rev 3910)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/EscapeTokenizer.java	2005-07-07
19:26:08 UTC (rev 3911)
@@ -105,6 +105,17 @@
 			}
 
 			if (c == '\'') {
+				if (this.inQuotes) {
+					if (this.pos + 1 < this.sourceLength) {
+						if (this.source.charAt(this.pos + 1) == '\'') {
+							// Doubled-up single quote escape
+							tokenBuf.append('\'');
+							tokenBuf.append('\'');
+							this.pos++;
+							continue;
+						}
+					}
+				}
 				if (this.lastChar != '\\') {
 					if (this.inQuotes) {
 						if (this.quoteChar == c) {

Added:
branches/branch_3_1/connector-j/src/testsuite/regression/EscapeProcessorRegressionTest.java
===================================================================
---
branches/branch_3_1/connector-j/src/testsuite/regression/EscapeProcessorRegressionTest.java	2005-07-07
16:04:00 UTC (rev 3910)
+++
branches/branch_3_1/connector-j/src/testsuite/regression/EscapeProcessorRegressionTest.java	2005-07-07
19:26:08 UTC (rev 3911)
@@ -0,0 +1,57 @@
+/*
+ Copyright (C) 2005 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of version 2 of the GNU General Public License as 
+ published by the Free Software Foundation.
+
+ There are special exceptions to the terms and conditions of the GPL 
+ as it is applied to this software. View the full text of the 
+ exception in file EXCEPTIONS-CONNECTOR-J in the directory of this 
+ software distribution.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+ */
+package testsuite.regression;
+
+import testsuite.BaseTestCase;;
+
+/**
+ * Tests regressions w/ the Escape Processor code.
+ * 
+ * @version $Id:$
+ *
+ */
+public class EscapeProcessorRegressionTest extends BaseTestCase {
+
+	public EscapeProcessorRegressionTest(String name) {
+		super(name);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/**
+	 * Tests fix for BUG#11797 - Escape tokenizer doesn't respect stacked single quotes
+	 * for escapes.
+	 * 
+	 * @throws Exception if the test fails.
+	 */
+	public void testBug11797() throws Exception {
+		System.out.println(this.conn.nativeSQL("select 'ESCAPED BY ''\\'' ON {tbl_name | * |
*.* | db_name.*}'"));
+	}
+}

Thread
Connector/J commit: r3911 - in branches/branch_3_1/connector-j: . src/com/mysql/jdbc src/testsuite/regressionmmatthews7 Jul