Bug #3592 Insert Query generates bad SQL
Submitted: 28 Apr 2004 20:44 Modified: 4 May 2004 22:50
Reporter: Curtis Bolser Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL++ Severity:S3 (Non-critical)
Version:1.7.1 Win32/Visual C++ OS:Windows (Windows 2000)
Assigned to: CPU Architecture:Any

[28 Apr 2004 20:44] Curtis Bolser
Description:
//When using the mySQL++ libraries, and a custom structure created as follows
sql_create_13 (TempRecords,				// struct name, 
		1, 13,				// less-than comparable, num of columns
		 string, Serial,	// type, id 
		 string, Year,
		 string, Month,
		 string, Day,
		 string, Hour,
		 string, Minute,
		 string, Max,
		 string, Temp1,
		 string, Temp2,
		 string, Temp3,
		 string, Temp4,
		 string, Temp5,
		 string, Temp6);

//When a connection is created via 
Connection con( use_exceptions );
con.connect( myDBname, myHost, myUser, myPass );
//And query created with
Query q = con.query();
//The row is created
TempRecords row;
//and populated
row.set( serial, currentRecord.year, currentRecord.month, currentRecord.day, currentRecord.hour, currentRecord.minute, currentRecord.max, curentRecord.temp1, currentRecord.temp2, currentRecord.temp3, currentRecord.temp4, currentRecord.temp5, currentRecord.temp6 );
//and then the query is set
q.insert(row);
//Both the previewof the query and the SQL sent to the server are bad.
//No quotes are placed around the string values, even though they are
//declared as string values in the custom structure.  This results in a
//BadQuery exception.  This is done almost verbatim in an example on the
//mySQL++ manual, under 4.5.2 Adding Data.

How to repeat:
This is repeated any time a query is formed using a custom structure which includes strings, as the SQL query is not formed with quotes around the strings.

Suggested fix:
Alter the SQL query generation by functions such as insert() such that they place quotes around string items.
[28 Apr 2004 20:53] Curtis Bolser
On rethinking this is not a severe problem, it can be worked around in a relatively simple fashion, but it is still something that I feel is worth bringing to your attention.
[29 Apr 2004 19:34] Curtis Bolser
Changed version and OS info to be more accurate.
[4 May 2004 22:50] MySQL Verification Team
Sorry, but SSQL does not work at all with VC++ !!!

VC++ simply does not support properly certain iterator features from ANSI C++ from 2001.