Bug #30931 SQLNumParams fails after SQLPrepareW on a command with no parameters
Submitted: 10 Sep 2007 13:51 Modified: 11 Sep 2007 13:19
Reporter: Tonci Grgin Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5 OS:Windows (XP)
Assigned to: CPU Architecture:Any

[10 Sep 2007 13:51] Tonci Grgin
Description:
Calling SQLNumParams on a statement with no parameters leads to error.

How to repeat:
results         1f2c-11c0	ENTER SQLPrepareW 
		HSTMT               00832290
		WCHAR *             0x0157DEE8 [      -3] "DELETE FROM tblname WHERE ID = 'anything'\ 0"
		SDWORD                    -3

results         1f2c-11c0	EXIT  SQLPrepareW  with return code 0 (SQL_SUCCESS)
		HSTMT               00832290
		WCHAR *             0x0157DEE8 [      -3] "DELETE FROM tablename WHERE ID = 'anything'\ 0"
		SDWORD                    -3

results         1f2c-11c0	ENTER SQLNumParams 
		HSTMT               00832290
		SWORD *             0x01543088

results         1f2c-11c0	EXIT  SQLNumParams  with return code -1 (SQL_ERROR)
		HSTMT               00832290
		SWORD *             0x01543088

		DIAG [HY010] [MySQL][MyODBC 5.00.11] Function sequence error (0) 

Suggested fix:
Return 0 for failed SQLNumParams call.
[11 Sep 2007 13:19] Tonci Grgin
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at

  http://www.mysql.com/downloads/

Explanation: The problem is fixed in 5.1Alpha release of MyODBC.