Bug #89542 ODBC Parameter NO_CACHE Lead To Function Call Error Not Return
Submitted: 6 Feb 2018 2:38 Modified: 7 Feb 2018 6:09
Reporter: you shit Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.03.10 OS:Microsoft Windows (WIndows 7 Enterprise Service Pack 1)
Assigned to: CPU Architecture:Any

[6 Feb 2018 2:38] you shit
Description:
If set NO_CACHE=1 parameter in ODBC connection string, the function call error in the select list will not return. 

How to repeat:
there is function definition like:

DELIMITER |
DROP FUNCTION IF EXISTS quest_stage.avglinda;
CREATE FUNCTION quest_stage.`avglinda`(num1 SMALLINT UNSIGNED, num2 SMALLINT UNSIGNED, num3 SMALLINT UNSIGNED) RETURNS float(3,2)
BEGIN
RETURN (num1+num2+num3)/3;
END|
DELIMITER ;

function avglinda have three parameters.

And there is a query like:
SELECT `REGION_ID`    AS `COL_1`, `REGION_NAME`  AS `COL_2`, avglinda(1, 2) AS `COL_3`  FROM `quest_stage`.`region`

the function call of avglinda only provide two parameter.
Normally it will return error as:
# ERR: Incorrect number of arguments for FUNCTION quest_stage.avglinda; expected
 3, got 2 (MySQL error code: 1318, SQLState: 42000 )

But with the following connection string, it will return SQL_SUCCESS with empty result.

DRIVER={MySQL ODBC 5.3 ANSI Driver};server=localhost;port=3306;database=quest_stage;UID=linda;PWD=xxx;FBS=3000000;NO_CACHE=1;FORWARD_CURSOR=1

After remove the parameter 'NO_CACHE=1;' the issue gone. As I need to query on very large table in production environment, so I can not remove the parameter.
But the incorrect return status make me not able to display proper message for client.

Suggested fix:
parameter NO_CACHE=1 should not hide function call error.
[6 Feb 2018 12:27] Chiranjeevi Battula
Hello !!,

Thank you for the bug report.
Verified this behavior on Visual Studio 2017 (C#.Net) and Connector / ODBC 5.3.10.

Thanks,
Chiranjeevi.
[6 Feb 2018 12:27] Chiranjeevi Battula
Screenshot

Attachment: Bug_89542.PNG (image/png, text), 33.84 KiB.

[6 Feb 2018 12:27] Chiranjeevi Battula
Screenshot

Attachment: Bug_89542_1.PNG (image/png, text), 42.32 KiB.

[7 Feb 2018 6:09] you shit
@Chiranjeevi, thanks for your verification. 
Do you know is there any workaround before I get the fixing?
Obviously I can not remove the NO_CACHE parameter, because the sharing connections may work on large table with millions of rows.