Bug #52167 Can't parse parameter list with special characters inside

Submitted: 18 Mar 2010 7:39 Modified: 24 Mar 2010 13:32
Reporter: Tonci Grgin Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1 branch OS:Any
Assigned to: Tony Bedford CPU Architecture:Any

[18 Mar 2010 7:39] Tonci Grgin
Description:
DatabaseMetadata.java, function private void getCallStmtParameterTypes breaks if parameter is defined in more than one line.

How to repeat:
declaration	"OUT ffact\nVARCHAR(100)" (id=208)	
	count	22	
	hash	0	
	offset	92	
	value	char[246]  (id=178)

Suggested fix:
Trim special characters out.
[18 Mar 2010 7:41] Tonci Grgin
This will be fixed as a part of fix for Bug#51912.
[18 Mar 2010 8:37] Tonci Grgin
Patch:
DatabaseMetaData.java, ~ Ln 1732
	if (declaration.trim().length() == 0) {
		break; // no parameters actually declared, but whitespace spans lines
	}
+	//Bug#52167, tokenizer will break if declaration contains special characters like \n
+	declaration = declaration.replaceAll("[\\t\\n\\x0B\\f\\r]", " ");		
	StringTokenizer declarationTok = new StringTokenizer(
				declaration, " \t");
[18 Mar 2010 8:42] Tonci Grgin
mysql> show create procedure foo1\G
*************************** 1. row ***************************
           Procedure: foo1
            sql_mode:
    Create Procedure: CREATE DEFINER=`root`@`%` PROCEDURE `foo1`(OUT nfact VARCH
AR(100), IN ccuenta VARCHAR(100), OUT ffact
VARCHAR(100), OUT fdoc VARCHAR(100))
BEGIN
    SET nfact = 'ncfact string';
    SET ffact = 'ffact string';
    SET fdoc = 'fdoc string';
END
character_set_client: latin1
collation_connection: latin1_swedish_ci
  Database Collation: latin1_swedish_ci
1 row in set (0.00 sec)
[24 Mar 2010 7:14] Tonci Grgin
Fixed in patch for Bug#51912. Regression test case will be added for this problem.
[24 Mar 2010 13:32] Tony Bedford
An entry has been added to the 5.1.13 changelog:

In the file DatabaseMetadata.java, the function private void getCallStmtParameterTypes failed if the parameter was defined over more than one line by using the '\n' character.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.