Changeset: f592033933d0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f592033933d0
Modified Files:
        clients/odbc/driver/SQLTables.c
        clients/odbc/tests/ODBCmetadata.c
Branch: default
Log Message:

Add test of SQLTables() where table types names are enclosed by single quotes.


diffs (44 lines):

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
@@ -196,7 +196,10 @@ MNDBTables(ODBCStmt *stmt,
                }
 
                if (NameLength4 > 0) {
-                       /* filtering requested on table type */
+                       /* filtering requested on table type(s)
+                        * each table type can be enclosed in single quotation 
marks (')
+                        * or unquoted, for example, 'TABLE', 'VIEW' or TABLE, 
VIEW.
+                        */
                        char buf[32];   /* the longest string is "GLOBAL 
TEMPORARY TABLE" */
                        int i;
                        size_t j;
diff --git a/clients/odbc/tests/ODBCmetadata.c 
b/clients/odbc/tests/ODBCmetadata.c
--- a/clients/odbc/tests/ODBCmetadata.c
+++ b/clients/odbc/tests/ODBCmetadata.c
@@ -431,7 +431,24 @@ main(int argc, char **argv)
                "NULL   odbctst pk2c    TABLE   NULL\n"
                "NULL   odbctst pk_uc   TABLE   NULL\n");
 
-       // All user tables and views
+       // All user tables and views in schema odbctst
+       ret = SQLTables(stmt, (SQLCHAR*)"", SQL_NTS,
+                       (SQLCHAR*)"odbctst", SQL_NTS, (SQLCHAR*)"%", SQL_NTS,
+                       (SQLCHAR*)"'TABLE' , 'VIEW'", SQL_NTS); // using quotes 
around the type names
+       compareResult(stmt, ret, "SQLTables (odbctst, %, 'TABLE' , 'VIEW')",
+               "Resultset with 5 columns\n"
+               "Resultset with 7 rows\n"
+               "TABLE_CAT      TABLE_SCHEM     TABLE_NAME      TABLE_TYPE      
REMARKS\n"
+               "WVARCHAR(1)    WVARCHAR(1024)  WVARCHAR(1024)  WVARCHAR(25)    
WVARCHAR(65000)\n"
+               "NULL   odbctst CUSTOMERS       TABLE   NULL\n"
+               "NULL   odbctst LINES   TABLE   NULL\n"
+               "NULL   odbctst ORDERS  TABLE   NULL\n"
+               "NULL   odbctst fk2c    TABLE   NULL\n"
+               "NULL   odbctst nopk_twoucs     TABLE   NULL\n"
+               "NULL   odbctst pk2c    TABLE   NULL\n"
+               "NULL   odbctst pk_uc   TABLE   NULL\n");
+
+       // All user tables and views in all schemas
        ret = SQLTables(stmt, (SQLCHAR*)"", SQL_NTS,
                        (SQLCHAR*)"%", SQL_NTS, (SQLCHAR*)"%", SQL_NTS,
                        (SQLCHAR*)"TABLE, VIEW, GLOBAL TEMPORARY TABLE, LOCAL 
TEMPORARY TABLE", SQL_NTS);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to