Bug #13036 Returns error when field names contain any of the following chars %<>()/ etc

Submitted: 7 Sep 2005 12:52 Modified: 23 Sep 2005 15:40
Reporter: Rob Cairns Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:1.0.5 OS:Windows (Windows XP Professional)
Assigned to: Reggie Burnett CPU Architecture:Any

[7 Sep 2005 12:52] Rob Cairns
Description:
When field names have special characters - update returns an error

How to repeat:
Use a field name containing any of the following characters : ()%<>/

Suggested fix:
Here is my quick and dirty fix in CommandBuilder.cs:
		
                          private static string GetParameterName(string columnName)
		{
			string colName = columnName.Replace(" ", "");
			//Rob Cairns
			colName = colName.Replace("/", "_per_");
			colName = colName.Replace("-", "_");
			colName = colName.Replace(")", "_cb_");
			colName = colName.Replace("(", "_ob_");
			colName = colName.Replace("%", "_pct_");
			colName = colName.Replace("<", "_lt_");
			colName = colName.Replace(">", "_gt_");
			colName = colName.Replace(".", "_pt_");
			return colName;
		}
[14 Sep 2005 16:56] Reggie Burnett
Rob

Thanks for the bug report and the patch.  I took your code and used it (tweaked to use StringBuilder).  It may feel like a quick and dirty hack but it actually works pretty well.  The problem is that the TokenizeSql routine I have stops when it sees a nonalphanumeric.  This could be changed but the tokenizer would never be able to support ) in the paramter name since ) also terminates the list of parameters.  Using this technique you can use ) in your field name.  Not sure why you would though... :-)
[15 Sep 2005 18:21] Mike Hillyer
Added to 1.0.6 changelog:

<listitem><para>Field names that contained the following characters caused errors: <literal>()%&lt;&gt;/</literal> (Bug #13036)</para></listitem>

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

Page generated in 0.051 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.