Bug #44967 SQLTables returns dummy row instead of all tables

Submitted: 19 May 2009 21:33 Modified: 16 Jun 2011 4:01
Reporter: Farid Zidan (Candidate Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.01.05.00 OS:Windows (XP SP3)
Assigned to: Assigned Account CPU Architecture:Any

[19 May 2009 21:33] Farid Zidan
Description:
    SQLRETURN rc = ::SQLTables( 
        pSQL->Gethstmt(),
        ( SQLCHAR * )   "mysql",
        ( SQLSMALLINT ) 5,
        ( SQLCHAR * )   NULL,
        ( SQLSMALLINT ) 0,
        ( SQLCHAR * )   NULL,
        ( SQLSMALLINT ) 0 ,
( SQLCHAR * ) "TABLE",
        ( SQLSMALLINT ) 5 );

Should get all tables in the schema "mysql" instead gets one row:
table_cat: mysql
table_name: NULL
table_type: None

Works correctly in MySQL ODBC 3.51 driver 3.51.27

How to repeat:
Execute code fragment above

Suggested fix:
Allow caller to pass you NULL for table_name and 0 for cbTableName to get all tables accessible for a schema without having to enter a search pattern. The following is Microsoft documentation:
http://msdn.microsoft.com/en-us/library/ms131341.aspx?ppud=4

// Get a list of all tables in the current database.
SQLTables(hstmt, NULL, 0, NULL, 0, NULL, 0, NULL,0);

// Get a list of all tables in all databases.
SQLTables(hstmt, (SQLCHAR*) "%", SQL_NTS, NULL, 0, NULL, 0, NULL,0);
[19 May 2009 22:37] Farid Zidan
This may be a duplicate of #39561
[16 Jun 2011 4:01] Bogdan Degtyariov
Wrong status of the bug.
As Farid correctly noticed it is a duplicate of bug #39561, which is fixed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.