This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

ODBC Connector SQLProcedureColumns does not accept empty SchemaName

(MariaDB community server 10.10.2 MariaDB ODBC 3.1.17)

I am using sqlapi++ as odbc library. I need to get the input and output variable of stored procedures why I use the SQLProcedureColumns function. sqlapi++ searchs the catalog, schema and procedure names and calls the MADB_StmtProcedureColumns function in MariaDB ODBC connector. When there is no schema name it passes an empty string to MADB_StmtProcedureColumns. And this is a problem in MariaDB ODBC > 3.1.12.

in ma_catalog.c of the MariaDB ODBC from line 576 is the WHERE clause defined of the SQLProcedureColumns query.

at line 601:

 /* Empty schema name means tables w/out schema. We could get here only if it is empty string, otherwise the error would have been already thrown */
  if (SchemaName != NULL && *SchemaName == '\0')
  {
    p += _snprintf(p, Length - strlen(StmtStr), "WHERE 0");
  }

because of SELECT SPECIFIC_SCHEMA AS PROCEDURE_CAT ... WHERE 0, I don't get an empty table. With MariaDB ODBC <=3.1.12, MySQL ODBC and MS SQL Server I can pass an empty string for the schema. What is the reason in the newer ODBC Connector the schema must be null an there is no empty string accepted? I think it would be better to accept empty strings and stay compatible with other ODBC drivers.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.