Changeset: 2c51dfe1715f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2c51dfe1715f Modified Files: clients/odbc/driver/SQLColumns.c clients/odbc/driver/SQLForeignKeys.c clients/odbc/driver/SQLPrimaryKeys.c clients/odbc/driver/SQLProcedureColumns.c clients/odbc/driver/SQLProcedures.c clients/odbc/driver/SQLSpecialColumns.c clients/odbc/driver/SQLStatistics.c clients/odbc/driver/SQLTables.c Branch: default Log Message:
add more asserts diffs (135 lines): diff --git a/clients/odbc/driver/SQLColumns.c b/clients/odbc/driver/SQLColumns.c --- a/clients/odbc/driver/SQLColumns.c +++ b/clients/odbc/driver/SQLColumns.c @@ -244,6 +244,9 @@ MNDBColumns(ODBCStmt *stmt, /* add the ordering (exclude table_cat as it is the same for all rows) */ pos += strcpy_len(query + pos, " order by \"TABLE_SCHEM\", \"TABLE_NAME\", \"ORDINAL_POSITION\"", querylen - pos); + assert(pos < querylen); + + /* debug: fprintf(stdout, "SQLColumns query (pos: %zu, len: %zu):\n%s\n\n", pos, strlen(query), query); */ /* query the MonetDB data dictionary tables */ rc = MNDBExecDirect(stmt, (SQLCHAR *) query, (SQLINTEGER) pos); diff --git a/clients/odbc/driver/SQLForeignKeys.c b/clients/odbc/driver/SQLForeignKeys.c --- a/clients/odbc/driver/SQLForeignKeys.c +++ b/clients/odbc/driver/SQLForeignKeys.c @@ -252,8 +252,9 @@ MNDBForeignKeys(ODBCStmt *stmt, PKTableName != NULL ? "FK" : "PK", PKTableName != NULL ? "FK" : "PK", PKTableName != NULL ? "FK" : "PK"); + assert(pos < querylen); - /* debug: fprintf(stdout, "SQLForeignKeys SQL (%zu):\n%s\n\n", pos, query); */ + /* debug: fprintf(stdout, "SQLForeignKeys query (pos: %zu, len: %zu):\n%s\n\n", pos, strlen(query), query); */ /* query the MonetDB data dictionary tables */ rc = MNDBExecDirect(stmt, (SQLCHAR *) query, (SQLINTEGER) pos); diff --git a/clients/odbc/driver/SQLPrimaryKeys.c b/clients/odbc/driver/SQLPrimaryKeys.c --- a/clients/odbc/driver/SQLPrimaryKeys.c +++ b/clients/odbc/driver/SQLPrimaryKeys.c @@ -206,8 +206,9 @@ MNDBPrimaryKeys(ODBCStmt *stmt, /* add the ordering */ pos += strcpy_len(query + pos, " order by \"TABLE_SCHEM\", \"TABLE_NAME\", \"KEY_SEQ\"", querylen - pos); + assert(pos < querylen); - /* debug: fprintf(stdout, "SQLPrimaryKeys SQL:\n%s\n\n", query); */ + /* debug: fprintf(stdout, "SQLPrimaryKeys query (pos: %zu, len: %zu):\n%s\n\n", pos, strlen(query), query); */ /* query the MonetDB data dictionary tables */ rc = MNDBExecDirect(stmt, (SQLCHAR *) query, (SQLINTEGER) pos); diff --git a/clients/odbc/driver/SQLProcedureColumns.c b/clients/odbc/driver/SQLProcedureColumns.c --- a/clients/odbc/driver/SQLProcedureColumns.c +++ b/clients/odbc/driver/SQLProcedureColumns.c @@ -256,8 +256,9 @@ MNDBProcedureColumns(ODBCStmt *stmt, /* add the ordering (exclude procedure_cat as it is the same for all rows) */ pos += strcpy_len(query + pos, " order by \"PROCEDURE_SCHEM\", \"PROCEDURE_NAME\", \"SPECIFIC_NAME\", \"COLUMN_TYPE\", \"ORDINAL_POSITION\"", querylen - pos); + assert(pos < querylen); - /* debug: fprintf(stdout, "SQLProcedureColumns SQL (%zu):\n%s\n\n", pos, query); */ + /* debug: fprintf(stdout, "SQLProcedureColumns query (pos: %zu, len: %zu):\n%s\n\n", pos, strlen(query), query); */ /* query the MonetDB data dictionary tables */ rc = MNDBExecDirect(stmt, (SQLCHAR *) query, (SQLINTEGER) pos); diff --git a/clients/odbc/driver/SQLProcedures.c b/clients/odbc/driver/SQLProcedures.c --- a/clients/odbc/driver/SQLProcedures.c +++ b/clients/odbc/driver/SQLProcedures.c @@ -164,8 +164,9 @@ MNDBProcedures(ODBCStmt *stmt, /* add the ordering (exclude procedure_cat as it is the same for all rows) */ pos += strcpy_len(query + pos, " order by \"PROCEDURE_SCHEM\", \"PROCEDURE_NAME\", \"SPECIFIC_NAME\"", querylen - pos); + assert(pos < querylen); - /* debug: fprintf(stdout, "SQLProcedures SQL (%zu):\n%s\n\n", pos, query); */ + /* debug: fprintf(stdout, "SQLProcedures query (pos: %zu, len: %zu):\n%s\n\n", pos, strlen(query), query); */ /* query the MonetDB data dictionary tables */ rc = MNDBExecDirect(stmt, (SQLCHAR *) query, (SQLINTEGER) pos); diff --git a/clients/odbc/driver/SQLSpecialColumns.c b/clients/odbc/driver/SQLSpecialColumns.c --- a/clients/odbc/driver/SQLSpecialColumns.c +++ b/clients/odbc/driver/SQLSpecialColumns.c @@ -90,7 +90,6 @@ MNDBSpecialColumns(ODBCStmt *stmt, /* buffer for the constructed query to do meta data retrieval */ char *query = NULL; - size_t querylen; size_t pos = 0; char *sch = NULL, *tab = NULL; @@ -163,6 +162,8 @@ MNDBSpecialColumns(ODBCStmt *stmt, SMALLINT PSEUDO_COLUMN */ if (IdentifierType == SQL_BEST_ROWID) { + size_t querylen; + /* determine if we need to add a query against the tmp.* tables */ bool addTmpQuery = (SchemaName == NULL) || (SchemaName != NULL @@ -419,6 +420,7 @@ MNDBSpecialColumns(ODBCStmt *stmt, if (pos >= querylen) fprintf(stderr, "pos >= querylen, %zu > %zu\n", pos, querylen); + assert(pos < querylen); } else { assert(IdentifierType == SQL_ROWVER); /* The backend does not have such info available */ @@ -438,7 +440,7 @@ MNDBSpecialColumns(ODBCStmt *stmt, pos = strlen(query); } - /* debug: fprintf(stdout, "SQLSpecialColumns SQL:\n%s\n\n", query); */ + /* debug: fprintf(stdout, "SQLSpecialColumns query (pos: %zu, len: %zu):\n%s\n\n", pos, strlen(query), query); */ /* query the MonetDB data dictionary tables */ rc = MNDBExecDirect(stmt, (SQLCHAR *) query, (SQLINTEGER) pos); diff --git a/clients/odbc/driver/SQLStatistics.c b/clients/odbc/driver/SQLStatistics.c --- a/clients/odbc/driver/SQLStatistics.c +++ b/clients/odbc/driver/SQLStatistics.c @@ -292,8 +292,9 @@ MNDBStatistics(ODBCStmt *stmt, /* add the ordering */ pos += strcpy_len(query + pos, " order by \"NON_UNIQUE\", \"TYPE\", \"INDEX_QUALIFIER\", \"INDEX_NAME\", \"ORDINAL_POSITION\"", querylen - pos); + assert(pos < querylen); - /* debug: fprintf(stdout, "SQLStatistics SQL:\n%s\n\n", query); */ + /* debug: fprintf(stdout, "SQLStatistics query (pos: %zu, len: %zu):\n%s\n\n", pos, strlen(query), query); */ /* query the MonetDB data dictionary tables */ rc = MNDBExecDirect(stmt, (SQLCHAR *) query, (SQLINTEGER) pos); diff --git a/clients/odbc/driver/SQLTables.c b/clients/odbc/driver/SQLTables.c --- a/clients/odbc/driver/SQLTables.c +++ b/clients/odbc/driver/SQLTables.c @@ -233,8 +233,11 @@ MNDBTables(ODBCStmt *stmt, /* add the ordering */ pos += strcpy_len(query + pos, " order by \"TABLE_TYPE\", \"TABLE_SCHEM\", \"TABLE_NAME\"", querylen - pos); + assert(pos < querylen); } + /* debug: fprintf(stdout, "SQLTables query (pos: %zu, len: %zu):\n%s\n\n", pos, strlen(query), query); */ + /* query the MonetDB data dictionary tables */ rc = MNDBExecDirect(stmt, (SQLCHAR *) query, SQL_NTS); _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org