[ODBC-226] Driver doesn't cause an error when it should Created: 2019-02-21  Updated: 2020-08-27  Resolved: 2019-08-07

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.0.9
Fix Version/s: 3.1.3

Type: Bug Priority: Critical
Reporter: Matthias Schröder Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File patch.txt     Text File test.patch    

 Description   

The following statement doesn't cause an error, but it should:

drop temporary table if exists test.sometable;
create temporary table test.sometable as select 1 from nonexistend_table.field

As a sideffect of this bug, affected rows are not properly counted.

I did some testing and attached a test and a possible patch.

I consider this bug critical because the user doesn't notice when something went wrong.

I considered to split the test into two pieces, however ODBC-222 could easily lead to a regression on this matter and I think it would be a good idea to keep the test it this way.



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

Thank you for your report.
The thing here is that you have batch of SQL statements. One of them is successful, the other is not. It's a bit up to driver what to do in such case. But I'd say SQLExecDirect should return SQL_SUCCESS_WITH_INFO in such case. However https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/errors-and-batches says SQL_SUCCESS is also possible. But I'd keep it inline with parameter array execution, that is also in fact batch of statements. And in case of error on one set of parameters(while success on others) it's supposed to return SQL_SUCCESS_WITH_INFO(https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/using-arrays-of-parameters)

I haven't looked into your patch yet. But would it possible to make it as github pull request at https://github.com/MariaDB/mariadb-connector-odbc/? That would make it a bit easier to merge the patch. And we usually request code to be submitted under BSD or code contribution agreement to be signed.

You don't need to worry about ODBC-222. It will be done in the next version. And it's our concern not to have regressions.

Comment by Lawrin Novitsky [ 2019-08-07 ]

All I said in the comment is not really relevant Well, not completely irrelevant, but we not gonna do that.
Returned success is fine. After that application has to call SQLMoreResults to get affected rows count or just execution result of the 2nd statement in the batch. And what was wrong - connector did not return SQL_ERROR at this point, like it said here.

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