Bug #39560 SQLGetInfo returns 0 for SQL_CATALOG_USAGE info
Submitted: 20 Sep 2008 17:42 Modified: 10 Oct 2008 13:38
Reporter: Farid Zidan (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.1.5 OS:Windows (XP SP3)
Assigned to: Jess Balint CPU Architecture:Any
Tags: qc, SQL_CATALOG_USAGE, SQLGETINFO

[20 Sep 2008 17:42] Farid Zidan
Description:
        rc = SQLGetInfo( m_hdbc, SQL_CATALOG_USAGE, 
                         &m_nCatalogUsage, NULL, NULL );
driver says catalogs are not supported at all. Should at least return SQL_CU_DML_STATEMENTS. 
ODBC 3.5x.x driver correctly return decimal 29.

How to repeat:
 rc = SQLGetInfo( m_hdbc, SQL_CATALOG_USAGE, 
                         &m_nCatalogUsage, NULL, NULL );
ASSERT( (m_nCatalogUsage & SQL_CU_DML_STATEMENTS ) != 0 );

Suggested fix:
Return same value as ODBC connector 3.5x.x ( 29 decimal )
[23 Sep 2008 10:47] Jess Balint
FLAG_NO_CATALOG check was inverted:

=== modified file 'driver/info.c'
--- driver/info.c       2008-08-22 22:12:25 +0000
+++ driver/info.c       2008-09-23 10:44:22 +0000
@@ -115,7 +115,7 @@
     MYINFO_SET_STR((dbc->flag & FLAG_NO_CATALOG) ? "" : "database");

   case SQL_CATALOG_USAGE:
-    MYINFO_SET_ULONG((dbc->flag & FLAG_NO_CATALOG) ?
+    MYINFO_SET_ULONG(!(dbc->flag & FLAG_NO_CATALOG) ?
                      (SQL_CU_DML_STATEMENTS | SQL_CU_PROCEDURE_INVOCATION |
                       SQL_CU_TABLE_DEFINITION | SQL_CU_INDEX_DEFINITION |
                       SQL_CU_PRIVILEGE_DEFINITION) :
[3 Oct 2008 14:43] Jess Balint
Pushed into trunk. Will be released in 5.1.6.
[10 Oct 2008 13:38] Tony Bedford
An entry was added to the 5.1.6 changelog:

The SQLGetInfo() function returned 0 for SQL_CATALOG_USAGE information.