Bug #2339 can't handle queries that contain ';'
Submitted: 9 Jan 2004 14:10 Modified: 15 Jan 2004 17:07
Reporter: [ name withheld ] Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.06 OS:Microsoft Windows (Windows 2000)
Assigned to: CPU Architecture:Any

[9 Jan 2004 14:10] [ name withheld ]
Description:
I'm using WinSQL 2.0.1.198 with MyODBC 3.51.06 on Windows 2000, connecting to MySQL 3.23.55 on SuSE Linux 8.2.

A query that contains a quoted semi-colon fails with a syntax error (State:37000, Native Code: 428).  The same query works locally in a mysql session.

How to repeat:
Create a table with a varchar field:

  create table foo (bar varchar (255))

Attempt to insert a row that contains a semi-colon:

  insert into foo (bar) values ('testing; 1, 2, 3')

Alternatively, attempt to select a row that contains a semi-colon:

  select * from foo where bar like '%;%'
[15 Jan 2004 17:07] MySQL Verification Team
I tested with mysqld 3.23.59 running on Suse 9.0 and MyODBC with the
test tool ODBCTE32.EXE: 

Full Connect(Default)

Env. Attr. SQL_ATTR_ODBC_VERSION set to SQL_OV_ODBC3

Successfully connected to DSN 'bugtest'.
SQLExecDirect:
In: hstmt = 0x00391B50, szSqlStr = "create table foo (bar varchar (255))
", cbSqlStr = -3
	Return:	SQL_SUCCESS=0
SQLExecDirect:
In: hstmt = 0x00391B50, szSqlStr = "insert into foo (bar) values ('testing; 1, 2, 3')

", cbSqlStr = -3
Return:	SQL_SUCCESS=0

SQLExecDirect:
In: hstmt = 0x00391B50, szSqlStr = "select * from foo where bar like '%;%'

", cbSqlStr = -3
Return:	SQL_SUCCESS=0

Get Data All:
"bar"
"testing; 1, 2, 3"
1 row fetched from 1 column.
[8 Apr 2008 14:26] David Ip
It is a problem with WinSQL.  I had the same issue.  I was able to do the before mentioned commands involving the semicolon using PHP's mysql_query.  This issue is due to the use of the semicolon as a deliminator to break up sql statements in winsql.