LCOV - code coverage report
Current view: top level - clients/odbc/driver - SQLGetInfo.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 242 663 36.5 %
Date: 2021-10-13 02:24:04 Functions: 1 2 50.0 %

          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             : /*
      10             :  * This code was created by Peter Harvey (mostly during Christmas 98/99).
      11             :  * This code is LGPL. Please ensure that this message remains in future
      12             :  * distributions and uses of this code (thats about all I get out of it).
      13             :  * - Peter Harvey pharvey@codebydesign.com
      14             :  *
      15             :  * This file has been modified for the MonetDB project.  See the file
      16             :  * Copyright in this directory for more information.
      17             :  */
      18             : 
      19             : /**********************************************************************
      20             :  * SQLGetInfo()
      21             :  * CLI Compliance: ISO 92
      22             :  *
      23             :  * Author: Martin van Dinther, Sjoerd Mullender
      24             :  * Date  : 30 Aug 2002
      25             :  *
      26             :  **********************************************************************/
      27             : 
      28             : #include "ODBCGlobal.h"
      29             : #include "ODBCDbc.h"
      30             : #include "ODBCUtil.h"
      31             : 
      32             : 
      33             : static SQLRETURN
      34         160 : MNDBGetInfo(ODBCDbc *dbc,
      35             :             SQLUSMALLINT InfoType,
      36             :             SQLPOINTER InfoValuePtr,
      37             :             SQLSMALLINT BufferLength,
      38             :             SQLSMALLINT *StringLengthPtr)
      39             : {
      40             :         int nValue = 0;
      41             :         char buf[64];
      42             :         const char *sValue = NULL;      /* iff non-NULL, return string value */
      43             :         int len = sizeof(SQLUINTEGER);  /* most common size to return */
      44             : 
      45             :         /* For some info types an active connection is needed */
      46         160 :         if (!dbc->Connected &&
      47           0 :             (InfoType == SQL_DATA_SOURCE_NAME ||
      48           0 :              InfoType == SQL_SERVER_NAME ||
      49           0 :              InfoType == SQL_DATABASE_NAME ||
      50           0 :              InfoType == SQL_USER_NAME)) {
      51             :                 /* Connection does not exist */
      52           0 :                 addDbcError(dbc, "08003", NULL, 0);
      53           0 :                 return SQL_ERROR;
      54             :         }
      55             : 
      56         160 :         switch (InfoType) {
      57           1 :         case SQL_ACCESSIBLE_PROCEDURES:
      58             :                 sValue = "N"; /* "Y" */
      59           1 :                 break;
      60           1 :         case SQL_ACCESSIBLE_TABLES:
      61             :                 sValue = "N"; /* "Y" */
      62           1 :                 break;
      63           0 :         case SQL_ACTIVE_ENVIRONMENTS:
      64             :                 nValue = 0;     /* 0 = no limit */
      65             :                 len = sizeof(SQLUSMALLINT);
      66           0 :                 break;
      67           1 :         case SQL_AGGREGATE_FUNCTIONS:
      68             :                 nValue = SQL_AF_ALL |
      69             :                         SQL_AF_AVG |
      70             :                         SQL_AF_COUNT |
      71             :                         SQL_AF_DISTINCT |
      72             :                         SQL_AF_MAX |
      73             :                         SQL_AF_MIN |
      74             :                         SQL_AF_SUM;
      75           1 :                 break;
      76             :         case SQL_ALTER_DOMAIN:
      77             :                 /* SQL_AD_ADD_CONSTRAINT_DEFERRABLE |
      78             :                  * SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED |
      79             :                  * SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE |
      80             :                  * SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE |
      81             :                  * SQL_AD_ADD_DOMAIN_CONSTRAINT |
      82             :                  * SQL_AD_ADD_DOMAIN_DEFAULT |
      83             :                  * SQL_AD_CONSTRAINT_NAME_DEFINITION |
      84             :                  * SQL_AD_DROP_DOMAIN_CONSTRAINT |
      85             :                  * SQL_AD_DROP_DOMAIN_DEFAULT */
      86             :                 break;
      87           1 :         case SQL_ALTER_TABLE:
      88             :                 nValue = SQL_AT_ADD_COLUMN | /* ODBC 2.0, deprecated value */
      89             :                         SQL_AT_ADD_COLUMN_DEFAULT |
      90             :                         SQL_AT_ADD_COLUMN_SINGLE |
      91             :                         SQL_AT_ADD_CONSTRAINT |
      92             :                         SQL_AT_ADD_TABLE_CONSTRAINT |
      93             :                         SQL_AT_CONSTRAINT_NAME_DEFINITION |
      94             :                         SQL_AT_DROP_COLUMN | /* ODBC 2.0, deprecated value */
      95             :                         SQL_AT_DROP_COLUMN_CASCADE |
      96             :                         SQL_AT_DROP_COLUMN_DEFAULT |
      97             :                         SQL_AT_DROP_COLUMN_RESTRICT |
      98             :                         SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE |
      99             :                         SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT |
     100             :                         SQL_AT_SET_COLUMN_DEFAULT;
     101             :                 /* SQL_AT_ADD_COLUMN_COLLATION |
     102             :                  * SQL_AT_CONSTRAINT_DEFERRABLE |
     103             :                  * SQL_AT_CONSTRAINT_INITIALLY_DEFERRED |
     104             :                  * SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE |
     105             :                  * SQL_AT_CONSTRAINT_NON_DEFERRABLE */
     106           1 :                 break;
     107             : #ifdef SQL_ASYNC_DBC_FUNCTIONS
     108             :         case SQL_ASYNC_DBC_FUNCTIONS:
     109             :                 nValue = SQL_ASYNC_DBC_NOT_CAPABLE;
     110             :                 /* SQL_ASYNC_DBC_CAPABLE */
     111             :                 break;
     112             : #endif
     113             :         case SQL_ASYNC_MODE:
     114             :                 nValue = SQL_AM_NONE;
     115             :                 /* SQL_AM_CONNECTION, SQL_AM_STATEMENT */
     116             :                 break;
     117             : #ifdef SQL_ASYNC_NOTIFICATION
     118             :         case SQL_ASYNC_NOTIFICATION:
     119             :                 nValue = SQL_ASYNC_NOTIFICATION_NOT_CAPABLE;
     120             :                 /* SQL_ASYNC_NOTIFICATION_CAPABLE */
     121             :                 break;
     122             : #endif
     123           1 :         case SQL_BATCH_ROW_COUNT:
     124             :                 nValue = SQL_BRC_EXPLICIT;
     125             :                 /* SQL_BRC_PROCEDURES | SQL_BRC_ROLLED_UP */
     126           1 :                 break;
     127           1 :         case SQL_BATCH_SUPPORT:
     128             :                 nValue = SQL_BS_ROW_COUNT_EXPLICIT | SQL_BS_SELECT_EXPLICIT;
     129             :                 /* SQL_BS_ROW_COUNT_PROC |
     130             :                  * SQL_BS_SELECT_PROC */
     131           1 :                 break;
     132             :         case SQL_BOOKMARK_PERSISTENCE:
     133             :                 /* SQL_BP_CLOSE |
     134             :                  * SQL_BP_DELETE |
     135             :                  * SQL_BP_DROP |
     136             :                  * SQL_BP_OTHER_HSTMT |
     137             :                  * SQL_BP_TRANSACTION |
     138             :                  * SQL_BP_UPDATE */
     139             :                 break;
     140           1 :         case SQL_CATALOG_LOCATION:
     141             :                 /* SQL_CL_END, SQL_CL_START */
     142             :                 len = sizeof(SQLUSMALLINT);
     143           1 :                 break;
     144           1 :         case SQL_CATALOG_NAME:
     145             :                 sValue = "N"; /* "Y" */
     146           1 :                 break;
     147           2 :         case SQL_CATALOG_NAME_SEPARATOR:
     148             :         case SQL_CATALOG_TERM:
     149             :                 sValue = "";
     150           2 :                 break;
     151             :         case SQL_CATALOG_USAGE:
     152             :                 /* SQL_CU_DML_STATEMENTS |
     153             :                  * SQL_CU_INDEX_DEFINITION |
     154             :                  * SQL_CU_PRIVILEGE_DEFINITION |
     155             :                  * SQL_CU_PROCEDURE_INVOCATION |
     156             :                  * SQL_CU_TABLE_DEFINITION */
     157             :                 break;
     158           1 :         case SQL_COLLATION_SEQ:
     159             :                 sValue = "UTF-8";
     160           1 :                 break;
     161           1 :         case SQL_COLUMN_ALIAS:
     162             :                 sValue = "Y"; /* "N" */
     163           1 :                 break;
     164           1 :         case SQL_CONCAT_NULL_BEHAVIOR:
     165             :                 nValue = SQL_CB_NULL;
     166             :                 /* SQL_CB_NON_NULL */
     167             :                 len = sizeof(SQLUSMALLINT);
     168           1 :                 break;
     169           4 :         case SQL_CONVERT_TINYINT:
     170             :         case SQL_CONVERT_SMALLINT:
     171             :         case SQL_CONVERT_INTEGER:
     172             :         case SQL_CONVERT_BIGINT:
     173             :                 nValue = SQL_CVT_BIGINT |
     174             :                         SQL_CVT_BIT |
     175             :                         SQL_CVT_CHAR |
     176             :                         SQL_CVT_DECIMAL |
     177             :                         SQL_CVT_DOUBLE |
     178             :                         SQL_CVT_FLOAT |
     179             :                         SQL_CVT_INTEGER |
     180             :                         SQL_CVT_INTERVAL_DAY_TIME |
     181             :                         SQL_CVT_INTERVAL_YEAR_MONTH |
     182             :                         SQL_CVT_LONGVARCHAR |
     183             :                         SQL_CVT_NUMERIC |
     184             :                         SQL_CVT_REAL |
     185             :                         SQL_CVT_SMALLINT |
     186             :                         SQL_CVT_TINYINT |
     187             :                         SQL_CVT_VARCHAR;
     188           4 :                 break;
     189           3 :         case SQL_CONVERT_BINARY:
     190             :         case SQL_CONVERT_LONGVARBINARY:
     191             :         case SQL_CONVERT_VARBINARY:
     192             :                 nValue = SQL_CVT_BINARY |
     193             :                         SQL_CVT_CHAR |
     194             :                         SQL_CVT_LONGVARBINARY |
     195             :                         SQL_CVT_LONGVARCHAR |
     196             :                         SQL_CVT_VARBINARY |
     197             :                         SQL_CVT_VARCHAR;
     198             :                 /* SQL_CVT_GUID */
     199           3 :                 break;
     200           1 :         case SQL_CONVERT_BIT:
     201             :                 nValue = SQL_CVT_BIGINT |
     202             :                         SQL_CVT_BIT |
     203             :                         SQL_CVT_CHAR |
     204             :                         SQL_CVT_INTEGER |
     205             :                         SQL_CVT_LONGVARCHAR |
     206             :                         SQL_CVT_SMALLINT |
     207             :                         SQL_CVT_TINYINT |
     208             :                         SQL_CVT_VARCHAR;
     209           1 :                 break;
     210           3 :         case SQL_CONVERT_CHAR:
     211             :         case SQL_CONVERT_VARCHAR:
     212             :         case SQL_CONVERT_LONGVARCHAR:
     213             :                 nValue = SQL_CVT_BIGINT |
     214             :                         SQL_CVT_BINARY |
     215             :                         SQL_CVT_BIT |
     216             :                         SQL_CVT_CHAR |
     217             :                         SQL_CVT_DATE |
     218             :                         SQL_CVT_DECIMAL |
     219             :                         SQL_CVT_DOUBLE |
     220             :                         SQL_CVT_FLOAT |
     221             :                         SQL_CVT_GUID |
     222             :                         SQL_CVT_INTEGER |
     223             :                         SQL_CVT_INTERVAL_DAY_TIME |
     224             :                         SQL_CVT_INTERVAL_YEAR_MONTH |
     225             :                         SQL_CVT_LONGVARBINARY |
     226             :                         SQL_CVT_LONGVARCHAR |
     227             :                         SQL_CVT_NUMERIC |
     228             :                         SQL_CVT_REAL |
     229             :                         SQL_CVT_SMALLINT |
     230             :                         SQL_CVT_TIME |
     231             :                         SQL_CVT_TIMESTAMP |
     232             :                         SQL_CVT_TINYINT |
     233             :                         SQL_CVT_VARBINARY |
     234             :                         SQL_CVT_VARCHAR;
     235           3 :                 break;
     236           1 :         case SQL_CONVERT_DATE:
     237             :                 nValue = SQL_CVT_CHAR |
     238             :                         SQL_CVT_DATE |
     239             :                         SQL_CVT_LONGVARCHAR |
     240             :                         SQL_CVT_TIMESTAMP |
     241             :                         SQL_CVT_VARCHAR;
     242           1 :                 break;
     243           2 :         case SQL_CONVERT_DECIMAL:
     244             :         case SQL_CONVERT_NUMERIC:
     245             :                 nValue = SQL_CVT_BIGINT |
     246             :                         SQL_CVT_CHAR |
     247             :                         SQL_CVT_DECIMAL |
     248             :                         SQL_CVT_DOUBLE |
     249             :                         SQL_CVT_FLOAT |
     250             :                         SQL_CVT_INTEGER |
     251             :                         SQL_CVT_INTERVAL_DAY_TIME |
     252             :                         SQL_CVT_LONGVARCHAR |
     253             :                         SQL_CVT_NUMERIC |
     254             :                         SQL_CVT_REAL |
     255             :                         SQL_CVT_SMALLINT |
     256             :                         SQL_CVT_TINYINT |
     257             :                         SQL_CVT_VARCHAR;
     258           2 :                 break;
     259           3 :         case SQL_CONVERT_DOUBLE:
     260             :         case SQL_CONVERT_REAL:
     261             :         case SQL_CONVERT_FLOAT:
     262             :                 nValue = SQL_CVT_BIGINT |
     263             :                         SQL_CVT_CHAR |
     264             :                         SQL_CVT_DECIMAL |
     265             :                         SQL_CVT_DOUBLE |
     266             :                         SQL_CVT_FLOAT |
     267             :                         SQL_CVT_INTEGER |
     268             :                         SQL_CVT_LONGVARCHAR |
     269             :                         SQL_CVT_NUMERIC |
     270             :                         SQL_CVT_REAL |
     271             :                         SQL_CVT_SMALLINT |
     272             :                         SQL_CVT_TINYINT |
     273             :                         SQL_CVT_VARCHAR;
     274           3 :                 break;
     275           1 :         case SQL_CONVERT_INTERVAL_DAY_TIME:
     276             :                 nValue = SQL_CVT_BIGINT |
     277             :                         SQL_CVT_CHAR |
     278             :                         SQL_CVT_INTEGER |
     279             :                         SQL_CVT_INTERVAL_DAY_TIME |
     280             :                         SQL_CVT_LONGVARCHAR |
     281             :                         SQL_CVT_SMALLINT |
     282             :                         SQL_CVT_TIME |
     283             :                         SQL_CVT_TINYINT |
     284             :                         SQL_CVT_VARCHAR;
     285           1 :                 break;
     286           1 :         case SQL_CONVERT_INTERVAL_YEAR_MONTH:
     287             :                 nValue = SQL_CVT_BIGINT |
     288             :                         SQL_CVT_CHAR |
     289             :                         SQL_CVT_INTEGER |
     290             :                         SQL_CVT_INTERVAL_YEAR_MONTH |
     291             :                         SQL_CVT_LONGVARCHAR |
     292             :                         SQL_CVT_SMALLINT |
     293             :                         SQL_CVT_TINYINT |
     294             :                         SQL_CVT_VARCHAR;
     295           1 :                 break;
     296           1 :         case SQL_CONVERT_TIME:
     297             :                 nValue = SQL_CVT_CHAR |
     298             :                         SQL_CVT_INTERVAL_DAY_TIME |
     299             :                         SQL_CVT_LONGVARCHAR |
     300             :                         SQL_CVT_TIME |
     301             :                         SQL_CVT_VARCHAR;
     302           1 :                 break;
     303           1 :         case SQL_CONVERT_TIMESTAMP:
     304             :                 nValue = SQL_CVT_CHAR |
     305             :                         SQL_CVT_DATE |
     306             :                         SQL_CVT_LONGVARCHAR |
     307             :                         SQL_CVT_TIME |
     308             :                         SQL_CVT_TIMESTAMP |
     309             :                         SQL_CVT_VARCHAR;
     310           1 :                 break;
     311           0 :         case SQL_CONVERT_GUID:
     312             :                 nValue =SQL_CVT_CHAR |
     313             :                         SQL_CVT_GUID |
     314             :                         SQL_CVT_LONGVARCHAR |
     315             :                         SQL_CVT_VARCHAR;
     316           0 :                 break;
     317           1 :         case SQL_CONVERT_FUNCTIONS:
     318             :                 nValue = SQL_FN_CVT_CAST | SQL_FN_CVT_CONVERT;
     319           1 :                 break;
     320           1 :         case SQL_CORRELATION_NAME:
     321             :                 nValue = SQL_CN_ANY;
     322             :                 /* SQL_CN_DIFFERENT, SQL_CN_NONE */
     323             :                 len = sizeof(SQLUSMALLINT);
     324           1 :                 break;
     325             :         case SQL_CREATE_ASSERTION:
     326             :                 /* SQL_CA_CREATE_ASSERTION |
     327             :                  * SQL_CA_CONSTRAINT_DEFERRABLE |
     328             :                  * SQL_CA_CONSTRAINT_INITIALLY_DEFERRED |
     329             :                  * SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE |
     330             :                  * SQL_CA_CONSTRAINT_NON_DEFERRABLE */
     331             :         case SQL_CREATE_CHARACTER_SET:
     332             :                 /* SQL_CCS_CREATE_CHARACTER_SET |
     333             :                  * SQL_CCS_COLLATE_CLAUSE |
     334             :                  * SQL_CCS_LIMITED_COLLATION */
     335             :         case SQL_CREATE_COLLATION:
     336             :                 /* SQL_CCOL_CREATE_COLLATION */
     337             :         case SQL_CREATE_DOMAIN:
     338             :                 /* SQL_CDO_CREATE_DOMAIN |
     339             :                  * SQL_CDO_CONSTRAINT_NAME_DEFINITION |
     340             :                  * SQL_CDO_DEFAULT |
     341             :                  * SQL_CDO_CONSTRAINT |
     342             :                  * SQL_CDO_COLLATION |
     343             :                  * SQL_CDO_CONSTRAINT_DEFERRABLE |
     344             :                  * SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED |
     345             :                  * SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE |
     346             :                  * SQL_CDO_CONSTRAINT_NON_DEFERRABLE */
     347             :         case SQL_CREATE_TRANSLATION:
     348             :                 /* SQL_CTR_CREATE_TRANSLATION */
     349             :                 break;
     350           1 :         case SQL_CREATE_SCHEMA:
     351             :                 nValue = SQL_CS_CREATE_SCHEMA | SQL_CS_AUTHORIZATION;
     352             :                 /* SQL_CS_DEFAULT_CHARACTER_SET */
     353           1 :                 break;
     354           1 :         case SQL_CREATE_TABLE:
     355             :                 nValue = SQL_CT_COLUMN_CONSTRAINT |
     356             :                         SQL_CT_COLUMN_DEFAULT |
     357             :                         SQL_CT_COMMIT_DELETE |
     358             :                         SQL_CT_COMMIT_PRESERVE |
     359             :                         SQL_CT_CONSTRAINT_NAME_DEFINITION |
     360             :                         SQL_CT_CREATE_TABLE |
     361             :                         SQL_CT_GLOBAL_TEMPORARY |
     362             :                         SQL_CT_LOCAL_TEMPORARY |
     363             :                         SQL_CT_TABLE_CONSTRAINT;
     364             :                 /* SQL_CT_COLUMN_COLLATION |
     365             :                  * SQL_CT_CONSTRAINT_DEFERRABLE |
     366             :                  * SQL_CT_CONSTRAINT_INITIALLY_DEFERRED |
     367             :                  * SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE |
     368             :                  * SQL_CT_CONSTRAINT_NON_DEFERRABLE */
     369           1 :                 break;
     370           1 :         case SQL_CREATE_VIEW:
     371             :                 nValue = SQL_CV_CREATE_VIEW | SQL_CV_CHECK_OPTION;
     372             :                 /* SQL_CV_CASCADE | SQL_CV_LOCAL */
     373           1 :                 break;
     374           4 :         case SQL_CURSOR_COMMIT_BEHAVIOR:
     375             :         case SQL_CURSOR_ROLLBACK_BEHAVIOR:
     376             :                 nValue = SQL_CB_DELETE;
     377             :                 /* SQL_CB_CLOSE, SQL_CB_DELETE, SQL_CB_PRESERVE */
     378             :                 len = sizeof(SQLUSMALLINT);
     379           4 :                 break;
     380           1 :         case SQL_CURSOR_SENSITIVITY:
     381             :                 nValue = SQL_INSENSITIVE;
     382             :                 /* SQL_SENSITIVE, SQL_UNSPECIFIED */
     383           1 :                 break;
     384           0 :         case SQL_DATA_SOURCE_NAME:
     385           0 :                 sValue = dbc->dsn ? dbc->dsn : "";
     386             :                 break;
     387           1 :         case SQL_DATA_SOURCE_READ_ONLY:
     388             :                 sValue = "N"; /* "Y" */
     389           1 :                 break;
     390           1 :         case SQL_DATABASE_NAME:
     391           1 :                 sValue = dbc->dbname ? dbc->dbname : "";
     392             :                 break;
     393           1 :         case SQL_DATETIME_LITERALS:
     394             :                 nValue = SQL_DL_SQL92_DATE |
     395             :                         SQL_DL_SQL92_TIME |
     396             :                         SQL_DL_SQL92_TIMESTAMP |
     397             :                         SQL_DL_SQL92_INTERVAL_YEAR |
     398             :                         SQL_DL_SQL92_INTERVAL_MONTH |
     399             :                         SQL_DL_SQL92_INTERVAL_DAY |
     400             :                         SQL_DL_SQL92_INTERVAL_HOUR |
     401             :                         SQL_DL_SQL92_INTERVAL_MINUTE |
     402             :                         SQL_DL_SQL92_INTERVAL_SECOND |
     403             :                         SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH |
     404             :                         SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR |
     405             :                         SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE |
     406             :                         SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND |
     407             :                         SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE |
     408             :                         SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND |
     409             :                         SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND;
     410             :                 len = sizeof(SQLINTEGER);
     411           1 :                 break;
     412           1 :         case SQL_DBMS_NAME:
     413             :                 sValue = "MonetDB";
     414           1 :                 break;
     415           1 :         case SQL_DBMS_VER:
     416           1 :                 snprintf(buf, sizeof(buf), "%02d.%02d.%04d",
     417           1 :                          dbc->major, dbc->minor, dbc->patch);
     418             :                 sValue = buf;
     419           1 :                 break;
     420           1 :         case SQL_DDL_INDEX:
     421             :                 nValue = SQL_DI_CREATE_INDEX | SQL_DI_DROP_INDEX;
     422           1 :                 break;
     423           1 :         case SQL_DEFAULT_TXN_ISOLATION:
     424             :                 nValue = SQL_TXN_SERIALIZABLE;
     425           1 :                 break;
     426           1 :         case SQL_DESCRIBE_PARAMETER:
     427             :                 sValue = "N"; /* "Y" */
     428           1 :                 break;
     429             : #ifdef SQL_DRIVER_AWARE_POOLING_SUPPORTED
     430             :         case SQL_DRIVER_AWARE_POOLING_SUPPORTED:
     431             :                 nValue = SQL_DRIVER_AWARE_POOLING_NOT_CAPABLE;
     432             :                 /* SQL_DRIVER_AWARE_POOLING_CAPABLE */
     433             :                 break;
     434             : #endif
     435           1 :         case SQL_DRIVER_NAME:
     436             :                 sValue = MONETDB_DRIVER_NAME;
     437           1 :                 break;
     438           1 :         case SQL_DRIVER_ODBC_VER:
     439             :                 sValue = MONETDB_ODBC_VER;
     440           1 :                 break;
     441           1 :         case SQL_DRIVER_VER:
     442           1 :                 snprintf(buf, sizeof(buf), "%02d.%02d.%04d %s",
     443             :                          MONETDB_VERSION_MAJOR, MONETDB_VERSION_MINOR,
     444             :                          MONETDB_VERSION_PATCH,
     445             : #ifdef MONETDB_RELEASE
     446             :                          MONETDB_RELEASE
     447             : #else
     448             :                          "unreleased"
     449             : #endif
     450             :                         );
     451             :                 sValue = buf;
     452           1 :                 break;
     453             :         case SQL_DROP_ASSERTION:
     454             :                 /* SQL_DA_DROP_ASSERION */
     455             :                 break;
     456             :         case SQL_DROP_CHARACTER_SET:
     457             :                 /* SQL_DCS_DROP_CHARACTER_SET */
     458             :                 break;
     459             :         case SQL_DROP_COLLATION:
     460             :                 /* SQL_DC_DROP_COLLATION */
     461             :                 break;
     462             :         case SQL_DROP_DOMAIN:
     463             :                 /* SQL_DD_DROP_DOMAIN | SQL_DD_CASCADE | SQL_DD_RESTRICT */
     464             :                 break;
     465           1 :         case SQL_DROP_SCHEMA:
     466             :                 nValue = SQL_DS_DROP_SCHEMA | SQL_DS_CASCADE | SQL_DS_RESTRICT;
     467           1 :                 break;
     468           1 :         case SQL_DROP_TABLE:
     469             :                 nValue = SQL_DT_DROP_TABLE | SQL_DT_CASCADE | SQL_DT_RESTRICT;
     470           1 :                 break;
     471             :         case SQL_DROP_TRANSLATION:
     472             :                 /* SQL_DTR_DROP_TRANSLATION */
     473             :                 break;
     474           1 :         case SQL_DROP_VIEW:
     475             :                 nValue = SQL_DV_DROP_VIEW | SQL_DV_CASCADE | SQL_DV_RESTRICT;
     476           1 :                 break;
     477           1 :         case SQL_DYNAMIC_CURSOR_ATTRIBUTES1:
     478             :                 nValue = SQL_CA1_ABSOLUTE | SQL_CA1_NEXT | SQL_CA1_RELATIVE;
     479             :                 /* SQL_CA1_BOOKMARK |
     480             :                  * SQL_CA1_BULK_ADD |
     481             :                  * SQL_CA1_BULK_DELETE_BY_BOOKMARK |
     482             :                  * SQL_CA1_BULK_FETCH_BY_BOOKMARK |
     483             :                  * SQL_CA1_BULK_UPDATE_BY_BOOKMARK |
     484             :                  * SQL_CA1_LOCK_EXCLUSIVE |
     485             :                  * SQL_CA1_LOCK_NO_CHANGE |
     486             :                  * SQL_CA1_LOCK_UNLOCK |
     487             :                  * SQL_CA1_POS_DELETE |
     488             :                  * SQL_CA1_POSITIONED_DELETE |
     489             :                  * SQL_CA1_POSITIONED_UPDATE |
     490             :                  * SQL_CA1_POS_POSITION |
     491             :                  * SQL_CA1_POS_REFRESH |
     492             :                  * SQL_CA1_POS_UPDATE |
     493             :                  * SQL_CA1_SELECT_FOR_UPDATE */
     494           1 :                 break;
     495             :         case SQL_DYNAMIC_CURSOR_ATTRIBUTES2:
     496             :                 /* SQL_CA2_CRC_APPROXIMATE |
     497             :                  * SQL_CA2_CRC_EXACT |
     498             :                  * SQL_CA2_LOCK_CONCURRENCY |
     499             :                  * SQL_CA2_MAX_ROWS_AFFECTS_ALL |
     500             :                  * SQL_CA2_MAX_ROWS_CATALOG |
     501             :                  * SQL_CA2_MAX_ROWS_DELETE |
     502             :                  * SQL_CA2_MAX_ROWS_INSERT |
     503             :                  * SQL_CA2_MAX_ROWS_SELECT |
     504             :                  * SQL_CA2_MAX_ROWS_UPDATE |
     505             :                  * SQL_CA2_OPT_ROWVER_CONCURRENCY |
     506             :                  * SQL_CA2_OPT_VALUES_CONCURRENCY |
     507             :                  * SQL_CA2_READ_ONLY_CONCURRENCY |
     508             :                  * SQL_CA2_SENSITIVITY_ADDITIONS |
     509             :                  * SQL_CA2_SENSITIVITY_DELETIONS |
     510             :                  * SQL_CA2_SENSITIVITY_UPDATES |
     511             :                  * SQL_CA2_SIMULATE_NON_UNIQUE |
     512             :                  * SQL_CA2_SIMULATE_TRY_UNIQUE |
     513             :                  * SQL_CA2_SIMULATE_UNIQUE */
     514             :                 break;
     515           1 :         case SQL_EXPRESSIONS_IN_ORDERBY:
     516             :                 sValue = "Y"; /* "N" */
     517           1 :                 break;
     518           1 :         case SQL_FILE_USAGE:
     519             :                 nValue = SQL_FILE_NOT_SUPPORTED;
     520             :                 /* SQL_FILE_TABLE, SQL_FILE_CATALOG */
     521             :                 len = sizeof(SQLUSMALLINT);
     522           1 :                 break;
     523           1 :         case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1:
     524             :                 nValue = SQL_CA1_NEXT;
     525             :                 /* SQL_CA1_BULK_ADD |
     526             :                  * SQL_CA1_BULK_DELETE_BY_BOOKMARK |
     527             :                  * SQL_CA1_BULK_FETCH_BY_BOOKMARK |
     528             :                  * SQL_CA1_BULK_UPDATE_BY_BOOKMARK |
     529             :                  * SQL_CA1_LOCK_EXCLUSIVE |
     530             :                  * SQL_CA1_LOCK_NO_CHANGE |
     531             :                  * SQL_CA1_LOCK_UNLOCK |
     532             :                  * SQL_CA1_POS_DELETE |
     533             :                  * SQL_CA1_POSITIONED_DELETE |
     534             :                  * SQL_CA1_POSITIONED_UPDATE |
     535             :                  * SQL_CA1_POS_POSITION |
     536             :                  * SQL_CA1_POS_REFRESH |
     537             :                  * SQL_CA1_POS_UPDATE |
     538             :                  * SQL_CA1_SELECT_FOR_UPDATE */
     539           1 :                 break;
     540             :         case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2:
     541             :                 /* SQL_CA2_CRC_APPROXIMATE |
     542             :                  * SQL_CA2_CRC_EXACT |
     543             :                  * SQL_CA2_LOCK_CONCURRENCY |
     544             :                  * SQL_CA2_MAX_ROWS_AFFECTS_ALL |
     545             :                  * SQL_CA2_MAX_ROWS_CATALOG |
     546             :                  * SQL_CA2_MAX_ROWS_DELETE |
     547             :                  * SQL_CA2_MAX_ROWS_INSERT |
     548             :                  * SQL_CA2_MAX_ROWS_SELECT |
     549             :                  * SQL_CA2_MAX_ROWS_UPDATE |
     550             :                  * SQL_CA2_OPT_ROWVER_CONCURRENCY |
     551             :                  * SQL_CA2_OPT_VALUES_CONCURRENCY |
     552             :                  * SQL_CA2_READ_ONLY_CONCURRENCY |
     553             :                  * SQL_CA2_SENSITIVITY_ADDITIONS |
     554             :                  * SQL_CA2_SENSITIVITY_DELETIONS |
     555             :                  * SQL_CA2_SENSITIVITY_UPDATES |
     556             :                  * SQL_CA2_SIMULATE_NON_UNIQUE |
     557             :                  * SQL_CA2_SIMULATE_TRY_UNIQUE |
     558             :                  * SQL_CA2_SIMULATE_UNIQUE */
     559             :                 break;
     560           1 :         case SQL_GETDATA_EXTENSIONS:
     561             :                 nValue = SQL_GD_ANY_COLUMN |
     562             :                         SQL_GD_ANY_ORDER |
     563             :                         SQL_GD_BLOCK |
     564             :                         SQL_GD_BOUND;
     565             :                 /* SQL_GD_OUTPUT_PARAMS */
     566           1 :                 break;
     567           1 :         case SQL_GROUP_BY:
     568             :                 nValue = SQL_GB_NO_RELATION;
     569             :                 /* SQL_GB_COLLATE, SQL_GB_NOT_SUPPORTED,
     570             :                  * SQL_GB_BROUP_BY_EQUALS_SELECT,
     571             :                  * SQL_GB_GROUP_BY_CONTAINS_SELECT */
     572             :                 len = sizeof(SQLUSMALLINT);
     573           1 :                 break;
     574           1 :         case SQL_IDENTIFIER_CASE:
     575             :                 nValue = SQL_IC_LOWER;
     576             :                 /* SQL_IC_UPPER, SQL_IC_SENSITIVE, SQL_IC_MIXED */
     577             :                 len = sizeof(SQLUSMALLINT);
     578           1 :                 break;
     579           1 :         case SQL_IDENTIFIER_QUOTE_CHAR:
     580             :                 sValue = "\"";   /* the " (double quote) */
     581           1 :                 break;
     582             :         case SQL_INDEX_KEYWORDS:
     583             :                 nValue = SQL_IK_NONE;
     584             :                 /* SQL_IK_ASC | SQL_IK_DESC | SQL_IK_ALL */
     585             :                 break;
     586             :         case SQL_INFO_SCHEMA_VIEWS:
     587             :                 /* SQL_ISV_ASSERTIONS |
     588             :                  * SQL_ISV_CHARACTER_SETS |
     589             :                  * SQL_ISV_CHECK_CONSTRAINTS |
     590             :                  * SQL_ISV_COLLATIONS |
     591             :                  * SQL_ISV_COLUMN_DOMAIN_USAGE |
     592             :                  * SQL_ISV_COLUMN_PRIVILEGES |
     593             :                  * SQL_ISV_COLUMNS |
     594             :                  * SQL_ISV_CONSTRAINT_COLUMN_USAGE |
     595             :                  * SQL_ISV_CONSTRAINT_TABLE_USAGE |
     596             :                  * SQL_ISV_DOMAIN_CONSTRAINTS |
     597             :                  * SQL_ISV_DOMAINS |
     598             :                  * SQL_ISV_KEY_COLUMN_USAGE |
     599             :                  * SQL_ISV_REFERENTIAL_CONSTRAINTS |
     600             :                  * SQL_ISV_SCHEMATA |
     601             :                  * SQL_ISV_SQL_LANGUAGES |
     602             :                  * SQL_ISV_TABLE_CONSTRAINTS |
     603             :                  * SQL_ISV_TABLE_PRIVILEGES |
     604             :                  * SQL_ISV_TABLES |
     605             :                  * SQL_ISV_TRANSLATIONS |
     606             :                  * SQL_ISV_USAGE_PRIVILEGES |
     607             :                  * SQL_ISV_VIEW_COLUMN_USAGE |
     608             :                  * SQL_ISV_VIEWS |
     609             :                  * SQL_ISV_VIEW_TABLE_USAGE */
     610             :                 break;
     611           1 :         case SQL_INSERT_STATEMENT:
     612             :                 nValue = SQL_IS_INSERT_LITERALS |
     613             :                         SQL_IS_INSERT_SEARCHED |
     614             :                         SQL_IS_SELECT_INTO;
     615           1 :                 break;
     616           1 :         case SQL_INTEGRITY:
     617             :                 /* N because we currently do not supprt CHECK constraints (see bug 3568) nor deferrable FK constraints. */
     618             :                 sValue = "N"; /* "Y" */
     619           1 :                 break;
     620             :         case SQL_KEYSET_CURSOR_ATTRIBUTES1:
     621             :                 /* SQL_CA1_ABSOLUTE |
     622             :                  * SQL_CA1_BOOKMARK |
     623             :                  * SQL_CA1_BULK_ADD |
     624             :                  * SQL_CA1_BULK_DELETE_BY_BOOKMARK |
     625             :                  * SQL_CA1_BULK_FETCH_BY_BOOKMARK |
     626             :                  * SQL_CA1_BULK_UPDATE_BY_BOOKMARK |
     627             :                  * SQL_CA1_LOCK_EXCLUSIVE |
     628             :                  * SQL_CA1_LOCK_NO_CHANGE |
     629             :                  * SQL_CA1_LOCK_UNLOCK |
     630             :                  * SQL_CA1_NEXT |
     631             :                  * SQL_CA1_POS_DELETE |
     632             :                  * SQL_CA1_POSITIONED_DELETE |
     633             :                  * SQL_CA1_POSITIONED_UPDATE |
     634             :                  * SQL_CA1_POS_POSITION |
     635             :                  * SQL_CA1_POS_REFRESH |
     636             :                  * SQL_CA1_POS_UPDATE |
     637             :                  * SQL_CA1_RELATIVE |
     638             :                  * SQL_CA1_SELECT_FOR_UPDATE */
     639             :                 break;
     640             :         case SQL_KEYSET_CURSOR_ATTRIBUTES2:
     641             :                 /* SQL_CA2_CRC_APPROXIMATE |
     642             :                  * SQL_CA2_CRC_EXACT |
     643             :                  * SQL_CA2_LOCK_CONCURRENCY |
     644             :                  * SQL_CA2_MAX_ROWS_AFFECTS_ALL |
     645             :                  * SQL_CA2_MAX_ROWS_CATALOG |
     646             :                  * SQL_CA2_MAX_ROWS_DELETE |
     647             :                  * SQL_CA2_MAX_ROWS_INSERT |
     648             :                  * SQL_CA2_MAX_ROWS_SELECT |
     649             :                  * SQL_CA2_MAX_ROWS_UPDATE |
     650             :                  * SQL_CA2_OPT_ROWVER_CONCURRENCY |
     651             :                  * SQL_CA2_OPT_VALUES_CONCURRENCY |
     652             :                  * SQL_CA2_READ_ONLY_CONCURRENCY |
     653             :                  * SQL_CA2_SENSITIVITY_ADDITIONS |
     654             :                  * SQL_CA2_SENSITIVITY_DELETIONS |
     655             :                  * SQL_CA2_SENSITIVITY_UPDATES |
     656             :                  * SQL_CA2_SIMULATE_NON_UNIQUE |
     657             :                  * SQL_CA2_SIMULATE_TRY_UNIQUE |
     658             :                  * SQL_CA2_SIMULATE_UNIQUE */
     659             :                 break;
     660           1 :         case SQL_KEYWORDS:
     661             :                 /* Returns the MonetDB keywords which are not listed
     662             :                  * as ODBC keyword in the #define SQL_ODBC_KEYWORDS in
     663             :                  * sql.h, collated from
     664             :                  * sql_scan.c:scanner_init_keywords with values
     665             :                  * removed that are in
     666             :                  * sql_parser.y:non_reserved_word */
     667             :                 sValue = "ADD,ADMIN,AFTER,AGGREGATE,ALL,ALTER,ALWAYS,AND,ANY,"
     668             :                         "ASYMMETRIC,ATOMIC,AUTO_INCREMENT,BEFORE,BEST,BIGINT,"
     669             :                         "BIGSERIAL,BINARY,BLOB,CALL,CHAIN,CLOB,COMMITTED,COPY,"
     670             :                         "CUME_DIST,CURRENT_ROLE,DELIMITERS,DENSE_RANK,DO,"
     671             :                         "EACH,EFFORT,ELSEIF,ENCRYPTED,EVERY,EXCLUDE,FOLLOWING,"
     672             :                         "FUNCTION,FWF,GENERATED,GEOMETRYCOLLECTION,"
     673             :                         "GEOMETRYCOLLECTIONM,GEOMETRYCOLLECTIONZ,"
     674             :                         "GEOMETRYCOLLECTIONZM,HUGEINT,IF,ILIKE,"
     675             :                         "LATERAL,LIMIT,LINESTRING,LINESTRINGM,"
     676             :                         "LINESTRINGZ,LINESTRINGZM,LOADER,LOCALTIME,"
     677             :                         "LOCALTIMESTAMP,LOCKED,MEDIUMINT,MERGE,"
     678             :                         "MULTILINESTRING,MULTILINESTRINGM,MULTILINESTRINGZ,"
     679             :                         "MULTILINESTRINGZM,MULTIPOINT,MULTIPOINTM,MULTIPOINTZ,"
     680             :                         "MULTIPOINTZM,MULTIPOLYGON,MULTIPOLYGONM,"
     681             :                         "MULTIPOLYGONZ,MULTIPOLYGONZM,NEW,NOCYCLE,NOMAXVALUE,"
     682             :                         "NOMINVALUE,NOW,OFFSET,OLD,ORDERED,OTHERS,OVER,"
     683             :                         "PARTITION,PERCENT_RANK,POINT,POINTM,POINTZ,POINTZM,"
     684             :                         "POLYGON,POLYGONM,POLYGONZ,POLYGONZM,PRECEDING,"
     685             :                         "RANGE,RANK,RECORDS,REFERENCING,REMOTE,"
     686             :                         "RENAME,REPEATABLE,REPLICA,RESTART,RETURN,RETURNS,"
     687             :                         "ROW_NUMBER,SAMPLE,SAVEPOINT,SEQUENCE,SERIAL,"
     688             :                         "SERIALIZABLE,SIMPLE,SPLIT_PART,STDIN,STDOUT,STREAM,"
     689             :                         "STRING,SYMMETRIC,TIES,TINYINT,TRIGGER,TRUNCATE,"
     690             :                         "UNBOUNDED,UNCOMMITTED,UNENCRYPTED,WHILE,WINDOW,XMLAGG,"
     691             :                         "XMLATTRIBUTES,XMLCOMMENT,XMLCONCAT,XMLDOCUMENT,"
     692             :                         "XMLELEMENT,XMLFOREST,XMLNAMESPACES,XMLPARSE,XMLPI,"
     693             :                         "XMLQUERY,XMLSCHEMA,XMLTEXT,XMLVALIDATE";
     694           1 :                 break;
     695           1 :         case SQL_LIKE_ESCAPE_CLAUSE:
     696             :                 sValue = "Y"; /* "N" */
     697           1 :                 break;
     698             :         case SQL_MAX_ASYNC_CONCURRENT_STATEMENTS:
     699             :                 break;
     700             :         case SQL_MAX_BINARY_LITERAL_LEN:
     701             :                 break;
     702           1 :         case SQL_MAX_CATALOG_NAME_LEN:
     703             :                 len = sizeof(SQLUSMALLINT);
     704           1 :                 break;
     705             :         case SQL_MAX_CHAR_LITERAL_LEN:
     706             :                 break;
     707           1 :         case SQL_MAX_COLUMN_NAME_LEN:
     708             :                 nValue = 1024;  /* max length of column sys._columns.name is defined as 1024 */
     709             :                 len = sizeof(SQLUSMALLINT);
     710           1 :                 break;
     711           6 :         case SQL_MAX_COLUMNS_IN_GROUP_BY:
     712             :         case SQL_MAX_COLUMNS_IN_INDEX:
     713             :         case SQL_MAX_COLUMNS_IN_ORDER_BY:
     714             :         case SQL_MAX_COLUMNS_IN_SELECT:
     715             :         case SQL_MAX_COLUMNS_IN_TABLE:
     716             :         case SQL_MAX_CONCURRENT_ACTIVITIES:
     717             :         case SQL_MAX_CURSOR_NAME_LEN:
     718             :                 len = sizeof(SQLUSMALLINT);
     719           6 :                 break;
     720           1 :         case SQL_MAX_DRIVER_CONNECTIONS:
     721             :                 nValue = 64;    /* default value of mserver5 */
     722             :                 /* TODO query the server for the actual value via SQL:
     723             :                    SELECT value FROM sys.env() WHERE name = 'max_clients'; */
     724             :                 len = sizeof(SQLUSMALLINT);
     725           1 :                 break;
     726           1 :         case SQL_MAX_IDENTIFIER_LEN:
     727             :                 nValue = 1024;  /* max length of columns sys.*.name is defined as 1024 */
     728             :                 len = sizeof(SQLUSMALLINT);
     729           1 :                 break;
     730             :         case SQL_MAX_INDEX_SIZE:
     731             :                 break;
     732           1 :         case SQL_MAX_PROCEDURE_NAME_LEN:
     733             :                 nValue = 256;   /* max length of column sys.functions.name is defined as 256 */
     734             :                 len = sizeof(SQLUSMALLINT);
     735           1 :                 break;
     736             :         case SQL_MAX_ROW_SIZE:
     737             :                 break;
     738           1 :         case SQL_MAX_ROW_SIZE_INCLUDES_LONG:
     739             :                 sValue = "Y"; /* "N" */
     740           1 :                 break;
     741           1 :         case SQL_MAX_SCHEMA_NAME_LEN:
     742             :                 nValue = 1024;  /* max length of column sys.schemas.name is defined as 1024 */
     743             :                 len = sizeof(SQLUSMALLINT);
     744           1 :                 break;
     745             :         case SQL_MAX_STATEMENT_LEN:
     746             :                 break;
     747           1 :         case SQL_MAX_TABLE_NAME_LEN:
     748             :                 nValue = 1024;  /* max length of column sys._tables.name is defined as 1024 */
     749             :                 len = sizeof(SQLUSMALLINT);
     750           1 :                 break;
     751           1 :         case SQL_MAX_TABLES_IN_SELECT:
     752             :                 len = sizeof(SQLUSMALLINT);
     753           1 :                 break;
     754           1 :         case SQL_MAX_USER_NAME_LEN:
     755             :                 nValue = 1024;  /* max length of sys.db_user_info.name is defined as 1024 */
     756             :                 len = sizeof(SQLUSMALLINT);
     757           1 :                 break;
     758           1 :         case SQL_MULT_RESULT_SETS:
     759             :                 sValue = "Y"; /* "N" */
     760           1 :                 break;
     761           1 :         case SQL_MULTIPLE_ACTIVE_TXN:
     762             :                 sValue = "Y"; /* "N" */
     763           1 :                 break;
     764           1 :         case SQL_NEED_LONG_DATA_LEN:
     765             :                 sValue = "N"; /* "Y" */
     766           1 :                 break;
     767           1 :         case SQL_NON_NULLABLE_COLUMNS:
     768             :                 nValue = SQL_NNC_NON_NULL;
     769             :                 /* SQL_NNC_NULL */
     770             :                 len = sizeof(SQLUSMALLINT);
     771           1 :                 break;
     772           1 :         case SQL_NULL_COLLATION:
     773             :                 nValue = SQL_NC_LOW;
     774             :                 /* SQL_NC_END, SQL_NC_HIGH, SQL_NC_START */
     775             :                 len = sizeof(SQLUSMALLINT);
     776           1 :                 break;
     777           1 :         case SQL_NUMERIC_FUNCTIONS:
     778             :                 nValue = SQL_FN_NUM_ABS |
     779             :                         SQL_FN_NUM_ACOS |
     780             :                         SQL_FN_NUM_ASIN |
     781             :                         SQL_FN_NUM_ATAN |
     782             :                         SQL_FN_NUM_ATAN2 |
     783             :                         SQL_FN_NUM_CEILING |
     784             :                         SQL_FN_NUM_COS |
     785             :                         SQL_FN_NUM_COT |
     786             :                         SQL_FN_NUM_DEGREES |
     787             :                         SQL_FN_NUM_EXP |
     788             :                         SQL_FN_NUM_FLOOR |
     789             :                         SQL_FN_NUM_LOG |
     790             :                         SQL_FN_NUM_LOG10 |
     791             :                         SQL_FN_NUM_MOD |
     792             :                         SQL_FN_NUM_PI |
     793             :                         SQL_FN_NUM_POWER |
     794             :                         SQL_FN_NUM_RADIANS |
     795             :                         SQL_FN_NUM_RAND |
     796             :                         SQL_FN_NUM_ROUND |
     797             :                         SQL_FN_NUM_SIGN |
     798             :                         SQL_FN_NUM_SIN |
     799             :                         SQL_FN_NUM_SQRT |
     800             :                         SQL_FN_NUM_TAN |
     801             :                         SQL_FN_NUM_TRUNCATE;    /* is mapped to ms_trunc() */
     802           1 :                 break;
     803           1 :         case SQL_ODBC_INTERFACE_CONFORMANCE:
     804             :                 nValue = SQL_OIC_CORE;
     805             :                 /* SQL_OIC_LEVEL1, SQL_OIC_LEVEL2 */
     806           1 :                 break;
     807           1 :         case SQL_OJ_CAPABILITIES:
     808             :                 nValue = SQL_OJ_LEFT |
     809             :                         SQL_OJ_RIGHT |
     810             :                         SQL_OJ_FULL |
     811             :                         SQL_OJ_NOT_ORDERED |
     812             :                         SQL_OJ_INNER |
     813             :                         SQL_OJ_ALL_COMPARISON_OPS;
     814             :                 /* SQL_OJ_NESTED */
     815           1 :                 break;
     816           1 :         case SQL_ORDER_BY_COLUMNS_IN_SELECT:
     817             :                 sValue = "N"; /* "Y" */
     818           1 :                 break;
     819           1 :         case SQL_PARAM_ARRAY_ROW_COUNTS:
     820             :                 nValue = SQL_PARC_BATCH; /* ? */
     821             :                 /* SQL_PARC_NO_BATCH */
     822           1 :                 break;
     823           0 :         case SQL_PARAM_ARRAY_SELECTS:
     824             :                 nValue = SQL_PAS_NO_SELECT;
     825             :                 /* SQL_PAS_BATCH, SQL_PAS_NO_BATCH */
     826           0 :                 break;
     827           1 :         case SQL_PROCEDURE_TERM:
     828             :                 sValue = "procedure";
     829           1 :                 break;
     830           1 :         case SQL_PROCEDURES:
     831             :                 sValue = "Y"; /* "N" */
     832           1 :                 break;
     833           1 :         case SQL_QUOTED_IDENTIFIER_CASE:
     834             :                 nValue = SQL_IC_SENSITIVE;
     835             :                 /* SQL_IC_LOWER, SQL_IC_MIXED, SQL_IC_UPPER */
     836             :                 len = sizeof(SQLUSMALLINT);
     837           1 :                 break;
     838           1 :         case SQL_ROW_UPDATES:
     839             :                 sValue = "N"; /* "Y" */
     840           1 :                 break;
     841           1 :         case SQL_SCHEMA_TERM:
     842             :                 sValue = "schema";
     843           1 :                 break;
     844           1 :         case SQL_SCHEMA_USAGE:
     845             :                 nValue = SQL_SU_DML_STATEMENTS |
     846             :                         SQL_SU_PROCEDURE_INVOCATION |
     847             :                         SQL_SU_TABLE_DEFINITION |
     848             :                         SQL_SU_INDEX_DEFINITION |
     849             :                         SQL_SU_PRIVILEGE_DEFINITION;
     850           1 :                 break;
     851           1 :         case SQL_SCROLL_OPTIONS:
     852             :                 nValue = SQL_SO_STATIC;
     853             :                 /* SQL_SO_DYNAMIC,
     854             :                  * SQL_SO_FORWARD_ONLY,
     855             :                  * SQL_SO_KEYSET_DRIVEN,
     856             :                  * SQL_SO_MIXED */
     857           1 :                 break;
     858           1 :         case SQL_SEARCH_PATTERN_ESCAPE:
     859             :                 sValue = "\\";
     860           1 :                 break;
     861           1 :         case SQL_SERVER_NAME:
     862             :                 sValue = MONETDB_SERVER_NAME;
     863           1 :                 break;
     864           1 :         case SQL_SPECIAL_CHARACTERS:
     865             :                 sValue = "!$&'()*+,-./:;<=>?@[]^`{|}~";
     866           1 :                 break;
     867           1 :         case SQL_SQL_CONFORMANCE:
     868             :                 nValue = SQL_SC_SQL92_FULL;
     869           1 :                 break;
     870           1 :         case SQL_SQL92_DATETIME_FUNCTIONS:
     871             :                 nValue = SQL_SDF_CURRENT_DATE |
     872             :                         SQL_SDF_CURRENT_TIME |
     873             :                         SQL_SDF_CURRENT_TIMESTAMP;
     874           1 :                 break;
     875           1 :         case SQL_SQL92_FOREIGN_KEY_DELETE_RULE:
     876             :                 nValue = SQL_SFKD_CASCADE |
     877             :                         SQL_SFKD_NO_ACTION |
     878             :                         SQL_SFKD_SET_DEFAULT |
     879             :                         SQL_SFKD_SET_NULL;
     880           1 :                 break;
     881           1 :         case SQL_SQL92_FOREIGN_KEY_UPDATE_RULE:
     882             :                 nValue = SQL_SFKU_CASCADE |
     883             :                         SQL_SFKU_NO_ACTION |
     884             :                         SQL_SFKU_SET_DEFAULT |
     885             :                         SQL_SFKU_SET_NULL;
     886           1 :                 break;
     887           1 :         case SQL_SQL92_GRANT:
     888             :                 nValue = SQL_SG_DELETE_TABLE |
     889             :                         SQL_SG_INSERT_COLUMN |
     890             :                         SQL_SG_INSERT_TABLE |
     891             :                         SQL_SG_REFERENCES_COLUMN |
     892             :                         SQL_SG_REFERENCES_TABLE |
     893             :                         SQL_SG_SELECT_TABLE |
     894             :                         SQL_SG_UPDATE_COLUMN |
     895             :                         SQL_SG_UPDATE_TABLE |
     896             :                         SQL_SG_WITH_GRANT_OPTION;
     897             :                 /* SQL_SG_USAGE_ON_CHARACTER_SET |
     898             :                  * SQL_SG_USAGE_ON_COLLATION |
     899             :                  * SQL_SG_USAGE_ON_DOMAIN |
     900             :                  * SQL_SG_USAGE_ON_TRANSLATION */
     901           1 :                 break;
     902           1 :         case SQL_SQL92_NUMERIC_VALUE_FUNCTIONS:
     903             :                 nValue = SQL_SNVF_CHAR_LENGTH |
     904             :                         SQL_SNVF_CHARACTER_LENGTH |
     905             :                         SQL_SNVF_EXTRACT |
     906             :                         SQL_SNVF_OCTET_LENGTH |
     907             :                         SQL_SNVF_POSITION;
     908             :                 /* SQL_SNVF_BIT_LENGTH */
     909           1 :                 break;
     910           1 :         case SQL_SQL92_PREDICATES: /* ? */
     911             :                 nValue = SQL_SP_BETWEEN |
     912             :                         SQL_SP_COMPARISON |
     913             :                         SQL_SP_EXISTS |
     914             :                         SQL_SP_IN |
     915             :                         SQL_SP_ISNOTNULL |
     916             :                         SQL_SP_ISNULL |
     917             :                         SQL_SP_LIKE |
     918             :                         SQL_SP_MATCH_FULL |
     919             :                         SQL_SP_MATCH_PARTIAL|
     920             :                         SQL_SP_MATCH_UNIQUE_FULL |
     921             :                         SQL_SP_MATCH_UNIQUE_PARTIAL |
     922             :                         SQL_SP_OVERLAPS |
     923             :                         SQL_SP_QUANTIFIED_COMPARISON |
     924             :                         SQL_SP_UNIQUE;
     925           1 :                 break;
     926           1 :         case SQL_SQL92_RELATIONAL_JOIN_OPERATORS:
     927             :                 nValue = SQL_SRJO_CORRESPONDING_CLAUSE |
     928             :                         SQL_SRJO_CROSS_JOIN |
     929             :                         SQL_SRJO_EXCEPT_JOIN |
     930             :                         SQL_SRJO_FULL_OUTER_JOIN |
     931             :                         SQL_SRJO_INNER_JOIN |
     932             :                         SQL_SRJO_INTERSECT_JOIN |
     933             :                         SQL_SRJO_LEFT_OUTER_JOIN |
     934             :                         SQL_SRJO_NATURAL_JOIN |
     935             :                         SQL_SRJO_RIGHT_OUTER_JOIN |
     936             :                         SQL_SRJO_UNION_JOIN;
     937           1 :                 break;
     938           1 :         case SQL_SQL92_REVOKE:
     939             :                 nValue = SQL_SR_DELETE_TABLE |
     940             :                         SQL_SR_GRANT_OPTION_FOR |
     941             :                         SQL_SR_INSERT_COLUMN |
     942             :                         SQL_SR_INSERT_TABLE |
     943             :                         SQL_SR_REFERENCES_COLUMN |
     944             :                         SQL_SR_REFERENCES_TABLE |
     945             :                         SQL_SR_SELECT_TABLE |
     946             :                         SQL_SR_UPDATE_COLUMN |
     947             :                         SQL_SR_UPDATE_TABLE;
     948             :                 /* SQL_SR_CASCADE |
     949             :                  * SQL_SR_RESTRICT |
     950             :                  * SQL_SR_USAGE_ON_DOMAIN |
     951             :                  * SQL_SR_USAGE_ON_CHARACTER_SET |
     952             :                  * SQL_SR_USAGE_ON_COLLATION |
     953             :                  * SQL_SR_USAGE_ON_TRANSLATION */
     954           1 :                 break;
     955           1 :         case SQL_SQL92_ROW_VALUE_CONSTRUCTOR: /* ? */
     956             :                 nValue = SQL_SRVC_VALUE_EXPRESSION |
     957             :                         SQL_SRVC_NULL |
     958             :                         SQL_SRVC_DEFAULT |
     959             :                         SQL_SRVC_ROW_SUBQUERY;
     960           1 :                 break;
     961           1 :         case SQL_SQL92_STRING_FUNCTIONS:
     962             :                 nValue = SQL_SSF_CONVERT |
     963             :                         SQL_SSF_LOWER |
     964             :                         SQL_SSF_UPPER |
     965             :                         SQL_SSF_SUBSTRING |
     966             :                         SQL_SSF_TRIM_BOTH |
     967             :                         SQL_SSF_TRIM_LEADING |
     968             :                         SQL_SSF_TRIM_TRAILING;
     969           1 :                 break;
     970             :                 /* SQL_SSF_TRANSLATE */
     971           1 :         case SQL_SQL92_VALUE_EXPRESSIONS:
     972             :                 nValue = SQL_SVE_CASE |
     973             :                         SQL_SVE_CAST |
     974             :                         SQL_SVE_COALESCE |
     975             :                         SQL_SVE_NULLIF;
     976           1 :                 break;
     977           1 :         case SQL_STANDARD_CLI_CONFORMANCE: /* ? */
     978             :                 nValue = SQL_SCC_XOPEN_CLI_VERSION1 | SQL_SCC_ISO92_CLI;
     979           1 :                 break;
     980           1 :         case SQL_STATIC_CURSOR_ATTRIBUTES1:
     981             :                 nValue = SQL_CA1_ABSOLUTE |
     982             :                         SQL_CA1_NEXT |
     983             :                         SQL_CA1_RELATIVE;
     984             :                 /* SQL_CA1_BOOKMARK |
     985             :                  * SQL_CA1_BULK_ADD |
     986             :                  * SQL_CA1_BULK_DELETE_BY_BOOKMARK |
     987             :                  * SQL_CA1_BULK_FETCH_BY_BOOKMARK |
     988             :                  * SQL_CA1_BULK_UPDATE_BY_BOOKMARK |
     989             :                  * SQL_CA1_LOCK_EXCLUSIVE |
     990             :                  * SQL_CA1_LOCK_NO_CHANGE |
     991             :                  * SQL_CA1_LOCK_UNLOCK |
     992             :                  * SQL_CA1_POS_DELETE |
     993             :                  * SQL_CA1_POSITIONED_DELETE |
     994             :                  * SQL_CA1_POSITIONED_UPDATE |
     995             :                  * SQL_CA1_POS_POSITION |
     996             :                  * SQL_CA1_POS_REFRESH |
     997             :                  * SQL_CA1_POS_UPDATE |
     998             :                  * SQL_CA1_SELECT_FOR_UPDATE */
     999           1 :                 break;
    1000             :         case SQL_STATIC_CURSOR_ATTRIBUTES2:
    1001             :                 /* SQL_CA2_CRC_APPROXIMATE |
    1002             :                  * SQL_CA2_CRC_EXACT |
    1003             :                  * SQL_CA2_LOCK_CONCURRENCY |
    1004             :                  * SQL_CA2_MAX_ROWS_AFFECTS_ALL |
    1005             :                  * SQL_CA2_MAX_ROWS_CATALOG |
    1006             :                  * SQL_CA2_MAX_ROWS_DELETE |
    1007             :                  * SQL_CA2_MAX_ROWS_INSERT |
    1008             :                  * SQL_CA2_MAX_ROWS_SELECT |
    1009             :                  * SQL_CA2_MAX_ROWS_UPDATE |
    1010             :                  * SQL_CA2_OPT_ROWVER_CONCURRENCY |
    1011             :                  * SQL_CA2_OPT_VALUES_CONCURRENCY |
    1012             :                  * SQL_CA2_READ_ONLY_CONCURRENCY |
    1013             :                  * SQL_CA2_SENSITIVITY_ADDITIONS |
    1014             :                  * SQL_CA2_SENSITIVITY_DELETIONS |
    1015             :                  * SQL_CA2_SENSITIVITY_UPDATES |
    1016             :                  * SQL_CA2_SIMULATE_NON_UNIQUE |
    1017             :                  * SQL_CA2_SIMULATE_TRY_UNIQUE |
    1018             :                  * SQL_CA2_SIMULATE_UNIQUE */
    1019             :                 break;
    1020           1 :         case SQL_STRING_FUNCTIONS:
    1021             :                 nValue = SQL_FN_STR_ASCII |
    1022             :                         SQL_FN_STR_CHAR |
    1023             :                         SQL_FN_STR_CHARACTER_LENGTH |
    1024             :                         SQL_FN_STR_CHAR_LENGTH |
    1025             :                         SQL_FN_STR_CONCAT |
    1026             :                         SQL_FN_STR_DIFFERENCE |
    1027             :                         SQL_FN_STR_INSERT |
    1028             :                         SQL_FN_STR_LCASE |
    1029             :                         SQL_FN_STR_LEFT |
    1030             :                         SQL_FN_STR_LENGTH |
    1031             :                         SQL_FN_STR_LOCATE |
    1032             :                         SQL_FN_STR_LOCATE_2 |
    1033             :                         SQL_FN_STR_LTRIM |
    1034             :                         SQL_FN_STR_OCTET_LENGTH |
    1035             :                         SQL_FN_STR_POSITION |
    1036             :                         SQL_FN_STR_REPEAT |
    1037             :                         SQL_FN_STR_REPLACE |
    1038             :                         SQL_FN_STR_RIGHT |
    1039             :                         SQL_FN_STR_RTRIM |
    1040             :                         SQL_FN_STR_SOUNDEX |
    1041             :                         SQL_FN_STR_SPACE |
    1042             :                         SQL_FN_STR_SUBSTRING |
    1043             :                         SQL_FN_STR_UCASE;
    1044             :                 /* SQL_FN_STR_BIT_LENGTH */
    1045           1 :                 break;
    1046           1 :         case SQL_SUBQUERIES:
    1047             :                 nValue = SQL_SQ_CORRELATED_SUBQUERIES |
    1048             :                         SQL_SQ_COMPARISON |
    1049             :                         SQL_SQ_EXISTS |
    1050             :                         SQL_SQ_IN |
    1051             :                         SQL_SQ_QUANTIFIED;
    1052           1 :                 break;
    1053           1 :         case SQL_SYSTEM_FUNCTIONS:
    1054             :                 nValue = SQL_FN_SYS_DBNAME |
    1055             :                         SQL_FN_SYS_IFNULL |
    1056             :                         SQL_FN_SYS_USERNAME;
    1057           1 :                 break;
    1058           1 :         case SQL_TABLE_TERM:
    1059             :                 sValue = "table";
    1060           1 :                 break;
    1061             :         case SQL_TIMEDATE_ADD_INTERVALS:
    1062             :         case SQL_TIMEDATE_DIFF_INTERVALS:
    1063             :                 /* SQL_FN_TSI_FRAC_SECOND |
    1064             :                  * SQL_FN_TSI_SECOND |
    1065             :                  * SQL_FN_TSI_MINUTE |
    1066             :                  * SQL_FN_TSI_HOUR |
    1067             :                  * SQL_FN_TSI_DAY |
    1068             :                  * SQL_FN_TSI_WEEK |
    1069             :                  * SQL_FN_TSI_MONTH |
    1070             :                  * SQL_FN_TSI_QUARTER |
    1071             :                  * SQL_FN_TSI_YEAR */
    1072             :                 break;
    1073           1 :         case SQL_TIMEDATE_FUNCTIONS:
    1074             :                 nValue = SQL_FN_TD_CURRENT_DATE |
    1075             :                         SQL_FN_TD_CURRENT_TIME |
    1076             :                         SQL_FN_TD_CURRENT_TIMESTAMP |
    1077             :                         SQL_FN_TD_CURDATE |
    1078             :                         SQL_FN_TD_CURTIME |
    1079             :                         /* SQL_FN_TD_DAYNAME | */
    1080             :                         SQL_FN_TD_DAYOFMONTH |
    1081             :                         SQL_FN_TD_DAYOFWEEK |
    1082             :                         SQL_FN_TD_DAYOFYEAR |
    1083             :                         SQL_FN_TD_EXTRACT |
    1084             :                         SQL_FN_TD_HOUR |
    1085             :                         SQL_FN_TD_MINUTE |
    1086             :                         SQL_FN_TD_MONTH |
    1087             :                         /* SQL_FN_TD_MONTHNAME | */
    1088             :                         SQL_FN_TD_NOW |
    1089             :                         SQL_FN_TD_QUARTER |
    1090             :                         SQL_FN_TD_SECOND |
    1091             :                         /* SQL_FN_TD_TIMESTAMPADD | */
    1092             :                         /* SQL_FN_TD_TIMESTAMPDIFF | */
    1093             :                         SQL_FN_TD_WEEK |
    1094             :                         SQL_FN_TD_YEAR;
    1095           1 :                 break;
    1096           1 :         case SQL_TXN_CAPABLE:
    1097             :                 nValue = SQL_TC_ALL;
    1098             :                 len = sizeof(SQLUSMALLINT);
    1099           1 :                 break;
    1100           1 :         case SQL_TXN_ISOLATION_OPTION:
    1101             :                 nValue = SQL_TXN_SERIALIZABLE;
    1102           1 :                 break;
    1103           1 :         case SQL_UNION:
    1104             :                 nValue = SQL_U_UNION | SQL_U_UNION_ALL;
    1105           1 :                 break;
    1106           1 :         case SQL_USER_NAME:
    1107           1 :                 sValue = dbc->uid ? dbc->uid : "";
    1108             :                 break;
    1109           0 :         case SQL_XOPEN_CLI_YEAR: /* ? */
    1110             :                 sValue = "";
    1111           0 :                 break;
    1112             : 
    1113             :         /* deprecated info types */
    1114           0 :         case SQL_FETCH_DIRECTION:
    1115             :                 nValue = SQL_FD_FETCH_ABSOLUTE |
    1116             :                         SQL_FD_FETCH_FIRST |
    1117             :                         SQL_FD_FETCH_LAST |
    1118             :                         SQL_FD_FETCH_NEXT |
    1119             :                         SQL_FD_FETCH_PRIOR |
    1120             :                         SQL_FD_FETCH_RELATIVE;
    1121             :                 /* SQL_FD_FETCH_BOOKMARK */
    1122             :                 len = sizeof(SQLUSMALLINT);
    1123           0 :                 break;
    1124           0 :         case SQL_LOCK_TYPES:
    1125             :                 nValue = SQL_LCK_NO_CHANGE;
    1126             :                 /*  SQL_LCK_EXCLUSIVE | SQL_LCK_UNLOCK */
    1127           0 :                 break;
    1128           0 :         case SQL_ODBC_API_CONFORMANCE:
    1129             :                 nValue = SQL_OAC_LEVEL2;
    1130             :                 /* SQL_OAC_CORE, SQL_OAC_LEVEL1 */
    1131             :                 len = sizeof(SQLUSMALLINT);
    1132           0 :                 break;
    1133           0 :         case SQL_ODBC_SQL_CONFORMANCE:
    1134             :                 nValue = SQL_OSC_CORE;
    1135             :                 /* SQL_OSC_MINIMUM, SQL_OSC_EXTENDED */
    1136             :                 len = sizeof(SQLUSMALLINT);
    1137           0 :                 break;
    1138           1 :         case SQL_POS_OPERATIONS:
    1139             :                 nValue = SQL_POS_POSITION;
    1140             :                 /* SQL_POS_ADD |
    1141             :                  * SQL_POS_DELETE |
    1142             :                  * SQL_POS_REFRESH |
    1143             :                  * SQL_POS_UPDATE */
    1144           1 :                 break;
    1145           0 :         case SQL_POSITIONED_STATEMENTS:
    1146             :                 nValue = SQL_PS_SELECT_FOR_UPDATE;
    1147             :                 /* SQL_PS_POSITIONED_DELETE |
    1148             :                  * SQL_PS_POSITIONED_UPDATE |
    1149             :                  * SQL_PS_SELECT_FOR_UPDATE */
    1150           0 :                 break;
    1151           0 :         case SQL_SCROLL_CONCURRENCY:
    1152             :                 nValue = SQL_SCCO_READ_ONLY;
    1153             :                 /* SQL_SCCO_LOCK |
    1154             :                  * SQL_SCCO_OPT_ROWVER |
    1155             :                  * SQL_SCCO_OPT_VALUES */
    1156             :                 len = sizeof(SQLUSMALLINT);
    1157           0 :                 break;
    1158             :         case SQL_STATIC_SENSITIVITY:
    1159             :                 /* SQL_SS_ADDITIONS |
    1160             :                  * SQL_SS_DELETIONS |
    1161             :                  * SQL_SS_UPDATES */
    1162             :                 len = sizeof(SQLINTEGER);
    1163             :                 break;
    1164             : 
    1165           0 :         case SQL_ODBC_SAG_CLI_CONFORMANCE:
    1166             :                 nValue = SQL_OSCC_COMPLIANT;
    1167             :                 len = sizeof(SQLUSMALLINT);
    1168           0 :                 break;
    1169           0 :         case SQL_OUTER_JOINS:
    1170             :                 sValue = "Y"; /* "N" */
    1171           0 :                 break;
    1172             : 
    1173           0 :         default:
    1174             :                 /* Invalid information type */
    1175           0 :                 addDbcError(dbc, "HY096", NULL, 0);
    1176           0 :                 return SQL_ERROR;
    1177             :         }
    1178             : 
    1179             :         /* copy the data to the supplied output parameters */
    1180         160 :         if (sValue) {
    1181          34 :                 copyString(sValue, strlen(sValue), InfoValuePtr, BufferLength, StringLengthPtr, SQLSMALLINT, addDbcError, dbc, return SQL_ERROR);
    1182         126 :         } else if (InfoValuePtr) {
    1183         126 :                 if (len == sizeof(SQLUINTEGER))
    1184          97 :                         *(SQLUINTEGER *) InfoValuePtr = (SQLUINTEGER) nValue;
    1185             : #ifndef SQLULEN
    1186             :                 /* if SQLULEN is defined, it's defined as SQLUINTEGER
    1187             :                  * which we've handled */
    1188             :                 else if (len == sizeof(SQLULEN))
    1189             :                         *(SQLULEN *) InfoValuePtr = (SQLULEN) nValue;
    1190             : #endif
    1191          29 :                 else if (len == sizeof(SQLUSMALLINT))
    1192          29 :                         *(SQLUSMALLINT *) InfoValuePtr = (SQLUSMALLINT) nValue;
    1193         126 :                 if (StringLengthPtr)
    1194         126 :                         *StringLengthPtr = len;
    1195             :         }
    1196             : 
    1197         160 :         return dbc->Error ? SQL_SUCCESS_WITH_INFO : SQL_SUCCESS;
    1198             : }
    1199             : 
    1200             : #ifdef ODBCDEBUG
    1201             : static char *
    1202           0 : translateInfoType(SQLUSMALLINT InfoType)
    1203             : {
    1204             :         static char unknown[32];
    1205             : 
    1206           0 :         switch (InfoType) {
    1207             :         case SQL_ACCESSIBLE_PROCEDURES:
    1208             :                 return "SQL_ACCESSIBLE_PROCEDURES";
    1209           0 :         case SQL_ACCESSIBLE_TABLES:
    1210           0 :                 return "SQL_ACCESSIBLE_TABLES";
    1211           0 :         case SQL_ACTIVE_ENVIRONMENTS:
    1212           0 :                 return "SQL_ACTIVE_ENVIRONMENTS";
    1213           0 :         case SQL_AGGREGATE_FUNCTIONS:
    1214           0 :                 return "SQL_AGGREGATE_FUNCTIONS";
    1215           0 :         case SQL_ALTER_DOMAIN:
    1216           0 :                 return "SQL_ALTER_DOMAIN";
    1217             : #ifdef SQL_ALTER_SCHEMA
    1218             :         case SQL_ALTER_SCHEMA:
    1219             :                 return "SQL_ALTER_SCHEMA";
    1220             : #endif
    1221           0 :         case SQL_ALTER_TABLE:
    1222           0 :                 return "SQL_ALTER_TABLE";
    1223             : #ifdef SQL_ANSI_SQL_DATETIME_LITERALS
    1224             :         case SQL_ANSI_SQL_DATETIME_LITERALS:
    1225             :                 return "SQL_ANSI_SQL_DATETIME_LITERALS";
    1226             : #endif
    1227             : #ifdef SQL_ASYNC_DBC_FUNCTIONS
    1228             :         case SQL_ASYNC_DBC_FUNCTIONS:
    1229             :                 return "SQL_ASYNC_DBC_FUNCTIONS";
    1230             : #endif
    1231           0 :         case SQL_ASYNC_MODE:
    1232           0 :                 return "SQL_ASYNC_MODE";
    1233             : #ifdef SQL_ASYNC_NOTIFICATION
    1234             :         case SQL_ASYNC_NOTIFICATION:
    1235             :                 return "SQL_ASYNC_NOTIFICATION";
    1236             : #endif
    1237           0 :         case SQL_BATCH_ROW_COUNT:
    1238           0 :                 return "SQL_BATCH_ROW_COUNT";
    1239           0 :         case SQL_BATCH_SUPPORT:
    1240           0 :                 return "SQL_BATCH_SUPPORT";
    1241           0 :         case SQL_BOOKMARK_PERSISTENCE:
    1242           0 :                 return "SQL_BOOKMARK_PERSISTENCE";
    1243           0 :         case SQL_CATALOG_LOCATION:
    1244           0 :                 return "SQL_CATALOG_LOCATION";
    1245           0 :         case SQL_CATALOG_NAME:
    1246           0 :                 return "SQL_CATALOG_NAME";
    1247           0 :         case SQL_CATALOG_NAME_SEPARATOR:
    1248           0 :                 return "SQL_CATALOG_NAME_SEPARATOR";
    1249           0 :         case SQL_CATALOG_TERM:
    1250           0 :                 return "SQL_CATALOG_TERM";
    1251           0 :         case SQL_CATALOG_USAGE:
    1252           0 :                 return "SQL_CATALOG_USAGE";
    1253           0 :         case SQL_COLLATION_SEQ:
    1254           0 :                 return "SQL_COLLATION_SEQ";
    1255           0 :         case SQL_COLUMN_ALIAS:
    1256           0 :                 return "SQL_COLUMN_ALIAS";
    1257           0 :         case SQL_CONCAT_NULL_BEHAVIOR:
    1258           0 :                 return "SQL_CONCAT_NULL_BEHAVIOR";
    1259           0 :         case SQL_CONVERT_BIGINT:
    1260           0 :                 return "SQL_CONVERT_BIGINT";
    1261           0 :         case SQL_CONVERT_BINARY:
    1262           0 :                 return "SQL_CONVERT_BINARY";
    1263           0 :         case SQL_CONVERT_BIT:
    1264           0 :                 return "SQL_CONVERT_BIT";
    1265           0 :         case SQL_CONVERT_CHAR:
    1266           0 :                 return "SQL_CONVERT_CHAR";
    1267           0 :         case SQL_CONVERT_DATE:
    1268           0 :                 return "SQL_CONVERT_DATE";
    1269           0 :         case SQL_CONVERT_DECIMAL:
    1270           0 :                 return "SQL_CONVERT_DECIMAL";
    1271           0 :         case SQL_CONVERT_DOUBLE:
    1272           0 :                 return "SQL_CONVERT_DOUBLE";
    1273           0 :         case SQL_CONVERT_FLOAT:
    1274           0 :                 return "SQL_CONVERT_FLOAT";
    1275           0 :         case SQL_CONVERT_FUNCTIONS:
    1276           0 :                 return "SQL_CONVERT_FUNCTIONS";
    1277           0 :         case SQL_CONVERT_INTEGER:
    1278           0 :                 return "SQL_CONVERT_INTEGER";
    1279           0 :         case SQL_CONVERT_INTERVAL_DAY_TIME:
    1280           0 :                 return "SQL_CONVERT_INTERVAL_DAY_TIME";
    1281           0 :         case SQL_CONVERT_INTERVAL_YEAR_MONTH:
    1282           0 :                 return "SQL_CONVERT_INTERVAL_YEAR_MONTH";
    1283           0 :         case SQL_CONVERT_LONGVARBINARY:
    1284           0 :                 return "SQL_CONVERT_LONGVARBINARY";
    1285           0 :         case SQL_CONVERT_LONGVARCHAR:
    1286           0 :                 return "SQL_CONVERT_LONGVARCHAR";
    1287           0 :         case SQL_CONVERT_NUMERIC:
    1288           0 :                 return "SQL_CONVERT_NUMERIC";
    1289           0 :         case SQL_CONVERT_REAL:
    1290           0 :                 return "SQL_CONVERT_REAL";
    1291           0 :         case SQL_CONVERT_SMALLINT:
    1292           0 :                 return "SQL_CONVERT_SMALLINT";
    1293           0 :         case SQL_CONVERT_TIME:
    1294           0 :                 return "SQL_CONVERT_TIME";
    1295           0 :         case SQL_CONVERT_TIMESTAMP:
    1296           0 :                 return "SQL_CONVERT_TIMESTAMP";
    1297           0 :         case SQL_CONVERT_TINYINT:
    1298           0 :                 return "SQL_CONVERT_TINYINT";
    1299           0 :         case SQL_CONVERT_VARBINARY:
    1300           0 :                 return "SQL_CONVERT_VARBINARY";
    1301           0 :         case SQL_CONVERT_VARCHAR:
    1302           0 :                 return "SQL_CONVERT_VARCHAR";
    1303           0 :         case SQL_CORRELATION_NAME:
    1304           0 :                 return "SQL_CORRELATION_NAME";
    1305           0 :         case SQL_CREATE_ASSERTION:
    1306           0 :                 return "SQL_CREATE_ASSERTION";
    1307           0 :         case SQL_CREATE_CHARACTER_SET:
    1308           0 :                 return "SQL_CREATE_CHARACTER_SET";
    1309           0 :         case SQL_CREATE_COLLATION:
    1310           0 :                 return "SQL_CREATE_COLLATION";
    1311           0 :         case SQL_CREATE_DOMAIN:
    1312           0 :                 return "SQL_CREATE_DOMAIN";
    1313           0 :         case SQL_CREATE_SCHEMA:
    1314           0 :                 return "SQL_CREATE_SCHEMA";
    1315           0 :         case SQL_CREATE_TABLE:
    1316           0 :                 return "SQL_CREATE_TABLE";
    1317           0 :         case SQL_CREATE_TRANSLATION:
    1318           0 :                 return "SQL_CREATE_TRANSLATION";
    1319           0 :         case SQL_CREATE_VIEW:
    1320           0 :                 return "SQL_CREATE_VIEW";
    1321           0 :         case SQL_CURSOR_COMMIT_BEHAVIOR:
    1322           0 :                 return "SQL_CURSOR_COMMIT_BEHAVIOR";
    1323           0 :         case SQL_CURSOR_ROLLBACK_BEHAVIOR:
    1324           0 :                 return "SQL_CURSOR_ROLLBACK_BEHAVIOR";
    1325           0 :         case SQL_CURSOR_SENSITIVITY:
    1326           0 :                 return "SQL_CURSOR_SENSITIVITY";
    1327           0 :         case SQL_DATABASE_NAME:
    1328           0 :                 return "SQL_DATABASE_NAME";
    1329           0 :         case SQL_DATA_SOURCE_NAME:
    1330           0 :                 return "SQL_DATA_SOURCE_NAME";
    1331           0 :         case SQL_DATA_SOURCE_READ_ONLY:
    1332           0 :                 return "SQL_DATA_SOURCE_READ_ONLY";
    1333           0 :         case SQL_DATETIME_LITERALS:
    1334           0 :                 return "SQL_DATETIME_LITERALS";
    1335           0 :         case SQL_DBMS_NAME:
    1336           0 :                 return "SQL_DBMS_NAME";
    1337           0 :         case SQL_DBMS_VER:
    1338           0 :                 return "SQL_DBMS_VER";
    1339           0 :         case SQL_DDL_INDEX:
    1340           0 :                 return "SQL_DDL_INDEX";
    1341           0 :         case SQL_DEFAULT_TXN_ISOLATION:
    1342           0 :                 return "SQL_DEFAULT_TXN_ISOLATION";
    1343           0 :         case SQL_DESCRIBE_PARAMETER:
    1344           0 :                 return "SQL_DESCRIBE_PARAMETER";
    1345           0 :         case SQL_DM_VER:
    1346           0 :                 return "SQL_DM_VER";
    1347             : #ifdef SQL_DRIVER_AWARE_POOLING_SUPPORTED
    1348           0 :         case SQL_DRIVER_AWARE_POOLING_SUPPORTED:
    1349           0 :                 return "SQL_DRIVER_AWARE_POOLING_SUPPORTED";
    1350             : #endif
    1351           0 :         case SQL_DRIVER_HDBC:
    1352           0 :                 return "SQL_DRIVER_HDBC";
    1353           0 :         case SQL_DRIVER_HDESC:
    1354           0 :                 return "SQL_DRIVER_HDESC";
    1355           0 :         case SQL_DRIVER_HENV:
    1356           0 :                 return "SQL_DRIVER_HENV";
    1357           0 :         case SQL_DRIVER_HLIB:
    1358           0 :                 return "SQL_DRIVER_HLIB";
    1359           0 :         case SQL_DRIVER_HSTMT:
    1360           0 :                 return "SQL_DRIVER_HSTMT";
    1361           0 :         case SQL_DRIVER_NAME:
    1362           0 :                 return "SQL_DRIVER_NAME";
    1363           0 :         case SQL_DRIVER_ODBC_VER:
    1364           0 :                 return "SQL_DRIVER_ODBC_VER";
    1365           0 :         case SQL_DRIVER_VER:
    1366           0 :                 return "SQL_DRIVER_VER";
    1367           0 :         case SQL_DROP_ASSERTION:
    1368           0 :                 return "SQL_DROP_ASSERTION";
    1369           0 :         case SQL_DROP_CHARACTER_SET:
    1370           0 :                 return "SQL_DROP_CHARACTER_SET";
    1371           0 :         case SQL_DROP_COLLATION:
    1372           0 :                 return "SQL_DROP_COLLATION";
    1373           0 :         case SQL_DROP_DOMAIN:
    1374           0 :                 return "SQL_DROP_DOMAIN";
    1375           0 :         case SQL_DROP_SCHEMA:
    1376           0 :                 return "SQL_DROP_SCHEMA";
    1377           0 :         case SQL_DROP_TABLE:
    1378           0 :                 return "SQL_DROP_TABLE";
    1379           0 :         case SQL_DROP_TRANSLATION:
    1380           0 :                 return "SQL_DROP_TRANSLATION";
    1381           0 :         case SQL_DROP_VIEW:
    1382           0 :                 return "SQL_DROP_VIEW";
    1383           0 :         case SQL_DYNAMIC_CURSOR_ATTRIBUTES1:
    1384           0 :                 return "SQL_DYNAMIC_CURSOR_ATTRIBUTES1";
    1385           0 :         case SQL_DYNAMIC_CURSOR_ATTRIBUTES2:
    1386           0 :                 return "SQL_DYNAMIC_CURSOR_ATTRIBUTES2";
    1387           0 :         case SQL_EXPRESSIONS_IN_ORDERBY:
    1388           0 :                 return "SQL_EXPRESSIONS_IN_ORDERBY";
    1389           0 :         case SQL_FETCH_DIRECTION:
    1390           0 :                 return "SQL_FETCH_DIRECTION";
    1391           0 :         case SQL_FILE_USAGE:
    1392           0 :                 return "SQL_FILE_USAGE";
    1393           0 :         case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1:
    1394           0 :                 return "SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1";
    1395           0 :         case SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2:
    1396           0 :                 return "SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2";
    1397           0 :         case SQL_GETDATA_EXTENSIONS:
    1398           0 :                 return "SQL_GETDATA_EXTENSIONS";
    1399           0 :         case SQL_GROUP_BY:
    1400           0 :                 return "SQL_GROUP_BY";
    1401           0 :         case SQL_IDENTIFIER_CASE:
    1402           0 :                 return "SQL_IDENTIFIER_CASE";
    1403           0 :         case SQL_IDENTIFIER_QUOTE_CHAR:
    1404           0 :                 return "SQL_IDENTIFIER_QUOTE_CHAR";
    1405           0 :         case SQL_INDEX_KEYWORDS:
    1406           0 :                 return "SQL_INDEX_KEYWORDS";
    1407           0 :         case SQL_INFO_SCHEMA_VIEWS:
    1408           0 :                 return "SQL_INFO_SCHEMA_VIEWS";
    1409           0 :         case SQL_INSERT_STATEMENT:
    1410           0 :                 return "SQL_INSERT_STATEMENT";
    1411           0 :         case SQL_INTEGRITY:
    1412           0 :                 return "SQL_INTEGRITY";
    1413           0 :         case SQL_KEYSET_CURSOR_ATTRIBUTES1:
    1414           0 :                 return "SQL_KEYSET_CURSOR_ATTRIBUTES1";
    1415           0 :         case SQL_KEYSET_CURSOR_ATTRIBUTES2:
    1416           0 :                 return "SQL_KEYSET_CURSOR_ATTRIBUTES2";
    1417           0 :         case SQL_KEYWORDS:
    1418           0 :                 return "SQL_KEYWORDS";
    1419           0 :         case SQL_LIKE_ESCAPE_CLAUSE:
    1420           0 :                 return "SQL_LIKE_ESCAPE_CLAUSE";
    1421           0 :         case SQL_LOCK_TYPES:
    1422           0 :                 return "SQL_LOCK_TYPES";
    1423           0 :         case SQL_MAX_ASYNC_CONCURRENT_STATEMENTS:
    1424           0 :                 return "SQL_MAX_ASYNC_CONCURRENT_STATEMENTS";
    1425           0 :         case SQL_MAX_BINARY_LITERAL_LEN:
    1426           0 :                 return "SQL_MAX_BINARY_LITERAL_LEN";
    1427           0 :         case SQL_MAX_CATALOG_NAME_LEN:
    1428           0 :                 return "SQL_MAX_CATALOG_NAME_LEN";
    1429           0 :         case SQL_MAX_CHAR_LITERAL_LEN:
    1430           0 :                 return "SQL_MAX_CHAR_LITERAL_LEN";
    1431           0 :         case SQL_MAX_COLUMN_NAME_LEN:
    1432           0 :                 return "SQL_MAX_COLUMN_NAME_LEN";
    1433           0 :         case SQL_MAX_COLUMNS_IN_GROUP_BY:
    1434           0 :                 return "SQL_MAX_COLUMNS_IN_GROUP_BY";
    1435           0 :         case SQL_MAX_COLUMNS_IN_INDEX:
    1436           0 :                 return "SQL_MAX_COLUMNS_IN_INDEX";
    1437           0 :         case SQL_MAX_COLUMNS_IN_ORDER_BY:
    1438           0 :                 return "SQL_MAX_COLUMNS_IN_ORDER_BY";
    1439           0 :         case SQL_MAX_COLUMNS_IN_SELECT:
    1440           0 :                 return "SQL_MAX_COLUMNS_IN_SELECT";
    1441           0 :         case SQL_MAX_COLUMNS_IN_TABLE:
    1442           0 :                 return "SQL_MAX_COLUMNS_IN_TABLE";
    1443           0 :         case SQL_MAX_CONCURRENT_ACTIVITIES:
    1444           0 :                 return "SQL_MAX_CONCURRENT_ACTIVITIES";
    1445           0 :         case SQL_MAX_CURSOR_NAME_LEN:
    1446           0 :                 return "SQL_MAX_CURSOR_NAME_LEN";
    1447           0 :         case SQL_MAX_DRIVER_CONNECTIONS:
    1448           0 :                 return "SQL_MAX_DRIVER_CONNECTIONS";
    1449           0 :         case SQL_MAX_IDENTIFIER_LEN:
    1450           0 :                 return "SQL_MAX_IDENTIFIER_LEN";
    1451           0 :         case SQL_MAX_INDEX_SIZE:
    1452           0 :                 return "SQL_MAX_INDEX_SIZE";
    1453           0 :         case SQL_MAX_PROCEDURE_NAME_LEN:
    1454           0 :                 return "SQL_MAX_PROCEDURE_NAME_LEN";
    1455           0 :         case SQL_MAX_ROW_SIZE:
    1456           0 :                 return "SQL_MAX_ROW_SIZE";
    1457           0 :         case SQL_MAX_ROW_SIZE_INCLUDES_LONG:
    1458           0 :                 return "SQL_MAX_ROW_SIZE_INCLUDES_LONG";
    1459           0 :         case SQL_MAX_SCHEMA_NAME_LEN:
    1460           0 :                 return "SQL_MAX_SCHEMA_NAME_LEN";
    1461           0 :         case SQL_MAX_STATEMENT_LEN:
    1462           0 :                 return "SQL_MAX_STATEMENT_LEN";
    1463           0 :         case SQL_MAX_TABLE_NAME_LEN:
    1464           0 :                 return "SQL_MAX_TABLE_NAME_LEN";
    1465           0 :         case SQL_MAX_TABLES_IN_SELECT:
    1466           0 :                 return "SQL_MAX_TABLES_IN_SELECT";
    1467           0 :         case SQL_MAX_USER_NAME_LEN:
    1468           0 :                 return "SQL_MAX_USER_NAME_LEN";
    1469           0 :         case SQL_MULTIPLE_ACTIVE_TXN:
    1470           0 :                 return "SQL_MULTIPLE_ACTIVE_TXN";
    1471           0 :         case SQL_MULT_RESULT_SETS:
    1472           0 :                 return "SQL_MULT_RESULT_SETS";
    1473           0 :         case SQL_NEED_LONG_DATA_LEN:
    1474           0 :                 return "SQL_NEED_LONG_DATA_LEN";
    1475           0 :         case SQL_NON_NULLABLE_COLUMNS:
    1476           0 :                 return "SQL_NON_NULLABLE_COLUMNS";
    1477           0 :         case SQL_NULL_COLLATION:
    1478           0 :                 return "SQL_NULL_COLLATION";
    1479           0 :         case SQL_NUMERIC_FUNCTIONS:
    1480           0 :                 return "SQL_NUMERIC_FUNCTIONS";
    1481           0 :         case SQL_ODBC_API_CONFORMANCE:
    1482           0 :                 return "SQL_ODBC_API_CONFORMANCE";
    1483           0 :         case SQL_ODBC_INTERFACE_CONFORMANCE:
    1484           0 :                 return "SQL_ODBC_INTERFACE_CONFORMANCE";
    1485           0 :         case SQL_ODBC_SAG_CLI_CONFORMANCE:
    1486           0 :                 return "SQL_ODBC_SAG_CLI_CONFORMANCE";
    1487           0 :         case SQL_ODBC_SQL_CONFORMANCE:
    1488           0 :                 return "SQL_ODBC_SQL_CONFORMANCE";
    1489             : #ifdef SQL_ODBC_STANDARD_CLI_CONFORMANCE
    1490             :         case SQL_ODBC_STANDARD_CLI_CONFORMANCE:
    1491             :                 return "SQL_ODBC_STANDARD_CLI_CONFORMANCE";
    1492             : #endif
    1493           0 :         case SQL_ODBC_VER:
    1494           0 :                 return "SQL_ODBC_VER";
    1495           0 :         case SQL_OJ_CAPABILITIES:
    1496           0 :                 return "SQL_OJ_CAPABILITIES";
    1497           0 :         case SQL_ORDER_BY_COLUMNS_IN_SELECT:
    1498           0 :                 return "SQL_ORDER_BY_COLUMNS_IN_SELECT";
    1499           0 :         case SQL_OUTER_JOINS:
    1500           0 :                 return "SQL_OUTER_JOINS";
    1501           0 :         case SQL_PARAM_ARRAY_ROW_COUNTS:
    1502           0 :                 return "SQL_PARAM_ARRAY_ROW_COUNTS";
    1503           0 :         case SQL_PARAM_ARRAY_SELECTS:
    1504           0 :                 return "SQL_PARAM_ARRAY_SELECTS";
    1505           0 :         case SQL_POSITIONED_STATEMENTS:
    1506           0 :                 return "SQL_POSITIONED_STATEMENTS";
    1507           0 :         case SQL_POS_OPERATIONS:
    1508           0 :                 return "SQL_POS_OPERATIONS";
    1509           0 :         case SQL_PROCEDURES:
    1510           0 :                 return "SQL_PROCEDURES";
    1511           0 :         case SQL_PROCEDURE_TERM:
    1512           0 :                 return "SQL_PROCEDURE_TERM";
    1513           0 :         case SQL_QUOTED_IDENTIFIER_CASE:
    1514           0 :                 return "SQL_QUOTED_IDENTIFIER_CASE";
    1515           0 :         case SQL_ROW_UPDATES:
    1516           0 :                 return "SQL_ROW_UPDATES";
    1517           0 :         case SQL_SCHEMA_TERM:
    1518           0 :                 return "SQL_SCHEMA_TERM";
    1519           0 :         case SQL_SCHEMA_USAGE:
    1520           0 :                 return "SQL_SCHEMA_USAGE";
    1521           0 :         case SQL_SCROLL_CONCURRENCY:
    1522           0 :                 return "SQL_SCROLL_CONCURRENCY";
    1523           0 :         case SQL_SCROLL_OPTIONS:
    1524           0 :                 return "SQL_SCROLL_OPTIONS";
    1525           0 :         case SQL_SEARCH_PATTERN_ESCAPE:
    1526           0 :                 return "SQL_SEARCH_PATTERN_ESCAPE";
    1527           0 :         case SQL_SERVER_NAME:
    1528           0 :                 return "SQL_SERVER_NAME";
    1529           0 :         case SQL_SPECIAL_CHARACTERS:
    1530           0 :                 return "SQL_SPECIAL_CHARACTERS";
    1531           0 :         case SQL_SQL92_DATETIME_FUNCTIONS:
    1532           0 :                 return "SQL_SQL92_DATETIME_FUNCTIONS";
    1533           0 :         case SQL_SQL92_FOREIGN_KEY_DELETE_RULE:
    1534           0 :                 return "SQL_SQL92_FOREIGN_KEY_DELETE_RULE";
    1535           0 :         case SQL_SQL92_FOREIGN_KEY_UPDATE_RULE:
    1536           0 :                 return "SQL_SQL92_FOREIGN_KEY_UPDATE_RULE";
    1537           0 :         case SQL_SQL92_GRANT:
    1538           0 :                 return "SQL_SQL92_GRANT";
    1539           0 :         case SQL_SQL92_NUMERIC_VALUE_FUNCTIONS:
    1540           0 :                 return "SQL_SQL92_NUMERIC_VALUE_FUNCTIONS";
    1541           0 :         case SQL_SQL92_PREDICATES:
    1542           0 :                 return "SQL_SQL92_PREDICATES";
    1543           0 :         case SQL_SQL92_RELATIONAL_JOIN_OPERATORS:
    1544           0 :                 return "SQL_SQL92_RELATIONAL_JOIN_OPERATORS";
    1545           0 :         case SQL_SQL92_REVOKE:
    1546           0 :                 return "SQL_SQL92_REVOKE";
    1547           0 :         case SQL_SQL92_ROW_VALUE_CONSTRUCTOR:
    1548           0 :                 return "SQL_SQL92_ROW_VALUE_CONSTRUCTOR";
    1549           0 :         case SQL_SQL92_STRING_FUNCTIONS:
    1550           0 :                 return "SQL_SQL92_STRING_FUNCTIONS";
    1551           0 :         case SQL_SQL92_VALUE_EXPRESSIONS:
    1552           0 :                 return "SQL_SQL92_VALUE_EXPRESSIONS";
    1553           0 :         case SQL_SQL_CONFORMANCE:
    1554           0 :                 return "SQL_SQL_CONFORMANCE";
    1555           0 :         case SQL_STANDARD_CLI_CONFORMANCE:
    1556           0 :                 return "SQL_STANDARD_CLI_CONFORMANCE";
    1557           0 :         case SQL_STATIC_CURSOR_ATTRIBUTES1:
    1558           0 :                 return "SQL_STATIC_CURSOR_ATTRIBUTES1";
    1559           0 :         case SQL_STATIC_CURSOR_ATTRIBUTES2:
    1560           0 :                 return "SQL_STATIC_CURSOR_ATTRIBUTES2";
    1561           0 :         case SQL_STATIC_SENSITIVITY:
    1562           0 :                 return "SQL_STATIC_SENSITIVITY";
    1563           0 :         case SQL_STRING_FUNCTIONS:
    1564           0 :                 return "SQL_STRING_FUNCTIONS";
    1565           0 :         case SQL_SUBQUERIES:
    1566           0 :                 return "SQL_SUBQUERIES";
    1567           0 :         case SQL_SYSTEM_FUNCTIONS:
    1568           0 :                 return "SQL_SYSTEM_FUNCTIONS";
    1569           0 :         case SQL_TABLE_TERM:
    1570           0 :                 return "SQL_TABLE_TERM";
    1571           0 :         case SQL_TIMEDATE_ADD_INTERVALS:
    1572           0 :                 return "SQL_TIMEDATE_ADD_INTERVALS";
    1573           0 :         case SQL_TIMEDATE_DIFF_INTERVALS:
    1574           0 :                 return "SQL_TIMEDATE_DIFF_INTERVALS";
    1575           0 :         case SQL_TIMEDATE_FUNCTIONS:
    1576           0 :                 return "SQL_TIMEDATE_FUNCTIONS";
    1577           0 :         case SQL_TXN_CAPABLE:
    1578           0 :                 return "SQL_TXN_CAPABLE";
    1579           0 :         case SQL_TXN_ISOLATION_OPTION:
    1580           0 :                 return "SQL_TXN_ISOLATION_OPTION";
    1581           0 :         case SQL_UNION:
    1582           0 :                 return "SQL_UNION";
    1583           0 :         case SQL_USER_NAME:
    1584           0 :                 return "SQL_USER_NAME";
    1585           0 :         case SQL_XOPEN_CLI_YEAR:
    1586           0 :                 return "SQL_XOPEN_CLI_YEAR";
    1587           0 :         default:
    1588           0 :                 snprintf(unknown, sizeof(unknown), "unknown (%u)",
    1589             :                          (unsigned int) InfoType);
    1590           0 :                 return unknown;
    1591             :         }
    1592             : }
    1593             : #endif
    1594             : 
    1595             : SQLRETURN SQL_API
    1596             : SQLGetInfo(SQLHDBC ConnectionHandle,
    1597             :            SQLUSMALLINT InfoType,
    1598             :            SQLPOINTER InfoValuePtr,
    1599             :            SQLSMALLINT BufferLength,
    1600             :            SQLSMALLINT *StringLengthPtr)
    1601             : {
    1602             :         ODBCDbc *dbc = (ODBCDbc *) ConnectionHandle;
    1603             : 
    1604             : #ifdef ODBCDEBUG
    1605         160 :         ODBCLOG("SQLGetInfo %p %s %p %d %p\n",
    1606             :                 ConnectionHandle, translateInfoType(InfoType),
    1607             :                 InfoValuePtr, (int) BufferLength,
    1608             :                 StringLengthPtr);
    1609             : #endif
    1610             : 
    1611         160 :         if (!isValidDbc(dbc))
    1612             :                 return SQL_INVALID_HANDLE;
    1613             : 
    1614         160 :         clearDbcErrors(dbc);
    1615             : 
    1616         160 :         return MNDBGetInfo(dbc,
    1617             :                            InfoType,
    1618             :                            InfoValuePtr,
    1619             :                            BufferLength,
    1620             :                            StringLengthPtr);
    1621             : }
    1622             : 
    1623             : SQLRETURN SQL_API
    1624             : SQLGetInfoA(SQLHDBC ConnectionHandle,
    1625             :             SQLUSMALLINT InfoType,
    1626             :             SQLPOINTER InfoValuePtr,
    1627             :             SQLSMALLINT BufferLength,
    1628             :             SQLSMALLINT *StringLengthPtr)
    1629             : {
    1630           0 :         return SQLGetInfo(ConnectionHandle,
    1631             :                           InfoType,
    1632             :                           InfoValuePtr,
    1633             :                           BufferLength,
    1634             :                           StringLengthPtr);
    1635             : }
    1636             : 
    1637             : SQLRETURN SQL_API
    1638             : SQLGetInfoW(SQLHDBC ConnectionHandle,
    1639             :             SQLUSMALLINT InfoType,
    1640             :             SQLPOINTER InfoValuePtr,
    1641             :             SQLSMALLINT BufferLength,
    1642             :             SQLSMALLINT *StringLengthPtr)
    1643             : {
    1644             :         ODBCDbc *dbc = (ODBCDbc *) ConnectionHandle;
    1645             :         SQLRETURN rc;
    1646             :         SQLPOINTER ptr;
    1647             :         SQLSMALLINT n;
    1648             : 
    1649             : #ifdef ODBCDEBUG
    1650           0 :         ODBCLOG("SQLGetInfoW %p %s %p %d %p\n",
    1651             :                 ConnectionHandle, translateInfoType(InfoType),
    1652             :                 InfoValuePtr, (int) BufferLength,
    1653             :                 StringLengthPtr);
    1654             : #endif
    1655             : 
    1656           0 :         if (!isValidDbc(dbc))
    1657             :                 return SQL_INVALID_HANDLE;
    1658             : 
    1659           0 :         clearDbcErrors(dbc);
    1660             : 
    1661           0 :         switch (InfoType) {
    1662             :         /* all string attributes */
    1663           0 :         case SQL_ACCESSIBLE_PROCEDURES:
    1664             :         case SQL_ACCESSIBLE_TABLES:
    1665             :         case SQL_CATALOG_NAME:
    1666             :         case SQL_CATALOG_NAME_SEPARATOR:
    1667             :         case SQL_CATALOG_TERM:
    1668             :         case SQL_COLLATION_SEQ:
    1669             :         case SQL_COLUMN_ALIAS:
    1670             :         case SQL_DATABASE_NAME:
    1671             :         case SQL_DATA_SOURCE_NAME:
    1672             :         case SQL_DATA_SOURCE_READ_ONLY:
    1673             :         case SQL_DBMS_NAME:
    1674             :         case SQL_DBMS_VER:
    1675             :         case SQL_DESCRIBE_PARAMETER:
    1676             :         case SQL_DM_VER:
    1677             :         case SQL_DRIVER_NAME:
    1678             :         case SQL_DRIVER_ODBC_VER:
    1679             :         case SQL_DRIVER_VER:
    1680             :         case SQL_EXPRESSIONS_IN_ORDERBY:
    1681             :         case SQL_IDENTIFIER_QUOTE_CHAR:
    1682             :         case SQL_INTEGRITY:
    1683             :         case SQL_KEYWORDS:
    1684             :         case SQL_LIKE_ESCAPE_CLAUSE:
    1685             :         case SQL_MAX_ROW_SIZE_INCLUDES_LONG:
    1686             :         case SQL_MULTIPLE_ACTIVE_TXN:
    1687             :         case SQL_MULT_RESULT_SETS:
    1688             :         case SQL_NEED_LONG_DATA_LEN:
    1689             :         case SQL_ODBC_VER:
    1690             :         case SQL_ORDER_BY_COLUMNS_IN_SELECT:
    1691             :         case SQL_OUTER_JOINS:
    1692             :         case SQL_PROCEDURES:
    1693             :         case SQL_PROCEDURE_TERM:
    1694             :         case SQL_ROW_UPDATES:
    1695             :         case SQL_SCHEMA_TERM:
    1696             :         case SQL_SEARCH_PATTERN_ESCAPE:
    1697             :         case SQL_SERVER_NAME:
    1698             :         case SQL_SPECIAL_CHARACTERS:
    1699             :         case SQL_TABLE_TERM:
    1700             :         case SQL_USER_NAME:
    1701             :         case SQL_XOPEN_CLI_YEAR:
    1702           0 :                 ptr = malloc(BufferLength);
    1703           0 :                 if (ptr == NULL) {
    1704             :                         /* Memory allocation error */
    1705           0 :                         addDbcError(dbc, "HY001", NULL, 0);
    1706           0 :                         return SQL_ERROR;
    1707             :                 }
    1708             :                 break;
    1709             :         default:
    1710             :                 ptr = InfoValuePtr;
    1711             :                 break;
    1712             :         }
    1713             : 
    1714           0 :         rc = MNDBGetInfo(dbc, InfoType, ptr, BufferLength, &n);
    1715             : 
    1716           0 :         if (ptr != InfoValuePtr) {
    1717           0 :                 if (rc == SQL_SUCCESS_WITH_INFO) {
    1718           0 :                         clearDbcErrors(dbc);
    1719           0 :                         free(ptr);
    1720           0 :                         ptr = malloc(++n); /* add one for NULL byte */
    1721           0 :                         if (ptr == NULL) {
    1722             :                                 /* Memory allocation error */
    1723           0 :                                 addDbcError(dbc, "HY001", NULL, 0);
    1724           0 :                                 return SQL_ERROR;
    1725             :                         }
    1726           0 :                         rc = MNDBGetInfo(dbc, InfoType, ptr, n, &n);
    1727             :                 }
    1728           0 :                 if (SQL_SUCCEEDED(rc)) {
    1729           0 :                         fixWcharOut(rc, ptr, n, InfoValuePtr, BufferLength,
    1730             :                                     StringLengthPtr, 2, addDbcError, dbc);
    1731             :                 }
    1732           0 :                 free(ptr);
    1733           0 :         } else if (StringLengthPtr)
    1734           0 :                 *StringLengthPtr = n;
    1735             : 
    1736             :         return rc;
    1737             : }

Generated by: LCOV version 1.14