Changeset: b45e66c324d6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b45e66c324d6
Modified Files:
        clients/odbc/driver/ODBCQueries.h
        clients/odbc/driver/SQLSpecialColumns.c
Branch: Dec2023
Log Message:

Correct output of columns TYPE_NAME, COLUMN_SIZE, BUFFER_LENGTH and 
SQL_DATA_TYPE of ODBC functions SQLColumns(), SQLSpecialColumns and 
SQLProcedureColumns() when column type is json or url or uuid or xml.


diffs (78 lines):

diff --git a/clients/odbc/driver/ODBCQueries.h 
b/clients/odbc/driver/ODBCQueries.h
--- a/clients/odbc/driver/ODBCQueries.h
+++ b/clients/odbc/driver/ODBCQueries.h
@@ -79,6 +79,7 @@
                     "when 'double' then 'DOUBLE' "                             
                \
                     "when 'hugeint' then 'HUGEINT' "                           
        \
                     "when 'int' then 'INTEGER' "                               
                \
+                    "when 'json' then 'JSON' "                                 
        \
                     "when 'month_interval' then "                              
                \
                          "case " #t ".type_digits "                            
                \
                               "when 1 then 'INTERVAL YEAR' "                   
        \
@@ -105,7 +106,10 @@
                     "when 'timestamptz' then 'TIMESTAMP' "                     
        \
                     "when 'timetz' then 'TIME' "                               
                \
                     "when 'tinyint' then 'TINYINT' "                           
        \
+                    "when 'url' then 'URL' "                                   
        \
+                    "when 'uuid' then 'UUID' "                                 
        \
                     "when 'varchar' then 'VARCHAR' "                           
        \
+                    "when 'xml' then 'XML' "                                   
        \
                "end as \"TYPE_NAME\""
 
 #define COLUMN_SIZE(t)                                                 \
@@ -135,6 +139,7 @@
                     "when 'timestamp' then 23 "                \
                     "when 'timestamptz' then 23 "              \
                     "when 'timetz' then 12 "                   \
+                    "when 'uuid' then 36 "                     \
                     "else " #t ".type_digits "                 \
                "end as \"COLUMN_SIZE\""
 
@@ -147,6 +152,7 @@
                     "when 'double' then 24 "                                   
        \
                     "when 'hugeint' then 40 "                                  
        \
                     "when 'int' then 11 "                                      
                \
+                    "when 'json' then 2 * " #t ".type_digits "         \
                     "when 'month_interval' then "                              
        \
                          "case " #t ".type_digits "                            
        \
                               "when 1 then 26 "                                
                \
@@ -173,7 +179,10 @@
                     "when 'timestamptz' then 23 "                              
        \
                     "when 'timetz' then 12 "                                   
        \
                     "when 'tinyint' then 4 "                                   
        \
+                    "when 'url' then 2 * " #t ".type_digits "          \
+                    "when 'uuid' then 36 "                                     
        \
                     "when 'varchar' then 2 * " #t ".type_digits "      \
+                    "when 'xml' then 2 * " #t ".type_digits "          \
                     "else " #t ".type_digits "                                 
        \
                "end as integer) as \"BUFFER_LENGTH\""
 
@@ -242,6 +251,7 @@
                     "when 'timestamptz' then %d "              \
                     "when 'timetz' then %d "                   \
                     "when 'tinyint' then %d "                  \
+                    "when 'uuid' then %d "                     \
                     "when 'varchar' then %d "                  \
                "end as \"SQL_DATA_TYPE\""
 #define SQL_DATA_TYPE_ARGS                                                     
                                        \
@@ -249,7 +259,7 @@
                SQL_WLONGVARCHAR, SQL_DATETIME, SQL_INTERVAL, SQL_DECIMAL, 
SQL_DOUBLE, \
                SQL_HUGEINT, SQL_INTEGER, SQL_INTERVAL, SQL_REAL,               
                \
                SQL_INTERVAL, SQL_SMALLINT, SQL_DATETIME, SQL_DATETIME,         
        \
-               SQL_DATETIME, SQL_DATETIME, SQL_TINYINT, SQL_WVARCHAR
+               SQL_DATETIME, SQL_DATETIME, SQL_TINYINT, SQL_GUID, SQL_WVARCHAR
 
 #define SQL_DATETIME_SUB(t)                                            \
                "case " #t ".type "                                             
\
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
@@ -207,7 +207,7 @@ MNDBSpecialColumns(ODBCStmt *stmt,
                }
 
                /* construct the query */
-               querylen = 6000 + (sch ? strlen(sch) : 0) + (tab ? strlen(tab) 
: 0);
+               querylen = 6100 + (sch ? strlen(sch) : 0) + (tab ? strlen(tab) 
: 0);
                query = malloc(querylen);
                if (query == NULL)
                        goto nomem;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to