Bug #452 SQLStatistics reports error with call to get Statistics for Table that does not
Submitted: 20 May 2003 2:21 Modified: 4 Jun 2003 15:01
Reporter: Stephen Dakin Email Updates:
Status: Closed Impact on me:
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51 OS:Microsoft Windows (Win 2000)
Assigned to: Bugs System CPU Architecture:Any

[20 May 2003 2:21] Stephen Dakin
Calling for Statistics from a table that does not exist reports an error.
Every other ODBC Driver that I have ever used merely returns an empty result set in this case.

Now, I can't find any information describing how this is actually supposed to work, the ODBC 3 Programmers reference describes it as a search criteria (suggesting that an empty result set should be the result), but nothing explicitly describing this scenario.

How to repeat:
Open a connection
Open a statment
Call SQLStatistics with a table name that does not exist in the database

Suggested fix:
Perhaps decide to return an empty result set under these conditions.

I have used many dozens of other drivers on tens of data sources, and none have behaved this way, so it may save support calls in the future to behave in this way.

I have just modified my code in this instance to do an explicit test for the table if no wild cards are present, as such this is of very low priority for me.

Many thanks in advance.
[20 May 2003 21:54] Venu Anuganti
Hi !! 
Thanks for the report. Its true that SQLColumns/SQLStatistics returns an error in case of 
non-existing table is used as szTableName argument; as this is directly mapped with SHOW 
syntax. As per the ODBC spec, it should return SQL_SUCCESS with 0 rows for this kind of 
cases; and currently it is returning SQL_ERROR. 
I just fixed this in 3.51 as well as in 3.52.