[ODBC-67] SQL_ATTR_PARAM_STATUS_PTR reports SQL_PARAM_DIAG_UNAVAILABLE instead of SQL_PARAM_ERROR Created: 2016-11-18  Updated: 2017-05-15

Status: Open
Project: MariaDB Connector/ODBC
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Rahul Dhuvad Assignee: Lawrin Novitsky
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Windows 64-bit, Linux 64-bit



 Description   

We are seeing that during array inserts, MariaDB populates SQL_PARAM_DIAG_UNAVAILABLE for each failed rows (in our case it was a duplicate key for a primary key column) instead of expected SQL_PARAM_ERROR. For example, let's say my table has 4 rows already; and my program tries to insert 6 rows with SQL_ATTR_PARAMSET_SIZE set to 6 itself; out of 6 rows, 4 are duplicate keys which would result in failures and eventually only 2 rows will get inserted to the database. After SQLExecute(), I'm seeing my SQL_ATTR_PARAM_STATUS_PTR values like

{1, 1, 1, 1, 0, 0}

; where 1 indicates SQL_PARAM_DIAG_UNAVAILABLE.

Due to this our statistics reports for each execution reports incorrect information to our users.

– response from Lawrin Novitsky <lawrin.novitsky@mariadb.com> (2016-Nov-18):
It looks like a bug. I think we are able to return SQL_PARAM_ERROR and not just SQL_PARAM_DIAG_UNAVAILABLE. I can fix that. Especially if you file the bug



 Comments   
Comment by Lawrin Novitsky [ 2017-02-25 ]

Reading here about SQL_ATTR_PARAM_STATUS_PTR
"SQL_PARAM_ERROR: There was an error in processing this set of parameters. Additional error information is available in the diagnostics data structure." and
"SQL_PARAM_DIAG_UNAVAILABLE: The driver treats arrays of parameters as a monolithic unit and so does not generate this level of error information."

I think we've done that for purpose, since we have diagnostic information only for last executed paramset. And we return SQL_PARAM_ERROR only if it has occurred on the last paramset.
There is no problem to set SQL_PARAM_ERROR instead of SQL_PARAM_DIAG_UNAVAILABLE. But to provide diagnostic for it, is.
I checked, and mysql connector behaves in same way.
I am not closing the issue so far, but I have changed it to be a "Feature request". Anyway, it's probably not a good idea to change this in 2.0, and so it will go to 3.0 earliest.

Generated at Thu Feb 08 03:25:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.