LCOV - code coverage report
Current view: top level - clients/odbc/samples - testgetinfo.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 36 75 48.0 %
Date: 2021-10-13 02:24:04 Functions: 2 3 66.7 %

          Line data    Source code
       1             : /*
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       5             :  *
       6             :  * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
       7             :  */
       8             : 
       9             : #ifdef _MSC_VER
      10             : #include <WTypes.h>
      11             : #endif
      12             : #include <stdio.h>
      13             : #include <stdlib.h>
      14             : #include <stdint.h>
      15             : #include <stdbool.h>
      16             : #include <string.h>
      17             : 
      18             : /**** Define the ODBC Version this ODBC driver complies with ****/
      19             : /* also see ODBCGlobal.h */
      20             : #define ODBCVER 0x0352          /* Important: this must be defined before include of sqlext.h */
      21             : 
      22             : #include <sql.h>
      23             : #include <sqlext.h>
      24             : 
      25             : static void
      26           0 : prerr(SQLSMALLINT tpe, SQLHANDLE hnd, const char *func, const char *pref)
      27             : {
      28             :         SQLCHAR state[6];
      29             :         SQLINTEGER errnr;
      30             :         SQLCHAR msg[256];
      31             :         SQLSMALLINT msglen;
      32             : 
      33           0 :         switch (SQLGetDiagRec(tpe, hnd, 1, state, &errnr, msg, sizeof(msg), &msglen)) {
      34           0 :         case SQL_SUCCESS_WITH_INFO:
      35           0 :                 if (msglen >= (signed int) sizeof(msg))
      36           0 :                         fprintf(stderr, "(message truncated)\n");
      37             :                 /* fall through */
      38             :         case SQL_SUCCESS:
      39           0 :                 fprintf(stderr, "%s: %s: SQLstate %s, Errnr %d, Message %s\n", func, pref, (char*)state, (int)errnr, (char*)msg);
      40           0 :                 break;
      41           0 :         case SQL_INVALID_HANDLE:
      42           0 :                 fprintf(stderr, "%s: %s, invalid handle passed to error function\n", func, pref);
      43           0 :                 break;
      44           0 :         case SQL_ERROR:
      45           0 :                 fprintf(stderr, "%s: %s, unexpected error from SQLGetDiagRec\n", func, pref);
      46           0 :                 break;
      47             :         case SQL_NO_DATA:
      48             :                 break;
      49           0 :         default:
      50           0 :                 fprintf(stderr, "%s: %s, weird return value from SQLGetDiagRec\n", func, pref);
      51           0 :                 break;
      52             :         }
      53           0 : }
      54             : 
      55             : static bool
      56         168 : check(SQLRETURN ret, SQLSMALLINT tpe, SQLHANDLE hnd, const char *func)
      57             : {
      58         168 :         switch (ret) {
      59             :         case SQL_SUCCESS:
      60             :                 return true;
      61           0 :         case SQL_SUCCESS_WITH_INFO:
      62           0 :                 prerr(tpe, hnd, func, "Info");
      63           0 :                 return true;
      64           0 :         case SQL_ERROR:
      65           0 :                 prerr(tpe, hnd, func, "Error");
      66           0 :                 break;
      67           0 :         case SQL_INVALID_HANDLE:
      68           0 :                 fprintf(stderr, "%s: Error: invalid handle\n", func);
      69           0 :                 exit(1);
      70           0 :         default:
      71           0 :                 fprintf(stderr, "%s: Unexpected return value\n", func);
      72           0 :                 break;
      73             :         }
      74             :         return false;
      75             : }
      76             : 
      77             : const struct {
      78             :         SQLUSMALLINT info;
      79             :         enum {
      80             :                 STRING,
      81             :                 INTEGER,
      82             :                 SHORTINT,
      83             :         } type;
      84             :         char *name;
      85             :         union {
      86             :                 char *str;
      87             :                 SQLUSMALLINT s;
      88             :                 SQLUINTEGER i;
      89             :         };
      90             : } sqlinfo[] = {
      91             :         {
      92             :                 .info = SQL_ACCESSIBLE_PROCEDURES,
      93             :                 .name = "SQL_ACCESSIBLE_PROCEDURES",
      94             :                 .type = STRING,
      95             :                 .str = "N",
      96             :         },
      97             :         {
      98             :                 .info = SQL_ACCESSIBLE_TABLES,
      99             :                 .name = "SQL_ACCESSIBLE_TABLES",
     100             :                 .type = STRING,
     101             :                 .str = "N",
     102             :         },
     103             :         {
     104             :                 .info = SQL_AGGREGATE_FUNCTIONS,
     105             :                 .name = "SQL_AGGREGATE_FUNCTIONS",
     106             :                 .type = INTEGER,
     107             :                 .i = SQL_AF_ALL | SQL_AF_AVG | SQL_AF_COUNT | SQL_AF_DISTINCT | SQL_AF_MAX | SQL_AF_MIN | SQL_AF_SUM,
     108             :         },
     109             :         {
     110             :                 .info = SQL_ALTER_DOMAIN,
     111             :                 .name = "SQL_ALTER_DOMAIN",
     112             :                 .type = INTEGER,
     113             :                 .i = 0,
     114             :         },
     115             :         {
     116             :                 .info = SQL_ALTER_TABLE,
     117             :                 .name = "SQL_ALTER_TABLE",
     118             :                 .type = INTEGER,
     119             :                 .i = SQL_AT_ADD_COLUMN | SQL_AT_ADD_COLUMN_DEFAULT | SQL_AT_ADD_COLUMN_SINGLE | SQL_AT_ADD_CONSTRAINT | SQL_AT_ADD_TABLE_CONSTRAINT | SQL_AT_CONSTRAINT_NAME_DEFINITION | SQL_AT_DROP_COLUMN | SQL_AT_DROP_COLUMN_CASCADE | SQL_AT_DROP_COLUMN_DEFAULT | SQL_AT_DROP_COLUMN_RESTRICT | SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE | SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT | SQL_AT_SET_COLUMN_DEFAULT,
     120             :         },
     121             : #ifdef SQL_ASYNC_DBC_FUNCTIONS
     122             :         {
     123             :                 .info = SQL_ASYNC_DBC_FUNCTIONS,
     124             :                 .name = "SQL_ASYNC_DBC_FUNCTIONS",
     125             :                 .type = INTEGER,
     126             :                 .i = 0,
     127             :         },
     128             : #endif
     129             :         {
     130             :                 .info = SQL_ASYNC_MODE,
     131             :                 .name = "SQL_ASYNC_MODE",
     132             :                 .type = INTEGER,
     133             :                 .i = SQL_AM_NONE,
     134             :         },
     135             : #ifdef SQL_ASYNC_NOTIFICATION
     136             :         {
     137             :                 .info = SQL_ASYNC_NOTIFICATION,
     138             :                 .name = "SQL_ASYNC_NOTIFICATION",
     139             :                 .type = INTEGER,
     140             :                 .i = 0,
     141             :         },
     142             : #endif
     143             :         {
     144             :                 .info = SQL_BATCH_ROW_COUNT,
     145             :                 .name = "SQL_BATCH_ROW_COUNT",
     146             :                 .type = INTEGER,
     147             :                 .i = SQL_BRC_EXPLICIT,
     148             :         },
     149             :         {
     150             :                 .info = SQL_BATCH_SUPPORT,
     151             :                 .name = "SQL_BATCH_SUPPORT",
     152             :                 .type = INTEGER,
     153             :                 .i = SQL_BS_SELECT_EXPLICIT | SQL_BS_ROW_COUNT_EXPLICIT,
     154             :         },
     155             :         {
     156             :                 .info = SQL_BOOKMARK_PERSISTENCE,
     157             :                 .name = "SQL_BOOKMARK_PERSISTENCE",
     158             :                 .type = INTEGER,
     159             :                 .i = 0,
     160             :         },
     161             :         {
     162             :                 .info = SQL_CATALOG_LOCATION,
     163             :                 .name = "SQL_CATALOG_LOCATION",
     164             :                 .type = SHORTINT,
     165             :                 .s = 0,
     166             :         },
     167             :         {
     168             :                 .info = SQL_CATALOG_NAME,
     169             :                 .name = "SQL_CATALOG_NAME",
     170             :                 .type = STRING,
     171             :                 .str = "N",
     172             :         },
     173             :         {
     174             :                 .info = SQL_CATALOG_NAME_SEPARATOR,
     175             :                 .name = "SQL_CATALOG_NAME_SEPARATOR",
     176             :                 .type = STRING,
     177             :                 .str = "",
     178             :         },
     179             :         {
     180             :                 .info = SQL_CATALOG_TERM,
     181             :                 .name = "SQL_CATALOG_TERM",
     182             :                 .type = STRING,
     183             :                 .str = "",
     184             :         },
     185             :         {
     186             :                 .info = SQL_CATALOG_USAGE,
     187             :                 .name = "SQL_CATALOG_USAGE",
     188             :                 .type = INTEGER,
     189             :                 .i = 0,
     190             :         },
     191             :         {
     192             :                 .info = SQL_COLLATION_SEQ,
     193             :                 .name = "SQL_COLLATION_SEQ",
     194             :                 .type = STRING,
     195             :                 .str = "UTF-8",
     196             :         },
     197             :         {
     198             :                 .info = SQL_COLUMN_ALIAS,
     199             :                 .name = "SQL_COLUMN_ALIAS",
     200             :                 .type = STRING,
     201             :                 .str = "Y",
     202             :         },
     203             :         {
     204             :                 .info = SQL_CONCAT_NULL_BEHAVIOR,
     205             :                 .name = "SQL_CONCAT_NULL_BEHAVIOR",
     206             :                 .type = SHORTINT,
     207             :                 .s = SQL_CB_NULL,
     208             :         },
     209             :         {
     210             :                 .info = SQL_CONVERT_BIGINT,
     211             :                 .name = "SQL_CONVERT_BIGINT",
     212             :                 .type = INTEGER,
     213             :                 .i = SQL_CVT_BIGINT | SQL_CVT_BIT | SQL_CVT_CHAR | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_YEAR_MONTH | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     214             :         },
     215             :         {
     216             :                 .info = SQL_CONVERT_BINARY,
     217             :                 .name = "SQL_CONVERT_BINARY",
     218             :                 .type = INTEGER,
     219             :                 .i = SQL_CVT_BINARY | SQL_CVT_CHAR | SQL_CVT_LONGVARBINARY | SQL_CVT_LONGVARCHAR | SQL_CVT_VARBINARY | SQL_CVT_VARCHAR,
     220             :         },
     221             :         {
     222             :                 .info = SQL_CONVERT_BIT,
     223             :                 .name = "SQL_CONVERT_BIT",
     224             :                 .type = INTEGER,
     225             :                 .i = SQL_CVT_BIGINT | SQL_CVT_BIT | SQL_CVT_CHAR | SQL_CVT_INTEGER | SQL_CVT_LONGVARCHAR | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     226             :         },
     227             :         {
     228             :                 .info = SQL_CONVERT_CHAR,
     229             :                 .name = "SQL_CONVERT_CHAR",
     230             :                 .type = INTEGER,
     231             :                 .i = SQL_CVT_BIGINT | SQL_CVT_BINARY | SQL_CVT_BIT | SQL_CVT_GUID | SQL_CVT_CHAR | SQL_CVT_DATE | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_YEAR_MONTH | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARBINARY | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_TINYINT | SQL_CVT_VARBINARY | SQL_CVT_VARCHAR,
     232             :         },
     233             :         {
     234             :                 .info = SQL_CONVERT_DATE,
     235             :                 .name = "SQL_CONVERT_DATE",
     236             :                 .type = INTEGER,
     237             :                 .i = SQL_CVT_CHAR | SQL_CVT_DATE | SQL_CVT_LONGVARCHAR | SQL_CVT_TIMESTAMP | SQL_CVT_VARCHAR,
     238             :         },
     239             :         {
     240             :                 .info = SQL_CONVERT_DECIMAL,
     241             :                 .name = "SQL_CONVERT_DECIMAL",
     242             :                 .type = INTEGER,
     243             :                 .i = SQL_CVT_BIGINT | SQL_CVT_CHAR | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     244             :         },
     245             :         {
     246             :                 .info = SQL_CONVERT_DOUBLE,
     247             :                 .name = "SQL_CONVERT_DOUBLE",
     248             :                 .type = INTEGER,
     249             :                 .i = SQL_CVT_BIGINT | SQL_CVT_CHAR | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     250             :         },
     251             :         {
     252             :                 .info = SQL_CONVERT_FLOAT,
     253             :                 .name = "SQL_CONVERT_FLOAT",
     254             :                 .type = INTEGER,
     255             :                 .i = SQL_CVT_BIGINT | SQL_CVT_CHAR | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     256             :         },
     257             :         {
     258             :                 .info = SQL_CONVERT_FUNCTIONS,
     259             :                 .name = "SQL_CONVERT_FUNCTIONS",
     260             :                 .type = INTEGER,
     261             :                 .i = SQL_FN_CVT_CAST | SQL_FN_CVT_CONVERT,
     262             :         },
     263             :         {
     264             :                 .info = SQL_CONVERT_INTEGER,
     265             :                 .name = "SQL_CONVERT_INTEGER",
     266             :                 .type = INTEGER,
     267             :                 .i = SQL_CVT_BIGINT | SQL_CVT_BIT | SQL_CVT_CHAR | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_YEAR_MONTH | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     268             :         },
     269             :         {
     270             :                 .info = SQL_CONVERT_INTERVAL_DAY_TIME,
     271             :                 .name = "SQL_CONVERT_INTERVAL_DAY_TIME",
     272             :                 .type = INTEGER,
     273             :                 .i = SQL_CVT_BIGINT | SQL_CVT_CHAR | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARCHAR | SQL_CVT_SMALLINT | SQL_CVT_TIME | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     274             :         },
     275             :         {
     276             :                 .info = SQL_CONVERT_INTERVAL_YEAR_MONTH,
     277             :                 .name = "SQL_CONVERT_INTERVAL_YEAR_MONTH",
     278             :                 .type = INTEGER,
     279             :                 .i = SQL_CVT_BIGINT | SQL_CVT_CHAR | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_YEAR_MONTH | SQL_CVT_LONGVARCHAR | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     280             :         },
     281             :         {
     282             :                 .info = SQL_CONVERT_LONGVARBINARY,
     283             :                 .name = "SQL_CONVERT_LONGVARBINARY",
     284             :                 .type = INTEGER,
     285             :                 .i = SQL_CVT_BINARY | SQL_CVT_CHAR | SQL_CVT_LONGVARBINARY | SQL_CVT_LONGVARCHAR | SQL_CVT_VARBINARY | SQL_CVT_VARCHAR,
     286             :         },
     287             :         {
     288             :                 .info = SQL_CONVERT_LONGVARCHAR,
     289             :                 .name = "SQL_CONVERT_LONGVARCHAR",
     290             :                 .type = INTEGER,
     291             :                 .i = SQL_CVT_BIGINT | SQL_CVT_BINARY | SQL_CVT_BIT | SQL_CVT_GUID | SQL_CVT_CHAR | SQL_CVT_DATE | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_YEAR_MONTH | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARBINARY | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_TINYINT | SQL_CVT_VARBINARY | SQL_CVT_VARCHAR,
     292             :         },
     293             :         {
     294             :                 .info = SQL_CONVERT_NUMERIC,
     295             :                 .name = "SQL_CONVERT_NUMERIC",
     296             :                 .type = INTEGER,
     297             :                 .i = SQL_CVT_BIGINT | SQL_CVT_CHAR | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     298             :         },
     299             :         {
     300             :                 .info = SQL_CONVERT_REAL,
     301             :                 .name = "SQL_CONVERT_REAL",
     302             :                 .type = INTEGER,
     303             :                 .i = SQL_CVT_BIGINT | SQL_CVT_CHAR | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     304             :         },
     305             :         {
     306             :                 .info = SQL_CONVERT_SMALLINT,
     307             :                 .name = "SQL_CONVERT_SMALLINT",
     308             :                 .type = INTEGER,
     309             :                 .i = SQL_CVT_BIGINT | SQL_CVT_BIT | SQL_CVT_CHAR | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_YEAR_MONTH | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     310             :         },
     311             :         {
     312             :                 .info = SQL_CONVERT_TIME,
     313             :                 .name = "SQL_CONVERT_TIME",
     314             :                 .type = INTEGER,
     315             :                 .i = SQL_CVT_CHAR | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARCHAR | SQL_CVT_TIME | SQL_CVT_VARCHAR,
     316             :         },
     317             :         {
     318             :                 .info = SQL_CONVERT_TIMESTAMP,
     319             :                 .name = "SQL_CONVERT_TIMESTAMP",
     320             :                 .type = INTEGER,
     321             :                 .i = SQL_CVT_CHAR | SQL_CVT_DATE | SQL_CVT_LONGVARCHAR | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_VARCHAR,
     322             :         },
     323             :         {
     324             :                 .info = SQL_CONVERT_TINYINT,
     325             :                 .name = "SQL_CONVERT_TINYINT",
     326             :                 .type = INTEGER,
     327             :                 .i = SQL_CVT_BIGINT | SQL_CVT_BIT | SQL_CVT_CHAR | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_YEAR_MONTH | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TINYINT | SQL_CVT_VARCHAR,
     328             :         },
     329             :         {
     330             :                 .info = SQL_CONVERT_VARBINARY,
     331             :                 .name = "SQL_CONVERT_VARBINARY",
     332             :                 .type = INTEGER,
     333             :                 .i = SQL_CVT_BINARY | SQL_CVT_CHAR | SQL_CVT_LONGVARBINARY | SQL_CVT_LONGVARCHAR | SQL_CVT_VARBINARY | SQL_CVT_VARCHAR,
     334             :         },
     335             :         {
     336             :                 .info = SQL_CONVERT_VARCHAR,
     337             :                 .name = "SQL_CONVERT_VARCHAR",
     338             :                 .type = INTEGER,
     339             :                 .i = SQL_CVT_BIGINT | SQL_CVT_BINARY | SQL_CVT_BIT | SQL_CVT_GUID | SQL_CVT_CHAR | SQL_CVT_DATE | SQL_CVT_DECIMAL | SQL_CVT_DOUBLE | SQL_CVT_FLOAT | SQL_CVT_INTEGER | SQL_CVT_INTERVAL_YEAR_MONTH | SQL_CVT_INTERVAL_DAY_TIME | SQL_CVT_LONGVARBINARY | SQL_CVT_LONGVARCHAR | SQL_CVT_NUMERIC | SQL_CVT_REAL | SQL_CVT_SMALLINT | SQL_CVT_TIME | SQL_CVT_TIMESTAMP | SQL_CVT_TINYINT | SQL_CVT_VARBINARY | SQL_CVT_VARCHAR,
     340             :         },
     341             :         {
     342             :                 .info = SQL_CORRELATION_NAME,
     343             :                 .name = "SQL_CORRELATION_NAME",
     344             :                 .type = SHORTINT,
     345             :                 .s = SQL_CN_ANY,
     346             :         },
     347             :         {
     348             :                 .info = SQL_CREATE_ASSERTION,
     349             :                 .name = "SQL_CREATE_ASSERTION",
     350             :                 .type = INTEGER,
     351             :                 .i = 0,
     352             :         },
     353             :         {
     354             :                 .info = SQL_CREATE_CHARACTER_SET,
     355             :                 .name = "SQL_CREATE_CHARACTER_SET",
     356             :                 .type = INTEGER,
     357             :                 .i = 0,
     358             :         },
     359             :         {
     360             :                 .info = SQL_CREATE_COLLATION,
     361             :                 .name = "SQL_CREATE_COLLATION",
     362             :                 .type = INTEGER,
     363             :                 .i = 0,
     364             :         },
     365             :         {
     366             :                 .info = SQL_CREATE_DOMAIN,
     367             :                 .name = "SQL_CREATE_DOMAIN",
     368             :                 .type = INTEGER,
     369             :                 .i = 0,
     370             :         },
     371             :         {
     372             :                 .info = SQL_CREATE_SCHEMA,
     373             :                 .name = "SQL_CREATE_SCHEMA",
     374             :                 .type = INTEGER,
     375             :                 .i = SQL_CS_CREATE_SCHEMA | SQL_CS_AUTHORIZATION,
     376             :         },
     377             :         {
     378             :                 .info = SQL_CREATE_TABLE,
     379             :                 .name = "SQL_CREATE_TABLE",
     380             :                 .type = INTEGER,
     381             :                 .i = SQL_CT_CREATE_TABLE | SQL_CT_TABLE_CONSTRAINT | SQL_CT_CONSTRAINT_NAME_DEFINITION | SQL_CT_COMMIT_PRESERVE | SQL_CT_COMMIT_DELETE | SQL_CT_GLOBAL_TEMPORARY | SQL_CT_LOCAL_TEMPORARY | SQL_CT_COLUMN_CONSTRAINT | SQL_CT_COLUMN_DEFAULT,
     382             :         },
     383             :         {
     384             :                 .info = SQL_CREATE_TRANSLATION,
     385             :                 .name = "SQL_CREATE_TRANSLATION",
     386             :                 .type = INTEGER,
     387             :                 .i = 0,
     388             :         },
     389             :         {
     390             :                 .info = SQL_CREATE_VIEW,
     391             :                 .name = "SQL_CREATE_VIEW",
     392             :                 .type = INTEGER,
     393             :                 .i = SQL_CV_CREATE_VIEW | SQL_CV_CHECK_OPTION,
     394             :         },
     395             :         {
     396             :                 .info = SQL_CURSOR_COMMIT_BEHAVIOR,
     397             :                 .name = "SQL_CURSOR_COMMIT_BEHAVIOR",
     398             :                 .type = SHORTINT,
     399             :                 .s = SQL_CB_DELETE,
     400             :         },
     401             :         {
     402             :                 .info = SQL_CURSOR_ROLLBACK_BEHAVIOR,
     403             :                 .name = "SQL_CURSOR_ROLLBACK_BEHAVIOR",
     404             :                 .type = SHORTINT,
     405             :                 .s = SQL_CB_DELETE,
     406             :         },
     407             :         {
     408             :                 .info = SQL_CURSOR_SENSITIVITY,
     409             :                 .name = "SQL_CURSOR_SENSITIVITY",
     410             :                 .type = INTEGER,
     411             :                 .i = SQL_INSENSITIVE,
     412             :         },
     413             :         {
     414             :                 .info = SQL_DATA_SOURCE_NAME,
     415             :                 .name = "SQL_DATA_SOURCE_NAME",
     416             :                 .type = STRING,
     417             :                 .str = "MonetDB-Test",
     418             :         },
     419             :         {
     420             :                 .info = SQL_DATA_SOURCE_READ_ONLY,
     421             :                 .name = "SQL_DATA_SOURCE_READ_ONLY",
     422             :                 .type = STRING,
     423             :                 .str = "N",
     424             :         },
     425             :         {
     426             :                 .info = SQL_DATABASE_NAME,
     427             :                 .name = "SQL_DATABASE_NAME",
     428             :                 .type = STRING,
     429             :                 .str = "mTests_sql_odbc_samples",
     430             :         },
     431             :         {
     432             :                 .info = SQL_DATETIME_LITERALS,
     433             :                 .name = "SQL_DATETIME_LITERALS",
     434             :                 .type = INTEGER,
     435             :                 .i = SQL_DL_SQL92_DATE | SQL_DL_SQL92_TIME | SQL_DL_SQL92_TIMESTAMP | SQL_DL_SQL92_INTERVAL_YEAR | SQL_DL_SQL92_INTERVAL_MONTH | SQL_DL_SQL92_INTERVAL_DAY | SQL_DL_SQL92_INTERVAL_HOUR | SQL_DL_SQL92_INTERVAL_MINUTE | SQL_DL_SQL92_INTERVAL_SECOND | SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH | SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR | SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE | SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND | SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE | SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND | SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND,
     436             :         },
     437             :         {
     438             :                 .info = SQL_DBMS_NAME,
     439             :                 .name = "SQL_DBMS_NAME",
     440             :                 .type = STRING,
     441             :                 .str = "MonetDB",
     442             :         },
     443             :         {
     444             :                 .info = SQL_DBMS_VER,
     445             :                 .name = "SQL_DBMS_VER",
     446             :                 .type = STRING,
     447             :                 .str = NULL,
     448             :         },
     449             :         {
     450             :                 .info = SQL_DDL_INDEX,
     451             :                 .name = "SQL_DDL_INDEX",
     452             :                 .type = INTEGER,
     453             :                 .i = 3,
     454             :         },
     455             :         {
     456             :                 .info = SQL_DEFAULT_TXN_ISOLATION,
     457             :                 .name = "SQL_DEFAULT_TXN_ISOLATION",
     458             :                 .type = INTEGER,
     459             :                 .i = 8,
     460             :         },
     461             :         {
     462             :                 .info = SQL_DESCRIBE_PARAMETER,
     463             :                 .name = "SQL_DESCRIBE_PARAMETER",
     464             :                 .type = STRING,
     465             :                 .str = "N",
     466             :         },
     467             :         {
     468             :                 .info = SQL_DM_VER,
     469             :                 .name = "SQL_DM_VER",
     470             :                 .type = STRING,
     471             :                 .str = "03.52.0002.0003",
     472             :         },
     473             : #ifdef SQL_DRIVER_AWARE_POOLING_SUPPORTED
     474             :         {
     475             :                 .info = SQL_DRIVER_AWARE_POOLING_SUPPORTED,
     476             :                 .name = "SQL_DRIVER_AWARE_POOLING_SUPPORTED",
     477             :                 .type = INTEGER,
     478             :                 .i = 0,
     479             :         },
     480             : #endif
     481             :         {
     482             :                 .info = SQL_DRIVER_NAME,
     483             :                 .name = "SQL_DRIVER_NAME",
     484             :                 .type = STRING,
     485             :                 .str = "MonetDBODBClib",
     486             :         },
     487             :         {
     488             :                 .info = SQL_DRIVER_ODBC_VER,
     489             :                 .name = "SQL_DRIVER_ODBC_VER",
     490             :                 .type = STRING,
     491             :                 .str = "03.52",
     492             :         },
     493             :         {
     494             :                 .info = SQL_DRIVER_VER,
     495             :                 .name = "SQL_DRIVER_VER",
     496             :                 .type = STRING,
     497             :                 .str = NULL,
     498             :         },
     499             :         {
     500             :                 .info = SQL_DROP_ASSERTION,
     501             :                 .name = "SQL_DROP_ASSERTION",
     502             :                 .type = INTEGER,
     503             :                 .i = 0,
     504             :         },
     505             :         {
     506             :                 .info = SQL_DROP_CHARACTER_SET,
     507             :                 .name = "SQL_DROP_CHARACTER_SET",
     508             :                 .type = INTEGER,
     509             :                 .i = 0,
     510             :         },
     511             :         {
     512             :                 .info = SQL_DROP_COLLATION,
     513             :                 .name = "SQL_DROP_COLLATION",
     514             :                 .type = INTEGER,
     515             :                 .i = 0,
     516             :         },
     517             :         {
     518             :                 .info = SQL_DROP_DOMAIN,
     519             :                 .name = "SQL_DROP_DOMAIN",
     520             :                 .type = INTEGER,
     521             :                 .i = 0,
     522             :         },
     523             :         {
     524             :                 .info = SQL_DROP_SCHEMA,
     525             :                 .name = "SQL_DROP_SCHEMA",
     526             :                 .type = INTEGER,
     527             :                 .i = SQL_DS_DROP_SCHEMA | SQL_DS_CASCADE | SQL_DS_RESTRICT,
     528             :         },
     529             :         {
     530             :                 .info = SQL_DROP_TABLE,
     531             :                 .name = "SQL_DROP_TABLE",
     532             :                 .type = INTEGER,
     533             :                 .i = SQL_DT_DROP_TABLE | SQL_DT_CASCADE | SQL_DT_RESTRICT,
     534             :         },
     535             :         {
     536             :                 .info = SQL_DROP_TRANSLATION,
     537             :                 .name = "SQL_DROP_TRANSLATION",
     538             :                 .type = INTEGER,
     539             :                 .i = 0,
     540             :         },
     541             :         {
     542             :                 .info = SQL_DROP_VIEW,
     543             :                 .name = "SQL_DROP_VIEW",
     544             :                 .type = INTEGER,
     545             :                 .i = SQL_DV_DROP_VIEW | SQL_DV_CASCADE | SQL_DV_RESTRICT,
     546             :         },
     547             :         {
     548             :                 .info = SQL_DYNAMIC_CURSOR_ATTRIBUTES1,
     549             :                 .name = "SQL_DYNAMIC_CURSOR_ATTRIBUTES1",
     550             :                 .type = INTEGER,
     551             :                 .i = SQL_CA1_NEXT | SQL_CA1_ABSOLUTE | SQL_CA1_RELATIVE,
     552             :         },
     553             :         {
     554             :                 .info = SQL_DYNAMIC_CURSOR_ATTRIBUTES2,
     555             :                 .name = "SQL_DYNAMIC_CURSOR_ATTRIBUTES2",
     556             :                 .type = INTEGER,
     557             :                 .i = 0,
     558             :         },
     559             :         {
     560             :                 .info = SQL_EXPRESSIONS_IN_ORDERBY,
     561             :                 .name = "SQL_EXPRESSIONS_IN_ORDERBY",
     562             :                 .type = STRING,
     563             :                 .str = "Y",
     564             :         },
     565             :         {
     566             :                 .info = SQL_FILE_USAGE,
     567             :                 .name = "SQL_FILE_USAGE",
     568             :                 .type = SHORTINT,
     569             :                 .s = SQL_FILE_NOT_SUPPORTED,
     570             :         },
     571             :         {
     572             :                 .info = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1,
     573             :                 .name = "SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1",
     574             :                 .type = INTEGER,
     575             :                 .i = SQL_CA1_NEXT,
     576             :         },
     577             :         {
     578             :                 .info = SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2,
     579             :                 .name = "SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2",
     580             :                 .type = INTEGER,
     581             :                 .i = 0,
     582             :         },
     583             :         {
     584             :                 .info = SQL_GETDATA_EXTENSIONS,
     585             :                 .name = "SQL_GETDATA_EXTENSIONS",
     586             :                 .type = INTEGER,
     587             :                 .i = SQL_GD_ANY_COLUMN | SQL_GD_ANY_ORDER | SQL_GD_BLOCK | SQL_GD_BOUND,
     588             :         },
     589             :         {
     590             :                 .info = SQL_GROUP_BY,
     591             :                 .name = "SQL_GROUP_BY",
     592             :                 .type = SHORTINT,
     593             :                 .s = SQL_GB_NO_RELATION,
     594             :         },
     595             :         {
     596             :                 .info = SQL_IDENTIFIER_CASE,
     597             :                 .name = "SQL_IDENTIFIER_CASE",
     598             :                 .type = SHORTINT,
     599             :                 .s = SQL_IC_LOWER,
     600             :         },
     601             :         {
     602             :                 .info = SQL_IDENTIFIER_QUOTE_CHAR,
     603             :                 .name = "SQL_IDENTIFIER_QUOTE_CHAR",
     604             :                 .type = STRING,
     605             :                 .str = "\"",
     606             :         },
     607             :         {
     608             :                 .info = SQL_INDEX_KEYWORDS,
     609             :                 .name = "SQL_INDEX_KEYWORDS",
     610             :                 .type = INTEGER,
     611             :                 .i = SQL_IK_NONE,
     612             :         },
     613             :         {
     614             :                 .info = SQL_INFO_SCHEMA_VIEWS,
     615             :                 .name = "SQL_INFO_SCHEMA_VIEWS",
     616             :                 .type = INTEGER,
     617             :                 .i = 0,
     618             :         },
     619             :         {
     620             :                 .info = SQL_INSERT_STATEMENT,
     621             :                 .name = "SQL_INSERT_STATEMENT",
     622             :                 .type = INTEGER,
     623             :                 .i = SQL_IS_INSERT_LITERALS | SQL_IS_INSERT_SEARCHED | SQL_IS_SELECT_INTO,
     624             :         },
     625             :         {
     626             :                 .info = SQL_INTEGRITY,
     627             :                 .name = "SQL_INTEGRITY",
     628             :                 .type = STRING,
     629             :                 .str = "N",
     630             :         },
     631             :         {
     632             :                 .info = SQL_KEYSET_CURSOR_ATTRIBUTES1,
     633             :                 .name = "SQL_KEYSET_CURSOR_ATTRIBUTES1",
     634             :                 .type = INTEGER,
     635             :                 .i = 0,
     636             :         },
     637             :         {
     638             :                 .info = SQL_KEYSET_CURSOR_ATTRIBUTES2,
     639             :                 .name = "SQL_KEYSET_CURSOR_ATTRIBUTES2",
     640             :                 .type = INTEGER,
     641             :                 .i = 0,
     642             :         },
     643             :         {
     644             :                 .info = SQL_KEYWORDS,
     645             :                 .name = "SQL_KEYWORDS",
     646             :                 .type = STRING,
     647             :                 .str = "ADD,ADMIN,AFTER,AGGREGATE,ALL,ALTER,ALWAYS,AND,ANY,ASYMMETRIC,ATOMIC,AUTO_INCREMENT,BEFORE,BEST,BIGINT,BIGSERIAL,BINARY,BLOB,CALL,CHAIN,CLOB,COMMITTED,COPY,CUME_DIST,CURRENT_ROLE,DELIMITERS,DENSE_RANK,DO,EACH,EFFORT,ELSEIF,ENCRYPTED,EVERY,EXCLUDE,FOLLOWING,FUNCTION,FWF,GENERATED,GEOMETRYCOLLECTION,GEOMETRYCOLLECTIONM,GEOMETRYCOLLECTIONZ,GEOMETRYCOLLECTIONZM,HUGEINT,IF,ILIKE,LATERAL,LIMIT,LINESTRING,LINESTRINGM,LINESTRINGZ,LINESTRINGZM,LOADER,LOCALTIME,LOCALTIMESTAMP,LOCKED,MEDIUMINT,MERGE,MULTILINESTRING,MULTILINESTRINGM,MULTILINESTRINGZ,MULTILINESTRINGZM,MULTIPOINT,MULTIPOINTM,MULTIPOINTZ,MULTIPOINTZM,MULTIPOLYGON,MULTIPOLYGONM,MULTIPOLYGONZ,MULTIPOLYGONZM,NEW,NOCYCLE,NOMAXVALUE,NOMINVALUE,NOW,OFFSET,OLD,ORDERED,OTHERS,OVER,PARTITION,PERCENT_RANK,POINT,POINTM,POINTZ,POINTZM,POLYGON,POLYGONM,POLYGONZ,POLYGONZM,PRECEDING,RANGE,RANK,RECORDS,REFERENCING,REMOTE,RENAME,REPEATABLE,REPLICA,RESTART,RETURN,RETURNS,ROW_NUMBER,SAMPLE,SAVEPOINT,SEQUENCE,SERIAL,SERIALIZABLE,SIMPLE,SPLIT_PART,STDIN,STDOUT,STREAM,STRING,SYMMETRIC,TIES,TINYINT,TRIGGER,TRUNCATE,UNBOUNDED,UNCOMMITTED,UNENCRYPTED,WHILE,WINDOW,XMLAGG,XMLATTRIBUTES,XMLCOMMENT,XMLCONCAT,XMLDOCUMENT,XMLELEMENT,XMLFOREST,XMLNAMESPACES,XMLPARSE,XMLPI,XMLQUERY,XMLSCHEMA,XMLTEXT,XMLVALIDATE",
     648             :         },
     649             :         {
     650             :                 .info = SQL_LIKE_ESCAPE_CLAUSE,
     651             :                 .name = "SQL_LIKE_ESCAPE_CLAUSE",
     652             :                 .type = STRING,
     653             :                 .str = "Y",
     654             :         },
     655             :         {
     656             :                 .info = SQL_MAX_ASYNC_CONCURRENT_STATEMENTS,
     657             :                 .name = "SQL_MAX_ASYNC_CONCURRENT_STATEMENTS",
     658             :                 .type = INTEGER,
     659             :                 .i = 0,
     660             :         },
     661             :         {
     662             :                 .info = SQL_MAX_BINARY_LITERAL_LEN,
     663             :                 .name = "SQL_MAX_BINARY_LITERAL_LEN",
     664             :                 .type = INTEGER,
     665             :                 .i = 0,
     666             :         },
     667             :         {
     668             :                 .info = SQL_MAX_CATALOG_NAME_LEN,
     669             :                 .name = "SQL_MAX_CATALOG_NAME_LEN",
     670             :                 .type = SHORTINT,
     671             :                 .s = 0,
     672             :         },
     673             :         {
     674             :                 .info = SQL_MAX_CHAR_LITERAL_LEN,
     675             :                 .name = "SQL_MAX_CHAR_LITERAL_LEN",
     676             :                 .type = INTEGER,
     677             :                 .i = 0,
     678             :         },
     679             :         {
     680             :                 .info = SQL_MAX_COLUMN_NAME_LEN,
     681             :                 .name = "SQL_MAX_COLUMN_NAME_LEN",
     682             :                 .type = SHORTINT,
     683             :                 .s = 1024,
     684             :         },
     685             :         {
     686             :                 .info = SQL_MAX_COLUMNS_IN_GROUP_BY,
     687             :                 .name = "SQL_MAX_COLUMNS_IN_GROUP_BY",
     688             :                 .type = SHORTINT,
     689             :                 .s = 0,
     690             :         },
     691             :         {
     692             :                 .info = SQL_MAX_COLUMNS_IN_INDEX,
     693             :                 .name = "SQL_MAX_COLUMNS_IN_INDEX",
     694             :                 .type = SHORTINT,
     695             :                 .s = 0,
     696             :         },
     697             :         {
     698             :                 .info = SQL_MAX_COLUMNS_IN_ORDER_BY,
     699             :                 .name = "SQL_MAX_COLUMNS_IN_ORDER_BY",
     700             :                 .type = SHORTINT,
     701             :                 .s = 0,
     702             :         },
     703             :         {
     704             :                 .info = SQL_MAX_COLUMNS_IN_SELECT,
     705             :                 .name = "SQL_MAX_COLUMNS_IN_SELECT",
     706             :                 .type = SHORTINT,
     707             :                 .s = 0,
     708             :         },
     709             :         {
     710             :                 .info = SQL_MAX_COLUMNS_IN_TABLE,
     711             :                 .name = "SQL_MAX_COLUMNS_IN_TABLE",
     712             :                 .type = SHORTINT,
     713             :                 .s = 0,
     714             :         },
     715             :         {
     716             :                 .info = SQL_MAX_CURSOR_NAME_LEN,
     717             :                 .name = "SQL_MAX_CURSOR_NAME_LEN",
     718             :                 .type = SHORTINT,
     719             :                 .s = 0,
     720             :         },
     721             :         {
     722             :                 .info = SQL_MAX_DRIVER_CONNECTIONS,
     723             :                 .name = "SQL_MAX_DRIVER_CONNECTIONS",
     724             :                 .type = SHORTINT,
     725             :                 .s = 64,
     726             :         },
     727             :         {
     728             :                 .info = SQL_MAX_IDENTIFIER_LEN,
     729             :                 .name = "SQL_MAX_IDENTIFIER_LEN",
     730             :                 .type = SHORTINT,
     731             :                 .s = 1024,
     732             :         },
     733             :         {
     734             :                 .info = SQL_MAX_INDEX_SIZE,
     735             :                 .name = "SQL_MAX_INDEX_SIZE",
     736             :                 .type = INTEGER,
     737             :                 .i = 0,
     738             :         },
     739             :         {
     740             :                 .info = SQL_MAX_PROCEDURE_NAME_LEN,
     741             :                 .name = "SQL_MAX_PROCEDURE_NAME_LEN",
     742             :                 .type = SHORTINT,
     743             :                 .s = 256,
     744             :         },
     745             :         {
     746             :                 .info = SQL_MAX_ROW_SIZE,
     747             :                 .name = "SQL_MAX_ROW_SIZE",
     748             :                 .type = INTEGER,
     749             :                 .i = 0,
     750             :         },
     751             :         {
     752             :                 .info = SQL_MAX_ROW_SIZE_INCLUDES_LONG,
     753             :                 .name = "SQL_MAX_ROW_SIZE_INCLUDES_LONG",
     754             :                 .type = STRING,
     755             :                 .str = "Y",
     756             :         },
     757             :         {
     758             :                 .info = SQL_MAX_SCHEMA_NAME_LEN,
     759             :                 .name = "SQL_MAX_SCHEMA_NAME_LEN",
     760             :                 .type = SHORTINT,
     761             :                 .s = 1024,
     762             :         },
     763             :         {
     764             :                 .info = SQL_MAX_STATEMENT_LEN,
     765             :                 .name = "SQL_MAX_STATEMENT_LEN",
     766             :                 .type = INTEGER,
     767             :                 .i = 0,
     768             :         },
     769             :         {
     770             :                 .info = SQL_MAX_TABLE_NAME_LEN,
     771             :                 .name = "SQL_MAX_TABLE_NAME_LEN",
     772             :                 .type = SHORTINT,
     773             :                 .s = 1024,
     774             :         },
     775             :         {
     776             :                 .info = SQL_MAX_TABLES_IN_SELECT,
     777             :                 .name = "SQL_MAX_TABLES_IN_SELECT",
     778             :                 .type = SHORTINT,
     779             :                 .s = 0,
     780             :         },
     781             :         {
     782             :                 .info = SQL_MAX_USER_NAME_LEN,
     783             :                 .name = "SQL_MAX_USER_NAME_LEN",
     784             :                 .type = SHORTINT,
     785             :                 .s = 1024,
     786             :         },
     787             :         {
     788             :                 .info = SQL_MULTIPLE_ACTIVE_TXN,
     789             :                 .name = "SQL_MULTIPLE_ACTIVE_TXN",
     790             :                 .type = STRING,
     791             :                 .str = "Y",
     792             :         },
     793             :         {
     794             :                 .info = SQL_MULT_RESULT_SETS,
     795             :                 .name = "SQL_MULT_RESULT_SETS",
     796             :                 .type = STRING,
     797             :                 .str = "Y",
     798             :         },
     799             :         {
     800             :                 .info = SQL_NEED_LONG_DATA_LEN,
     801             :                 .name = "SQL_NEED_LONG_DATA_LEN",
     802             :                 .type = STRING,
     803             :                 .str = "N",
     804             :         },
     805             :         {
     806             :                 .info = SQL_NON_NULLABLE_COLUMNS,
     807             :                 .name = "SQL_NON_NULLABLE_COLUMNS",
     808             :                 .type = SHORTINT,
     809             :                 .s = SQL_NNC_NON_NULL,
     810             :         },
     811             :         {
     812             :                 .info = SQL_NULL_COLLATION,
     813             :                 .name = "SQL_NULL_COLLATION",
     814             :                 .type = SHORTINT,
     815             :                 .s = SQL_NC_LOW,
     816             :         },
     817             :         {
     818             :                 .info = SQL_NUMERIC_FUNCTIONS,
     819             :                 .name = "SQL_NUMERIC_FUNCTIONS",
     820             :                 .type = INTEGER,
     821             :                 .i = SQL_FN_NUM_ABS | SQL_FN_NUM_ACOS | SQL_FN_NUM_ASIN | SQL_FN_NUM_ATAN | SQL_FN_NUM_ATAN2 | SQL_FN_NUM_CEILING | SQL_FN_NUM_COS | SQL_FN_NUM_COT | SQL_FN_NUM_DEGREES | SQL_FN_NUM_EXP | SQL_FN_NUM_FLOOR | SQL_FN_NUM_LOG | SQL_FN_NUM_LOG10 | SQL_FN_NUM_MOD | SQL_FN_NUM_PI | SQL_FN_NUM_POWER | SQL_FN_NUM_RADIANS | SQL_FN_NUM_RAND | SQL_FN_NUM_ROUND | SQL_FN_NUM_SIGN | SQL_FN_NUM_SIN | SQL_FN_NUM_SQRT | SQL_FN_NUM_TAN | SQL_FN_NUM_TRUNCATE,
     822             :         },
     823             :         {
     824             :                 .info = SQL_ODBC_INTERFACE_CONFORMANCE,
     825             :                 .name = "SQL_ODBC_INTERFACE_CONFORMANCE",
     826             :                 .type = INTEGER,
     827             :                 .i = SQL_OIC_CORE,
     828             :         },
     829             :         {
     830             :                 .info = SQL_ODBC_VER,
     831             :                 .name = "SQL_ODBC_VER",
     832             :                 .type = STRING,
     833             :                 .str = "03.52",
     834             :         },
     835             :         {
     836             :                 .info = SQL_OJ_CAPABILITIES,
     837             :                 .name = "SQL_OJ_CAPABILITIES",
     838             :                 .type = INTEGER,
     839             :                 .i = SQL_OJ_LEFT | SQL_OJ_RIGHT | SQL_OJ_FULL | SQL_OJ_NOT_ORDERED | SQL_OJ_INNER | SQL_OJ_ALL_COMPARISON_OPS,
     840             :         },
     841             :         {
     842             :                 .info = SQL_ORDER_BY_COLUMNS_IN_SELECT,
     843             :                 .name = "SQL_ORDER_BY_COLUMNS_IN_SELECT",
     844             :                 .type = STRING,
     845             :                 .str = "N",
     846             :         },
     847             :         {
     848             :                 .info = SQL_PARAM_ARRAY_ROW_COUNTS,
     849             :                 .name = "SQL_PARAM_ARRAY_ROW_COUNTS",
     850             :                 .type = INTEGER,
     851             :                 .i = SQL_PARC_BATCH,
     852             :         },
     853             :         {
     854             :                 .info = SQL_POS_OPERATIONS,
     855             :                 .name = "SQL_POS_OPERATIONS",
     856             :                 .type = INTEGER,
     857             :                 .i = SQL_POS_POSITION,
     858             :         },
     859             :         {
     860             :                 .info = SQL_PROCEDURES,
     861             :                 .name = "SQL_PROCEDURES",
     862             :                 .type = STRING,
     863             :                 .str = "Y",
     864             :         },
     865             :         {
     866             :                 .info = SQL_PROCEDURE_TERM,
     867             :                 .name = "SQL_PROCEDURE_TERM",
     868             :                 .type = STRING,
     869             :                 .str = "procedure",
     870             :         },
     871             :         {
     872             :                 .info = SQL_QUOTED_IDENTIFIER_CASE,
     873             :                 .name = "SQL_QUOTED_IDENTIFIER_CASE",
     874             :                 .type = SHORTINT,
     875             :                 .s = SQL_IC_SENSITIVE,
     876             :         },
     877             :         {
     878             :                 .info = SQL_ROW_UPDATES,
     879             :                 .name = "SQL_ROW_UPDATES",
     880             :                 .type = STRING,
     881             :                 .str = "N",
     882             :         },
     883             :         {
     884             :                 .info = SQL_SCHEMA_TERM,
     885             :                 .name = "SQL_SCHEMA_TERM",
     886             :                 .type = STRING,
     887             :                 .str = "schema",
     888             :         },
     889             :         {
     890             :                 .info = SQL_SCHEMA_USAGE,
     891             :                 .name = "SQL_SCHEMA_USAGE",
     892             :                 .type = INTEGER,
     893             :                 .i = SQL_SU_DML_STATEMENTS | SQL_SU_PROCEDURE_INVOCATION | SQL_SU_TABLE_DEFINITION | SQL_SU_INDEX_DEFINITION | SQL_SU_PRIVILEGE_DEFINITION,
     894             :         },
     895             :         {
     896             :                 .info = SQL_SCROLL_OPTIONS,
     897             :                 .name = "SQL_SCROLL_OPTIONS",
     898             :                 .type = INTEGER,
     899             :                 .i = SQL_SO_STATIC,
     900             :         },
     901             :         {
     902             :                 .info = SQL_SEARCH_PATTERN_ESCAPE,
     903             :                 .name = "SQL_SEARCH_PATTERN_ESCAPE",
     904             :                 .type = STRING,
     905             :                 .str = "\\",
     906             :         },
     907             :         {
     908             :                 .info = SQL_SERVER_NAME,
     909             :                 .name = "SQL_SERVER_NAME",
     910             :                 .type = STRING,
     911             :                 .str = "MonetDB",
     912             :         },
     913             :         {
     914             :                 .info = SQL_SPECIAL_CHARACTERS,
     915             :                 .name = "SQL_SPECIAL_CHARACTERS",
     916             :                 .type = STRING,
     917             :                 .str = "!$&'()*+,-./:;<=>?@[]^`{|}~",
     918             :         },
     919             :         {
     920             :                 .info = SQL_SQL_CONFORMANCE,
     921             :                 .name = "SQL_SQL_CONFORMANCE",
     922             :                 .type = INTEGER,
     923             :                 .i = SQL_SC_SQL92_FULL,
     924             :         },
     925             :         {
     926             :                 .info = SQL_SQL92_DATETIME_FUNCTIONS,
     927             :                 .name = "SQL_SQL92_DATETIME_FUNCTIONS",
     928             :                 .type = INTEGER,
     929             :                 .i = SQL_SDF_CURRENT_DATE | SQL_SDF_CURRENT_TIME | SQL_SDF_CURRENT_TIMESTAMP,
     930             :         },
     931             :         {
     932             :                 .info = SQL_SQL92_FOREIGN_KEY_DELETE_RULE,
     933             :                 .name = "SQL_SQL92_FOREIGN_KEY_DELETE_RULE",
     934             :                 .type = INTEGER,
     935             :                 .i = SQL_SFKD_CASCADE | SQL_SFKD_NO_ACTION | SQL_SFKD_SET_DEFAULT | SQL_SFKD_SET_NULL,
     936             :         },
     937             :         {
     938             :                 .info = SQL_SQL92_FOREIGN_KEY_UPDATE_RULE,
     939             :                 .name = "SQL_SQL92_FOREIGN_KEY_UPDATE_RULE",
     940             :                 .type = INTEGER,
     941             :                 .i = SQL_SFKU_CASCADE | SQL_SFKU_NO_ACTION | SQL_SFKU_SET_DEFAULT | SQL_SFKU_SET_NULL,
     942             :         },
     943             :         {
     944             :                 .info = SQL_SQL92_GRANT,
     945             :                 .name = "SQL_SQL92_GRANT",
     946             :                 .type = INTEGER,
     947             :                 .i = SQL_SG_DELETE_TABLE | SQL_SG_INSERT_COLUMN | SQL_SG_INSERT_TABLE | SQL_SG_REFERENCES_TABLE | SQL_SG_REFERENCES_COLUMN | SQL_SG_SELECT_TABLE | SQL_SG_UPDATE_COLUMN | SQL_SG_UPDATE_TABLE | SQL_SG_WITH_GRANT_OPTION,
     948             :         },
     949             :         {
     950             :                 .info = SQL_SQL92_NUMERIC_VALUE_FUNCTIONS,
     951             :                 .name = "SQL_SQL92_NUMERIC_VALUE_FUNCTIONS",
     952             :                 .type = INTEGER,
     953             :                 .i = SQL_SNVF_CHAR_LENGTH | SQL_SNVF_CHARACTER_LENGTH | SQL_SNVF_EXTRACT | SQL_SNVF_OCTET_LENGTH | SQL_SNVF_POSITION,
     954             :         },
     955             :         {
     956             :                 .info = SQL_SQL92_PREDICATES,
     957             :                 .name = "SQL_SQL92_PREDICATES",
     958             :                 .type = INTEGER,
     959             :                 .i = SQL_SP_BETWEEN | SQL_SP_COMPARISON | SQL_SP_EXISTS | SQL_SP_IN | SQL_SP_ISNOTNULL | SQL_SP_ISNULL | SQL_SP_LIKE | SQL_SP_MATCH_FULL | SQL_SP_MATCH_PARTIAL | SQL_SP_MATCH_UNIQUE_FULL | SQL_SP_MATCH_UNIQUE_PARTIAL | SQL_SP_OVERLAPS | SQL_SP_QUANTIFIED_COMPARISON | SQL_SP_UNIQUE,
     960             :         },
     961             :         {
     962             :                 .info = SQL_SQL92_RELATIONAL_JOIN_OPERATORS,
     963             :                 .name = "SQL_SQL92_RELATIONAL_JOIN_OPERATORS",
     964             :                 .type = INTEGER,
     965             :                 .i = SQL_SRJO_CORRESPONDING_CLAUSE | SQL_SRJO_CROSS_JOIN | SQL_SRJO_EXCEPT_JOIN | SQL_SRJO_FULL_OUTER_JOIN | SQL_SRJO_INNER_JOIN | SQL_SRJO_INTERSECT_JOIN | SQL_SRJO_LEFT_OUTER_JOIN | SQL_SRJO_NATURAL_JOIN | SQL_SRJO_RIGHT_OUTER_JOIN | SQL_SRJO_UNION_JOIN,
     966             :         },
     967             :         {
     968             :                 .info = SQL_SQL92_REVOKE,
     969             :                 .name = "SQL_SQL92_REVOKE",
     970             :                 .type = INTEGER,
     971             :                 .i = SQL_SR_DELETE_TABLE | SQL_SR_GRANT_OPTION_FOR | SQL_SR_INSERT_COLUMN | SQL_SR_INSERT_TABLE | SQL_SR_REFERENCES_COLUMN | SQL_SR_REFERENCES_TABLE | SQL_SR_SELECT_TABLE | SQL_SR_UPDATE_COLUMN | SQL_SR_UPDATE_TABLE,
     972             :         },
     973             :         {
     974             :                 .info = SQL_SQL92_ROW_VALUE_CONSTRUCTOR,
     975             :                 .name = "SQL_SQL92_ROW_VALUE_CONSTRUCTOR",
     976             :                 .type = INTEGER,
     977             :                 .i = SQL_SRVC_VALUE_EXPRESSION | SQL_SRVC_NULL | SQL_SRVC_DEFAULT | SQL_SRVC_ROW_SUBQUERY,
     978             :         },
     979             :         {
     980             :                 .info = SQL_SQL92_STRING_FUNCTIONS,
     981             :                 .name = "SQL_SQL92_STRING_FUNCTIONS",
     982             :                 .type = INTEGER,
     983             :                 .i = SQL_SSF_CONVERT | SQL_SSF_LOWER | SQL_SSF_UPPER | SQL_SSF_SUBSTRING | SQL_SSF_TRIM_BOTH | SQL_SSF_TRIM_LEADING | SQL_SSF_TRIM_TRAILING,
     984             :         },
     985             :         {
     986             :                 .info = SQL_SQL92_VALUE_EXPRESSIONS,
     987             :                 .name = "SQL_SQL92_VALUE_EXPRESSIONS",
     988             :                 .type = INTEGER,
     989             :                 .i = SQL_SVE_CASE | SQL_SVE_CAST | SQL_SVE_COALESCE | SQL_SVE_NULLIF,
     990             :         },
     991             :         {
     992             :                 .info = SQL_STANDARD_CLI_CONFORMANCE,
     993             :                 .name = "SQL_STANDARD_CLI_CONFORMANCE",
     994             :                 .type = INTEGER,
     995             :                 .i = SQL_SCC_XOPEN_CLI_VERSION1 | SQL_SCC_ISO92_CLI,
     996             :         },
     997             :         {
     998             :                 .info = SQL_STATIC_CURSOR_ATTRIBUTES1,
     999             :                 .name = "SQL_STATIC_CURSOR_ATTRIBUTES1",
    1000             :                 .type = INTEGER,
    1001             :                 .i = SQL_CA1_NEXT | SQL_CA1_ABSOLUTE | SQL_CA1_RELATIVE,
    1002             :         },
    1003             :         {
    1004             :                 .info = SQL_STATIC_CURSOR_ATTRIBUTES2,
    1005             :                 .name = "SQL_STATIC_CURSOR_ATTRIBUTES2",
    1006             :                 .type = INTEGER,
    1007             :                 .i = 0,
    1008             :         },
    1009             :         {
    1010             :                 .info = SQL_STRING_FUNCTIONS,
    1011             :                 .name = "SQL_STRING_FUNCTIONS",
    1012             :                 .type = INTEGER,
    1013             :                 .i = SQL_FN_STR_ASCII | SQL_FN_STR_CHAR | SQL_FN_STR_CHARACTER_LENGTH | SQL_FN_STR_CHAR_LENGTH | SQL_FN_STR_CONCAT | SQL_FN_STR_DIFFERENCE | SQL_FN_STR_INSERT | SQL_FN_STR_LCASE | SQL_FN_STR_LEFT | SQL_FN_STR_LENGTH | SQL_FN_STR_LOCATE | SQL_FN_STR_LOCATE_2 | SQL_FN_STR_LTRIM | SQL_FN_STR_OCTET_LENGTH | SQL_FN_STR_POSITION | SQL_FN_STR_REPEAT | SQL_FN_STR_REPLACE | SQL_FN_STR_RIGHT | SQL_FN_STR_RTRIM | SQL_FN_STR_SOUNDEX | SQL_FN_STR_SPACE | SQL_FN_STR_SUBSTRING | SQL_FN_STR_UCASE,
    1014             :         },
    1015             :         {
    1016             :                 .info = SQL_SUBQUERIES,
    1017             :                 .name = "SQL_SUBQUERIES",
    1018             :                 .type = INTEGER,
    1019             :                 .i = SQL_SQ_CORRELATED_SUBQUERIES | SQL_SQ_COMPARISON | SQL_SQ_EXISTS | SQL_SQ_IN | SQL_SQ_QUANTIFIED,
    1020             :         },
    1021             :         {
    1022             :                 .info = SQL_SYSTEM_FUNCTIONS,
    1023             :                 .name = "SQL_SYSTEM_FUNCTIONS",
    1024             :                 .type = INTEGER,
    1025             :                 .i = SQL_FN_SYS_DBNAME | SQL_FN_SYS_IFNULL | SQL_FN_SYS_USERNAME,
    1026             :         },
    1027             :         {
    1028             :                 .info = SQL_TABLE_TERM,
    1029             :                 .name = "SQL_TABLE_TERM",
    1030             :                 .type = STRING,
    1031             :                 .str = "table",
    1032             :         },
    1033             :         {
    1034             :                 .info = SQL_TIMEDATE_ADD_INTERVALS,
    1035             :                 .name = "SQL_TIMEDATE_ADD_INTERVALS",
    1036             :                 .type = INTEGER,
    1037             :                 .i = 0,
    1038             :         },
    1039             :         {
    1040             :                 .info = SQL_TIMEDATE_DIFF_INTERVALS,
    1041             :                 .name = "SQL_TIMEDATE_DIFF_INTERVALS",
    1042             :                 .type = INTEGER,
    1043             :                 .i = 0,
    1044             :         },
    1045             :         {
    1046             :                 .info = SQL_TIMEDATE_FUNCTIONS,
    1047             :                 .name = "SQL_TIMEDATE_FUNCTIONS",
    1048             :                 .type = INTEGER,
    1049             :                 .i = SQL_FN_TD_CURRENT_DATE | SQL_FN_TD_CURRENT_TIME | SQL_FN_TD_CURRENT_TIMESTAMP | SQL_FN_TD_CURDATE | SQL_FN_TD_CURTIME | SQL_FN_TD_DAYOFMONTH | SQL_FN_TD_DAYOFWEEK | SQL_FN_TD_DAYOFYEAR | SQL_FN_TD_EXTRACT | SQL_FN_TD_HOUR | SQL_FN_TD_MINUTE | SQL_FN_TD_MONTH | SQL_FN_TD_NOW | SQL_FN_TD_QUARTER | SQL_FN_TD_SECOND | SQL_FN_TD_WEEK | SQL_FN_TD_YEAR,
    1050             :         },
    1051             :         {
    1052             :                 .info = SQL_TXN_CAPABLE,
    1053             :                 .name = "SQL_TXN_CAPABLE",
    1054             :                 .type = SHORTINT,
    1055             :                 .s = SQL_TC_ALL,
    1056             :         },
    1057             :         {
    1058             :                 .info = SQL_TXN_ISOLATION_OPTION,
    1059             :                 .name = "SQL_TXN_ISOLATION_OPTION",
    1060             :                 .type = INTEGER,
    1061             :                 .i = SQL_TXN_SERIALIZABLE,
    1062             :         },
    1063             :         {
    1064             :                 .info = SQL_UNION,
    1065             :                 .name = "SQL_UNION",
    1066             :                 .type = INTEGER,
    1067             :                 .i = SQL_U_UNION | SQL_U_UNION_ALL,
    1068             :         },
    1069             :         {
    1070             :                 .info = SQL_USER_NAME,
    1071             :                 .name = "SQL_USER_NAME",
    1072             :                 .type = STRING,
    1073             :                 .str = "monetdb",
    1074             :         },
    1075             :         {
    1076             :                 .info = SQL_XOPEN_CLI_YEAR,
    1077             :                 .name = "SQL_XOPEN_CLI_YEAR",
    1078             :                 .type = STRING,
    1079             :                 .str = "1995",
    1080             :         },
    1081             : };
    1082             : 
    1083             : int
    1084           1 : main(int argc, char **argv)
    1085             : {
    1086             :         SQLHANDLE env;
    1087             :         SQLHANDLE dbc;
    1088             :         char *dsn = "MonetDB";
    1089             :         char *user = "monetdb";
    1090             :         char *pass = "monetdb";
    1091             :         SQLRETURN ret;
    1092             :         char str[2048];
    1093             :         SQLSMALLINT resultlen;
    1094             :         SQLUSMALLINT s;
    1095             :         SQLUINTEGER i;
    1096             : 
    1097           1 :         if (argc > 1)
    1098           1 :                 dsn = argv[1];
    1099           1 :         if (argc > 2)
    1100           0 :                 user = argv[2];
    1101           1 :         if (argc > 3)
    1102           0 :                 pass = argv[3];
    1103           1 :         if (argc > 4 || *dsn == '-') {
    1104           0 :                 fprintf(stderr, "Usage: %s [datasource [user [password]]]\n", argv[0]);
    1105           0 :                 exit(1);
    1106             :         }
    1107             : 
    1108           1 :         if (SQLAllocHandle(SQL_HANDLE_ENV, NULL, &env) != SQL_SUCCESS) {
    1109           0 :                 fprintf(stderr, "Cannot allocate ODBC environment handle\n");
    1110           0 :                 exit(1);
    1111             :         }
    1112             : 
    1113           1 :         ret = SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) (uintptr_t) SQL_OV_ODBC3, 0);
    1114           1 :         check(ret, SQL_HANDLE_ENV, env, "SQLSetEnvAttr");
    1115             : 
    1116           1 :         ret = SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
    1117           1 :         check(ret, SQL_HANDLE_ENV, env, "SQLAllocHandle 1");
    1118             : 
    1119           1 :         ret = SQLConnect(dbc, (SQLCHAR *) dsn, SQL_NTS, (SQLCHAR *) user, SQL_NTS, (SQLCHAR *) pass, SQL_NTS);
    1120           1 :         if (!check(ret, SQL_HANDLE_DBC, dbc, "SQLConnect"))
    1121           0 :                 exit(1);
    1122             : 
    1123         163 :         for (size_t n = 0; n < sizeof(sqlinfo) / sizeof(sqlinfo[0]); n++) {
    1124         162 :                 switch (sqlinfo[n].type) {
    1125          38 :                 case STRING:
    1126          38 :                         ret = SQLGetInfo(dbc, sqlinfo[n].info, str, sizeof(str), &resultlen);
    1127          38 :                         if (check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo") &&
    1128          38 :                             sqlinfo[n].str &&
    1129          36 :                             strcmp(sqlinfo[n].str, str) != 0)
    1130           0 :                                 fprintf(stderr, "%s: expected: %s, received: %s\n", sqlinfo[n].name, sqlinfo[n].str, str);
    1131             :                         break;
    1132          97 :                 case INTEGER:
    1133          97 :                         ret = SQLGetInfo(dbc, sqlinfo[n].info, &i, sizeof(i), &resultlen);
    1134          97 :                         if (check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo") &&
    1135          97 :                             sqlinfo[n].i != i)
    1136           0 :                                 fprintf(stderr, "%s: expected: %u, received: %u\n", sqlinfo[n].name, (unsigned int) sqlinfo[n].i, (unsigned int) i);
    1137             :                         break;
    1138          27 :                 default:        /* case SHORTINT */
    1139          27 :                         ret = SQLGetInfo(dbc, sqlinfo[n].info, &s, sizeof(s), &resultlen);
    1140          27 :                         if (check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo") &&
    1141          27 :                             sqlinfo[n].s != s)
    1142           0 :                                 fprintf(stderr, "%s: expected: %u, received: %u\n", sqlinfo[n].name, (unsigned int) sqlinfo[n].s, (unsigned int) s);
    1143             :                         break;
    1144             :                 }
    1145             :         }
    1146             : 
    1147           1 :         ret = SQLDisconnect(dbc);
    1148           1 :         check(ret, SQL_HANDLE_DBC, dbc, "SQLDisconnect");
    1149             : 
    1150           1 :         ret = SQLFreeHandle(SQL_HANDLE_DBC, dbc);
    1151           1 :         check(ret, SQL_HANDLE_DBC, dbc, "SQLFreeHandle (DBC)");
    1152             : 
    1153           1 :         ret = SQLFreeHandle(SQL_HANDLE_ENV, env);
    1154           1 :         check(ret, SQL_HANDLE_ENV, env, "SQLFreeHandle (ENV)");
    1155             : 
    1156             :         return 0;
    1157             : }

Generated by: LCOV version 1.14