Skip to content

Commit

Permalink
ODBC-313 Partial fix and relevant testcases
Browse files Browse the repository at this point in the history
Added session tracking use to avoid extra queries to server. Removed
mysql_sttm_reset calls. Qureies, initiated by the connector, assembled
into a batch if possible(it;s mostly about queries sent at connect time).
  • Loading branch information
lawrinn committed May 30, 2021
1 parent c5a9476 commit 5341593
Show file tree
Hide file tree
Showing 15 changed files with 467 additions and 138 deletions.
13 changes: 8 additions & 5 deletions ma_catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* Pv - pattern value
* Oa - ordinary argument
* Id - identifier
*
* if bufferLen is -1, them buffer is assumed to be the dynamic string. Plain char buffer otherwise
*/
/* {{{ AddPvCondition */
static int AddPvCondition(char* buffer, size_t bufferLen, char* value, SQLSMALLINT len)
Expand Down Expand Up @@ -228,7 +230,9 @@ SQLRETURN MADB_StmtTables(MADB_Stmt *Stmt, char *CatalogName, SQLSMALLINT Catalo
{
return MADB_SetError(&Stmt->Error, MADB_ERR_HY090, "Table and catalog names are limited to 64 chars", 0);
}
if (SchemaName != NULL && *SchemaName != '\0')
/* Schemas are not supported. Thus error except special cases of SQLTables use*/
if (SchemaName != NULL && *SchemaName != '\0'
&& (strcmp(SchemaName, SQL_ALL_SCHEMAS) || CatalogName == NULL || CatalogNameLength != 0 && TableName == NULL || TableNameLength != 0))
{
return MADB_SetError(&Stmt->Error, MADB_ERR_HYC00, "Schemas are not supported. Use CatalogName parameter instead", 0);
}
Expand Down Expand Up @@ -265,11 +269,10 @@ SQLRETURN MADB_StmtTables(MADB_Stmt *Stmt, char *CatalogName, SQLSMALLINT Catalo
"SELECT NULL, NULL, NULL, 'SYSTEM VIEW', NULL FROM DUAL",
8192, 512);
}
/* Since we treat our databases as catalogs, the only acceptable value for schema is NULL or "%"
if that is not the special case of call for schemas list. Otherwise we return empty resultset*/
/* Since we treat our databases as catalogs, the only acceptable value for schema is NULL or "%",
if that is not the special case of call for schemas list or tables w/out schema(empty string ins schema name) - empty resultsets then. */
else if (SchemaName &&
((!strcmp(SchemaName,SQL_ALL_SCHEMAS) && CatalogName && CatalogNameLength == 0 && TableName && TableNameLength == 0) ||
strcmp(SchemaName, SQL_ALL_SCHEMAS)))
(!strcmp(SchemaName,SQL_ALL_SCHEMAS) && CatalogName && CatalogNameLength == 0 && TableName && TableNameLength == 0 || *SchemaName == '\0'))
{
MADB_InitDynamicString(&StmtStr, "SELECT NULL AS TABLE_CAT, NULL AS TABLE_SCHEM, "
"NULL AS TABLE_NAME, NULL AS TABLE_TYPE, NULL AS REMARKS "
Expand Down
Loading

0 comments on commit 5341593

Please sign in to comment.