Changeset: 5ffdacc0c593 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5ffdacc0c593 Modified Files: clients/odbc/ChangeLog clients/odbc/driver/SQLGetConnectAttr.c clients/odbc/driver/SQLSetConnectAttr.c Branch: default Log Message:
Removed the possibility to retrieve or set the CURRENT_CATALOG via SQLGetConnectAttr(hdbc, SQL_ATTR_CURRENT_CATALOG, ...) and SQLSetConnectAttr(hdbc, SQL_ATTR_CURRENT_CATALOG, ...) as MonetDB does not support CATALOG objects (no SQL support for: CREATE CATALOG abc or SET CATALOG abc) and therefore there is no CURRENT_CATALOG. Previously these 2 functions used to get or set the database name, but a database is different from the ODBC CATALOG concept. For retrieval of the database name an application should use ODBC function: SQLGetInfo(hdbc, SQL_DATABASE_NAME, ...). Specifying the database to use must be done at connection moment. It can be specified dynamically via SQLDriverConnect() in the connection string (via: DATABASE=mydb;). When using SQLConnect() the preconfigured Data Source (e.g. in file: ODBC.INI) should include the name of the database to use, besides host, port and other connection attributes. diffs (69 lines): diff --git a/clients/odbc/ChangeLog b/clients/odbc/ChangeLog --- a/clients/odbc/ChangeLog +++ b/clients/odbc/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog file for odbc # This file is updated with Maddlog +* Thu Jul 14 2022 Martin van Dinther <[email protected]> +- Removed the possibility to retrieve or set the CURRENT_CATALOG + via SQLGetConnectAttr(hdbc, SQL_ATTR_CURRENT_CATALOG, ...) and + SQLSetConnectAttr(hdbc, SQL_ATTR_CURRENT_CATALOG, ...) as MonetDB does + not support CATALOG objects (no SQL support for: CREATE CATALOG abc + or SET CATALOG abc) and therefore there is no CURRENT_CATALOG. + * Thu Jun 23 2022 Martin van Dinther <[email protected]> - Corrected ODBC functions SQLTablePrivileges() and SQLColumnPrivileges() for local temporary tables located in schema tmp. They did not return diff --git a/clients/odbc/driver/SQLGetConnectAttr.c b/clients/odbc/driver/SQLGetConnectAttr.c --- a/clients/odbc/driver/SQLGetConnectAttr.c +++ b/clients/odbc/driver/SQLGetConnectAttr.c @@ -84,9 +84,16 @@ MNDBGetConnectAttr(ODBCDbc *dbc, break; case SQL_ATTR_CURRENT_CATALOG: /* SQLCHAR* */ /* SQL_CURRENT_QUALIFIER */ - copyString(dbc->dbname, strlen(dbc->dbname), ValuePtr, - BufferLength, StringLengthPtr, SQLINTEGER, - addDbcError, dbc, return SQL_ERROR); + /* MonetDB does NOT support SQL catalog concept, return empty string */ + if (BufferLength <= 0) { + /* Invalid string or buffer length */ + addDbcError(dbc, "HY090", NULL, 0); + return SQL_ERROR; + } + strcpy_len((char *) ValuePtr, "", BufferLength); + if (StringLengthPtr) { + *(StringLengthPtr) = (SQLINTEGER) 0; + } break; case SQL_ATTR_TXN_ISOLATION: /* SQLUINTEGER */ /* SQL_TXN_ISOLATION */ diff --git a/clients/odbc/driver/SQLSetConnectAttr.c b/clients/odbc/driver/SQLSetConnectAttr.c --- a/clients/odbc/driver/SQLSetConnectAttr.c +++ b/clients/odbc/driver/SQLSetConnectAttr.c @@ -58,22 +58,9 @@ MNDBSetConnectAttr(ODBCDbc *dbc, } return SQL_SUCCESS; case SQL_ATTR_CURRENT_CATALOG: /* SQLCHAR* */ - fixODBCstring(ValuePtr, StringLength, SQLINTEGER, - addDbcError, dbc, return SQL_ERROR); - if (dbc->Connected) { - /* Driver does not support this functions */ - addDbcError(dbc, "IM001", NULL, 0); - return SQL_ERROR; - } - if (dbc->dbname) - free(dbc->dbname); - dbc->dbname = dupODBCstring(ValuePtr, StringLength); - if (dbc->dbname == NULL) { - /* Memory allocation error */ - addDbcError(dbc, "HY001", NULL, 0); - return SQL_ERROR; - } - break; + /* Driver does not support this function */ + addDbcError(dbc, "IM001", NULL, 0); + return SQL_ERROR; case SQL_ATTR_CONNECTION_TIMEOUT: /* SQLUINTEGER */ dbc->sql_attr_connection_timeout = (SQLUINTEGER) (uintptr_t) ValuePtr; if (dbc->mid) _______________________________________________ checkin-list mailing list -- [email protected] To unsubscribe send an email to [email protected]
