Exemplo n.º 1
0
static void
_trace_func_name (SQLUSMALLINT fFunc, int format)
{
  char *ptr = "unknown function";

  switch (fFunc)
    {
/* All ODBC 2.x functions */
      _S (SQL_API_ALL_FUNCTIONS);

/* ODBC 2.x */
      _S (SQL_API_SQLALLOCCONNECT);
      _S (SQL_API_SQLALLOCENV);
      _S (SQL_API_SQLALLOCSTMT);
      _S (SQL_API_SQLBINDCOL);
      _S (SQL_API_SQLBINDPARAMETER);
      _S (SQL_API_SQLBROWSECONNECT);
      _S (SQL_API_SQLCANCEL);
#if (ODBCVER < 0x0300)
      _S (SQL_API_SQLCOLATTRIBUTES);
#endif
      _S (SQL_API_SQLCOLUMNPRIVILEGES);
      _S (SQL_API_SQLCOLUMNS);
      _S (SQL_API_SQLCONNECT);
      _S (SQL_API_SQLDATASOURCES);
      _S (SQL_API_SQLDESCRIBECOL);
      _S (SQL_API_SQLDESCRIBEPARAM);
      _S (SQL_API_SQLDISCONNECT);
      _S (SQL_API_SQLDRIVERCONNECT);
      _S (SQL_API_SQLDRIVERS);
      _S (SQL_API_SQLERROR);
      _S (SQL_API_SQLEXECDIRECT);
      _S (SQL_API_SQLEXECUTE);
      _S (SQL_API_SQLEXTENDEDFETCH);
      _S (SQL_API_SQLFETCH);
      _S (SQL_API_SQLFOREIGNKEYS);
      _S (SQL_API_SQLFREECONNECT);
      _S (SQL_API_SQLFREEENV);
      _S (SQL_API_SQLFREESTMT);
      _S (SQL_API_SQLGETCONNECTOPTION);
      _S (SQL_API_SQLGETCURSORNAME);
      _S (SQL_API_SQLGETDATA);
      _S (SQL_API_SQLGETFUNCTIONS);
      _S (SQL_API_SQLGETINFO);
      _S (SQL_API_SQLGETSTMTOPTION);
      _S (SQL_API_SQLGETTYPEINFO);
      _S (SQL_API_SQLMORERESULTS);
      _S (SQL_API_SQLNATIVESQL);
      _S (SQL_API_SQLNUMPARAMS);
      _S (SQL_API_SQLNUMRESULTCOLS);
      _S (SQL_API_SQLPARAMDATA);
      _S (SQL_API_SQLPARAMOPTIONS);
      _S (SQL_API_SQLPREPARE);
      _S (SQL_API_SQLPRIMARYKEYS);
      _S (SQL_API_SQLPROCEDURECOLUMNS);
      _S (SQL_API_SQLPROCEDURES);
      _S (SQL_API_SQLPUTDATA);
      _S (SQL_API_SQLROWCOUNT);
      _S (SQL_API_SQLSETCONNECTOPTION);
      _S (SQL_API_SQLSETCURSORNAME);
      _S (SQL_API_SQLSETPARAM);
      _S (SQL_API_SQLSETPOS);
      _S (SQL_API_SQLSETSCROLLOPTIONS);
      _S (SQL_API_SQLSETSTMTOPTION);
      _S (SQL_API_SQLSPECIALCOLUMNS);
      _S (SQL_API_SQLSTATISTICS);
      _S (SQL_API_SQLTABLEPRIVILEGES);
      _S (SQL_API_SQLTABLES);
      _S (SQL_API_SQLTRANSACT);
#if (ODBCVER >= 0x0300)
/* All ODBC 2.x functions */
      _S (SQL_API_ODBC3_ALL_FUNCTIONS);

/* ODBC 3.x */
      _S (SQL_API_SQLALLOCHANDLE);
      _S (SQL_API_SQLALLOCHANDLESTD);
      _S (SQL_API_SQLBINDPARAM);
      _S (SQL_API_SQLBULKOPERATIONS);
      _S (SQL_API_SQLCLOSECURSOR);
      _S (SQL_API_SQLCOLATTRIBUTE);
      _S (SQL_API_SQLCOPYDESC);
      _S (SQL_API_SQLENDTRAN);
      _S (SQL_API_SQLFETCHSCROLL);
      _S (SQL_API_SQLFREEHANDLE);
      _S (SQL_API_SQLGETCONNECTATTR);
      _S (SQL_API_SQLGETDESCFIELD);
      _S (SQL_API_SQLGETDESCREC);
      _S (SQL_API_SQLGETDIAGFIELD);
      _S (SQL_API_SQLGETDIAGREC);
      _S (SQL_API_SQLGETENVATTR);
      _S (SQL_API_SQLGETSTMTATTR);
      _S (SQL_API_SQLSETCONNECTATTR);
      _S (SQL_API_SQLSETDESCFIELD);
      _S (SQL_API_SQLSETDESCREC);
      _S (SQL_API_SQLSETENVATTR);
      _S (SQL_API_SQLSETSTMTATTR);

#endif
    }

  if (format)
    trace_emit ("\t\t%-15.15s   %d (%s)\n", "SQLUSMALLINT", (int) fFunc, ptr);
  else
    trace_emit_string (ptr, SQL_NTS, 0);
}
Exemplo n.º 2
0
void
_trace_data (
  SQLSMALLINT		  fCType,
  SQLPOINTER		  rgbValue,
  SQLLEN		  cbValueMax,
  SQLLEN	    	* pcbValue,
  int			  output)
{
  char buf[1024];		/* Temp buffer */

  if (!rgbValue)
    {
      trace_emit ("\t\t%-15.15s   0x0\n", "SQLPOINTER");
      return;
    }

  trace_emit ("\t\t%-15.15s   %p\n", "SQLPOINTER", rgbValue);

  if (!output)
    return;			/* Only print buffer content on leave */

  switch (fCType)
    {
    case SQL_C_BINARY:
      {
        ssize_t len = cbValueMax;
	if (pcbValue)
	  len = *pcbValue;
  	if (len > cbValueMax)
	  len = cbValueMax;
	trace_emit_binary ((unsigned char *) rgbValue, len);
      }
      break;

    case SQL_C_BIT:
      {
	int i = (int) *(char *) rgbValue;
	sprintf (buf, "%d", i > 0 ? 1 : 0);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_CHAR:
      {
	ssize_t len = cbValueMax;
	if (pcbValue)
	  len = (long) *pcbValue;
	if (len > cbValueMax)
	  len = cbValueMax;
	trace_emit_string ((SQLCHAR *) rgbValue, len, 0);
      }
      break;

    case SQL_C_DATE:
#if ODBCVER >= 0x0300
    case SQL_C_TYPE_DATE:
#endif
      {
	DATE_STRUCT *d = (DATE_STRUCT *) rgbValue;
	sprintf (buf, "%04d-%02d-%02d", d->year, d->month, d->day);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_DEFAULT:
      /*
       *  Not enough information to dump the content of the buffer
       */
      return;

    case SQL_C_DOUBLE:
      {
	double d = *(double *) rgbValue;
	sprintf (buf, "%f", d);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_FLOAT:
      {
	float f = *(float *) rgbValue;
	sprintf (buf, "%f", f);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

#if (ODBCVER >= 0x0350)
    case SQL_C_GUID:
      {
	SQLGUID *g = (SQLGUID *) rgbValue;
	sprintf (buf,
	    "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
	    (unsigned long) g->Data1,
	    g->Data2, g->Data3,
	    g->Data4[0], g->Data4[1], g->Data4[2], g->Data4[3],
            g->Data4[4], g->Data4[5], g->Data4[6], g->Data4[7]);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;
#endif

#if ODBCVER >= 0x0300
    case SQL_C_INTERVAL_DAY:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu days",
	    (unsigned long) i->intval.day_second.day);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_DAY_TO_HOUR:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu days %lu hours",
	    (unsigned long) i->intval.day_second.day,
	    (unsigned long) i->intval.day_second.hour);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_DAY_TO_MINUTE:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu days %lu hours %lu minutes",
	    (unsigned long) i->intval.day_second.day,
	    (unsigned long) i->intval.day_second.hour,
	    (unsigned long) i->intval.day_second.minute);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_DAY_TO_SECOND:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu days %lu hours %lu minutes %lu seconds",
	    (unsigned long) i->intval.day_second.day,
	    (unsigned long) i->intval.day_second.hour,
	    (unsigned long) i->intval.day_second.minute,
	    (unsigned long) i->intval.day_second.second);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_HOUR:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu hours",
	    (unsigned long) i->intval.day_second.hour);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_HOUR_TO_MINUTE:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu hours %lu minutes",
	    (unsigned long) i->intval.day_second.hour,
	    (unsigned long) i->intval.day_second.minute);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_HOUR_TO_SECOND:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu hours %lu minutes %lu seconds",
	    (unsigned long) i->intval.day_second.hour,
	    (unsigned long) i->intval.day_second.minute,
	    (unsigned long) i->intval.day_second.second);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_MINUTE:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu minutes",
	    (unsigned long) i->intval.day_second.minute);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_MINUTE_TO_SECOND:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu minutes %lu seconds",
	    (unsigned long) i->intval.day_second.minute,
	    (unsigned long) i->intval.day_second.second);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_MONTH:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu months",
	    (unsigned long) i->intval.year_month.month);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_SECOND:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu seconds",
	    (unsigned long) i->intval.day_second.second);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_YEAR:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu years",
	    (unsigned long) i->intval.year_month.year);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_INTERVAL_YEAR_TO_MONTH:
      {
	SQL_INTERVAL_STRUCT *i = (SQL_INTERVAL_STRUCT *) rgbValue;
	sprintf (buf, "%lu years %lu months",
	    (unsigned long) i->intval.year_month.year,
	    (unsigned long) i->intval.year_month.month);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;
#endif

    case SQL_C_LONG:
    case SQL_C_SLONG:
      {
	long l = *(long *) rgbValue;
	sprintf (buf, "%ld", l);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_ULONG:
      {
	unsigned long l = *(unsigned long *) rgbValue;
	sprintf (buf, "%lu", l);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;


#if ODBCVER >= 0x0300
    case SQL_C_NUMERIC:
      /* NOT YET */
      break;
#endif

#if ODBCVER >= 0x0300
    case SQL_C_SBIGINT:
#if defined (ODBCINT64)
      {
	ODBCINT64 l = *(ODBCINT64 *) rgbValue;
	sprintf (buf, "%lld", (long long int)l);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
#endif
      break;

    case SQL_C_UBIGINT:
#if defined (ODBCINT64)
      {
	unsigned ODBCINT64 l = *(unsigned ODBCINT64 *) rgbValue;
	sprintf (buf, "%llu", (long long unsigned int)l);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
#endif
      break;
#endif

    case SQL_C_SHORT:
    case SQL_C_SSHORT:
      {
	int i = (int) *(short *) rgbValue;
	sprintf (buf, "%d", i);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_USHORT:
      {
	unsigned int i = (unsigned int) *(unsigned short *) rgbValue;
	sprintf (buf, "%u", i);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_TIME:
#if ODBCVER >= 0x0300
    case SQL_C_TYPE_TIME:
#endif
      {
	TIME_STRUCT *t = (TIME_STRUCT *) rgbValue;
	sprintf (buf, "%02d:%02d:%02d", t->hour, t->minute, t->second);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_TIMESTAMP:
#if ODBCVER >= 0x0300
    case SQL_C_TYPE_TIMESTAMP:
#endif
      {
	TIMESTAMP_STRUCT *t = (TIMESTAMP_STRUCT *) rgbValue;
	sprintf (buf, "%04d-%02d-%02d %02d:%02d:%02d.%06ld",
	    t->year, t->month, t->day,
	    t->hour, t->minute, t->second, 
	    (long) t->fraction);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_TINYINT:
    case SQL_C_STINYINT:
      {
	int i = (int) *(char *) rgbValue;
	sprintf (buf, "%d", i);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_UTINYINT:
      {
	unsigned int i = (unsigned int) *(unsigned char *) rgbValue;
	sprintf (buf, "%u", i);
	trace_emit_string ((SQLCHAR *) buf, SQL_NTS, 0);
      }
      break;

    case SQL_C_WCHAR:
      {
	SQLCHAR *wstr;
        ssize_t len;
	if (pcbValue)
	  len = (ssize_t) *pcbValue;
        if (len > cbValueMax)
	  len = cbValueMax;
	wstr = dm_SQL_W2A ((wchar_t *) rgbValue, len);
	trace_emit_string (wstr, SQL_NTS, 1);
	free (wstr);
      }
      break;

    default:
      /*
       *  Unhandled/Unknown datatype
       */
      break;
    }

  return;
}
Exemplo n.º 3
0
/*
 *  Decode the various GetInfo return values and print them into the trace log
 */
static void
_trace_getinfo (
  SQLUSMALLINT		  fInfoType,
  SQLPOINTER		  rgbInfoValue,
  SQLSMALLINT		  cbInfoValueMax,
  SQLSMALLINT    	* pcbInfoValue,
  int			  output,
  char			  waMode)
{
  char *infoname;
  char **mask;
  int elem;
  int i;

  cbInfoValueMax = cbInfoValueMax;	/*UNUSED*/
  pcbInfoValue = pcbInfoValue;		/*UNUSED*/

  /*
   *  If the pointer is NULL, we have no information to decode, so
   *  we just print the generic details.
   */
  if (!rgbInfoValue)
    output = 0;

  switch (fInfoType)
    {

      /*
       *  ODBC 1.0
       */
      I_STR (SQL_ACCESSIBLE_TABLES);

      I_STR (SQL_ACCESSIBLE_PROCEDURES);

#if (ODBCVER < 0x0300)
      I_INT16 (SQL_ACTIVE_CONNECTIONS);	/* 3.0: SQL_MAX_DRIVER_CONNECTIONS */
#endif

#if (ODBCVER < 0x0300)
      I_INT16 (SQL_ACTIVE_STATEMENTS);  /* 3.0: SQL_MAX_CONCURRENT_ACTIVITIES */
#endif

      I_SVAL (SQL_CONCAT_NULL_BEHAVIOR);

      I_MASK (SQL_CONVERT_FUNCTIONS);

      I_MASK1 (SQL_CONVERT_BIGINT, CONVERT);
      I_MASK1 (SQL_CONVERT_BINARY, CONVERT);
      I_MASK1 (SQL_CONVERT_BIT, CONVERT);
      I_MASK1 (SQL_CONVERT_CHAR, CONVERT);
      I_MASK1 (SQL_CONVERT_DATE, CONVERT);
      I_MASK1 (SQL_CONVERT_DECIMAL, CONVERT);
      I_MASK1 (SQL_CONVERT_DOUBLE, CONVERT);
      I_MASK1 (SQL_CONVERT_FLOAT, CONVERT);
      I_MASK1 (SQL_CONVERT_INTEGER, CONVERT);
      I_MASK1 (SQL_CONVERT_LONGVARBINARY, CONVERT);
      I_MASK1 (SQL_CONVERT_LONGVARCHAR, CONVERT);
      I_MASK1 (SQL_CONVERT_NUMERIC, CONVERT);
      I_MASK1 (SQL_CONVERT_REAL, CONVERT);
      I_MASK1 (SQL_CONVERT_SMALLINT, CONVERT);
      I_MASK1 (SQL_CONVERT_TIME, CONVERT);
      I_MASK1 (SQL_CONVERT_TIMESTAMP, CONVERT);
      I_MASK1 (SQL_CONVERT_TINYINT, CONVERT);
      I_MASK1 (SQL_CONVERT_VARBINARY, CONVERT);
      I_MASK1 (SQL_CONVERT_VARCHAR, CONVERT);

      I_SVAL1 (SQL_CURSOR_COMMIT_BEHAVIOR, CURSOR_BEHAVIOR);

      I_SVAL1 (SQL_CURSOR_ROLLBACK_BEHAVIOR, CURSOR_BEHAVIOR);

      I_STR (SQL_DATA_SOURCE_NAME);

      I_STR (SQL_DATA_SOURCE_READ_ONLY);

      I_STR (SQL_DATABASE_NAME);

      I_STR (SQL_DBMS_NAME);

      I_STR (SQL_DBMS_VER);

      I_MASK1 (SQL_DEFAULT_TXN_ISOLATION, TXN_ISOLATION);

      I_INT32 (SQL_DRIVER_HDBC);

      I_INT32 (SQL_DRIVER_HENV);

      I_INT32 (SQL_DRIVER_HSTMT);

      I_STR (SQL_DRIVER_NAME);

      I_STR (SQL_DRIVER_VER);

      I_STR (SQL_EXPRESSIONS_IN_ORDERBY);

      I_MASK (SQL_FETCH_DIRECTION);

      I_SVAL1 (SQL_IDENTIFIER_CASE, IDENTIFIER_CASE);

      I_STR (SQL_IDENTIFIER_QUOTE_CHAR);

      I_INT16 (SQL_MAX_COLUMN_NAME_LEN);

      I_INT16 (SQL_MAX_CURSOR_NAME_LEN);

#if (ODBCVER < 0x0300)
      I_INT16 (SQL_MAX_OWNER_NAME_LEN); /* 3.0: SQL_MAX_SCHEMA_NAME_LEN */
#endif

      I_INT16 (SQL_MAX_PROCEDURE_NAME_LEN);

#if (ODBCVER < 0x0300)
      I_INT16 (SQL_MAX_QUALIFIER_NAME_LEN); /* 3.0: SQL_MAX_CATALOG_NAME_LEN */
#endif

      I_INT16 (SQL_MAX_TABLE_NAME_LEN);

      I_STR (SQL_MULT_RESULT_SETS);

      I_STR (SQL_MULTIPLE_ACTIVE_TXN);

      I_MASK (SQL_NUMERIC_FUNCTIONS);

      I_SVAL (SQL_ODBC_API_CONFORMANCE);

      I_SVAL (SQL_ODBC_SAG_CLI_CONFORMANCE);

      I_SVAL (SQL_ODBC_SQL_CONFORMANCE);

      I_STR (SQL_ODBC_VER);

#if (ODBCVER < 0x0300)
      I_STR (SQL_ODBC_SQL_OPT_IEF); /* 3.0: SQL_INTEGRITY */
#endif

#if (ODBCVER < 0x0300)
      I_STR (SQL_OWNER_TERM); /* 3.0: SQL_SCHEMA_TERM */
#endif

      I_STR (SQL_OUTER_JOINS);

      I_STR (SQL_PROCEDURE_TERM);

      I_STR (SQL_PROCEDURES);

#if (ODBCVER < 0x0300)
      I_STR (SQL_QUALIFIER_NAME_SEPARATOR); /* 3.0: SQL_CATALOG_NAME_SEPARATOR */
#endif

#if (ODBCVER < 0x0300)
      I_STR (SQL_QUALIFIER_TERM); /* 3.0: SQL_CATALOG_TERM */
#endif

      I_STR (SQL_ROW_UPDATES);

      I_MASK (SQL_SCROLL_CONCURRENCY);

      I_MASK (SQL_SCROLL_OPTIONS);

      I_STR (SQL_SEARCH_PATTERN_ESCAPE);

      I_STR (SQL_SERVER_NAME);

      I_MASK (SQL_STRING_FUNCTIONS);

      I_MASK (SQL_SYSTEM_FUNCTIONS);

      I_STR (SQL_TABLE_TERM);

      I_MASK (SQL_TIMEDATE_FUNCTIONS);

      I_SVAL (SQL_TXN_CAPABLE);

      I_MASK1 (SQL_TXN_ISOLATION_OPTION, TXN_ISOLATION);

      I_STR (SQL_USER_NAME);


      /*
       * ODBC 1.0 Additions
       */
      I_SVAL (SQL_CORRELATION_NAME);

      I_SVAL (SQL_NON_NULLABLE_COLUMNS);


      /*
       *  ODBC 2.0 Additions
       */
      I_MASK (SQL_ALTER_TABLE);

      I_MASK (SQL_BOOKMARK_PERSISTENCE);

      I_STR (SQL_COLUMN_ALIAS);

      I_INT32 (SQL_DRIVER_HLIB);

      I_STR (SQL_DRIVER_ODBC_VER);

      I_MASK (SQL_GETDATA_EXTENSIONS);

      I_SVAL (SQL_GROUP_BY);

      I_SVAL (SQL_FILE_USAGE);

      I_STR (SQL_KEYWORDS);

      I_STR (SQL_LIKE_ESCAPE_CLAUSE);

      I_MASK (SQL_LOCK_TYPES);

      I_INT32 (SQL_MAX_BINARY_LITERAL_LEN);

      I_INT32 (SQL_MAX_CHAR_LITERAL_LEN);

      I_INT16 (SQL_MAX_COLUMNS_IN_GROUP_BY);

      I_INT16 (SQL_MAX_COLUMNS_IN_INDEX);

      I_INT16 (SQL_MAX_COLUMNS_IN_ORDER_BY);

      I_INT16 (SQL_MAX_COLUMNS_IN_SELECT);

      I_INT16 (SQL_MAX_COLUMNS_IN_TABLE);

      I_INT32 (SQL_MAX_INDEX_SIZE);

      I_STR (SQL_MAX_ROW_SIZE_INCLUDES_LONG);

      I_INT32 (SQL_MAX_ROW_SIZE);

      I_INT32 (SQL_MAX_STATEMENT_LEN);

      I_INT16 (SQL_MAX_TABLES_IN_SELECT);

      I_INT16 (SQL_MAX_USER_NAME_LEN);

      I_STR (SQL_NEED_LONG_DATA_LEN);

      I_SVAL (SQL_NULL_COLLATION);

      I_STR (SQL_ORDER_BY_COLUMNS_IN_SELECT);

#if (ODBCVER < 0x0300)
      I_MASK (SQL_OWNER_USAGE);  /* 3.0: SQL_SCHEMA_USAGE */
#endif

      I_MASK (SQL_OJ_CAPABILITIES);

      I_MASK (SQL_POS_OPERATIONS);

      I_MASK (SQL_POSITIONED_STATEMENTS);

#if (ODBCVER < 0x0300)
      I_SVAL (SQL_QUALIFIER_LOCATION); /* 3.0: SQL_CATALOG_LOCATION */
#endif

#if (ODBCVER < 0x0300)
      I_MASK (SQL_QUALIFIER_USAGE); /* 3.0: SQL_CATALOG_USAGE */
#endif

      I_SVAL1 (SQL_QUOTED_IDENTIFIER_CASE, IDENTIFIER_CASE);

      I_STR (SQL_SPECIAL_CHARACTERS);

      I_MASK (SQL_STATIC_SENSITIVITY);

      I_MASK (SQL_SUBQUERIES);

      I_MASK1 (SQL_TIMEDATE_ADD_INTERVALS, TIMEDATE_INTERVALS);

      I_MASK1 (SQL_TIMEDATE_DIFF_INTERVALS, TIMEDATE_INTERVALS);

      I_MASK (SQL_UNION);


      /*
       *  ODBC 3.0
       */
#if (ODBCVER >= 0x0300)
      I_INT16 (SQL_ACTIVE_ENVIRONMENTS);

      I_MASK (SQL_AGGREGATE_FUNCTIONS);

      I_MASK (SQL_ALTER_DOMAIN);

      I_SVAL (SQL_ASYNC_MODE);

      I_MASK (SQL_BATCH_ROW_COUNT);

      I_MASK (SQL_BATCH_SUPPORT);

      I_SVAL (SQL_CATALOG_LOCATION);

      I_STR (SQL_CATALOG_NAME);

      I_STR (SQL_CATALOG_NAME_SEPARATOR);

      I_STR (SQL_CATALOG_TERM);

      I_MASK (SQL_CATALOG_USAGE);

      I_STR (SQL_COLLATION_SEQ);

      I_MASK1 (SQL_CONVERT_INTERVAL_YEAR_MONTH, CONVERT);

      I_MASK1 (SQL_CONVERT_INTERVAL_DAY_TIME, CONVERT);

      I_MASK1 (SQL_CONVERT_WCHAR, CONVERT);

      I_MASK1 (SQL_CONVERT_WLONGVARCHAR, CONVERT);

      I_MASK1 (SQL_CONVERT_WVARCHAR, CONVERT);

      I_MASK (SQL_CREATE_ASSERTION);

      I_MASK (SQL_CREATE_CHARACTER_SET);

      I_MASK (SQL_CREATE_COLLATION);

      I_MASK (SQL_CREATE_DOMAIN);

      I_MASK (SQL_CREATE_SCHEMA);

      I_MASK (SQL_CREATE_TABLE);

      I_MASK (SQL_CREATE_TRANSLATION);

      I_MASK (SQL_CREATE_VIEW);

      I_SVAL (SQL_CURSOR_SENSITIVITY);

      I_MASK (SQL_DATETIME_LITERALS);

      I_MASK (SQL_DDL_INDEX);

      I_STR (SQL_DESCRIBE_PARAMETER);

      I_STR (SQL_DM_VER);

      I_MASK (SQL_DTC_TRANSITION_COST);

      I_MASK (SQL_DROP_ASSERTION);

      I_MASK (SQL_DROP_CHARACTER_SET);

      I_MASK (SQL_DROP_COLLATION);

      I_MASK (SQL_DROP_DOMAIN);

      I_MASK (SQL_DROP_SCHEMA);

      I_MASK (SQL_DROP_TABLE);

      I_MASK (SQL_DROP_TRANSLATION);

      I_MASK (SQL_DROP_VIEW);

      I_MASK1 (SQL_DYNAMIC_CURSOR_ATTRIBUTES1, CURSOR_ATTRIBUTES1);

      I_MASK1 (SQL_DYNAMIC_CURSOR_ATTRIBUTES2, CURSOR_ATTRIBUTES2);

      I_MASK1 (SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1, CURSOR_ATTRIBUTES1);

      I_MASK1 (SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2, CURSOR_ATTRIBUTES2);

      I_MASK (SQL_INDEX_KEYWORDS);

      I_MASK (SQL_INFO_SCHEMA_VIEWS);

      I_MASK (SQL_INSERT_STATEMENT);

      I_STR (SQL_INTEGRITY);

      I_MASK1 (SQL_KEYSET_CURSOR_ATTRIBUTES1, CURSOR_ATTRIBUTES1);

      I_MASK1 (SQL_KEYSET_CURSOR_ATTRIBUTES2, CURSOR_ATTRIBUTES2);

      I_INT32 (SQL_MAX_ASYNC_CONCURRENT_STATEMENTS);

      I_INT16 (SQL_MAX_CATALOG_NAME_LEN);

      I_INT16 (SQL_MAX_CONCURRENT_ACTIVITIES);

      I_INT16 (SQL_MAX_DRIVER_CONNECTIONS);

      I_INT16 (SQL_MAX_IDENTIFIER_LEN);

      I_INT16 (SQL_MAX_SCHEMA_NAME_LEN);

      I_SVAL (SQL_ODBC_INTERFACE_CONFORMANCE);

      I_SVAL (SQL_PARAM_ARRAY_ROW_COUNTS);

      I_SVAL (SQL_PARAM_ARRAY_SELECTS);

      I_STR (SQL_SCHEMA_TERM);

      I_MASK (SQL_SCHEMA_USAGE);

      I_SVAL (SQL_SQL_CONFORMANCE);

      I_MASK (SQL_SQL92_DATETIME_FUNCTIONS);

      I_MASK (SQL_SQL92_FOREIGN_KEY_DELETE_RULE);

      I_MASK (SQL_SQL92_FOREIGN_KEY_UPDATE_RULE);

      I_MASK (SQL_SQL92_GRANT);

      I_MASK (SQL_SQL92_NUMERIC_VALUE_FUNCTIONS);

      I_MASK (SQL_SQL92_PREDICATES);

      I_MASK (SQL_SQL92_RELATIONAL_JOIN_OPERATORS);

      I_MASK (SQL_SQL92_REVOKE);

      I_MASK (SQL_SQL92_ROW_VALUE_CONSTRUCTOR);

      I_MASK (SQL_SQL92_STRING_FUNCTIONS);

      I_MASK (SQL_SQL92_VALUE_EXPRESSIONS);

      I_MASK (SQL_STANDARD_CLI_CONFORMANCE);

      I_MASK1 (SQL_STATIC_CURSOR_ATTRIBUTES1, CURSOR_ATTRIBUTES1);

      I_MASK1 (SQL_STATIC_CURSOR_ATTRIBUTES2, CURSOR_ATTRIBUTES2);

      I_STR (SQL_XOPEN_CLI_YEAR);
#endif

    default:
      infoname = "unknown or driver specific";
      break;
    }


  /*
   *  If we arrive here, just print the generic pointer information
   */
  trace_emit ("\t\t%-15.15s   %d (%s)\n",
      "SQLUSMALLINT", fInfoType, infoname);
  if (rgbInfoValue)
    trace_emit ("\t\t%-15.15s   %p\n", "SQLPOINTER", rgbInfoValue);
  else
    trace_emit ("\t\t%-15.15s   0x0\n", "SQLPOINTER");
  goto print_end;


print_int16:
  trace_emit ("\t\t%-15.15s   %d (%s)\n",
      "SQLUSMALLINT", fInfoType, infoname);
  trace_emit ("\t\t%-15.15s   %p (%ld)\n",
      "SQLPOINTER", rgbInfoValue, (long) *((short *) rgbInfoValue));
  goto print_end;


print_int32:
  trace_emit ("\t\t%-15.15s   %d (%s)\n",
  	"SQLUSMALLINT", fInfoType, infoname);
  trace_emit ("\t\t%-15.15s   %p (%ld)\n",
	"SQLPOINTER", rgbInfoValue, (long) *((int *) rgbInfoValue));
  goto print_end;


print_string:
  trace_emit ("\t\t%-15.15s   %d (%s)\n",
  	"SQLUSMALLINT", fInfoType, infoname);
  trace_emit ("\t\t%-15.15s   %p\n",
  	"SQLPOINTER", rgbInfoValue);
  if (waMode == 'A')
    trace_emit_string ((SQLCHAR *) rgbInfoValue, pcbInfoValue ? *pcbInfoValue : SQL_NTS, 0);
  else
    {
      SQLCHAR *str_u8 = dm_SQL_W2A ((SQLWCHAR *) rgbInfoValue, pcbInfoValue ? *pcbInfoValue : SQL_NTS);
      trace_emit_string (str_u8, SQL_NTS, 1);
      free (str_u8);
    }
  goto print_end;


print_mask:
  trace_emit ("\t\t%-15.15s   %d (%s)\n",
  	"SQLUSMALLINT", fInfoType, infoname);
  trace_emit ("\t\t%-15.15s   %p (0x%lX)\n",
	"SQLPOINTER", rgbInfoValue,
	(unsigned long) *((unsigned int *) rgbInfoValue));

  if (*(int *) rgbInfoValue == 0)
    trace_emit ("\t\t\t\t  | %-40.40s |\n", mask[0]);
  else
    {
      register unsigned int val = *(unsigned int *) rgbInfoValue;

      for (i = 1; i < 32; i++)
	{
	  if (val & (1 << (i - 1)))
	    {
	      if (i < elem)
		trace_emit ("\t\t\t\t  | %-40.40s |\n", mask[i]);
	      else
		trace_emit ("\t\t\t\t  | %-40.40s |\n", "UNKNOWN");
	    }
	}
    }
  goto print_end;


print_svalue:
  i = *((short *) rgbInfoValue);
  trace_emit ("\t\t%-15.15s   %d (%s)\n",
	"SQLUSMALLINT", fInfoType, infoname);
  trace_emit ("\t\t%-15.15s   %p (%ld)\n",
	"SQLPOINTER", rgbInfoValue, (long) *((SQLSMALLINT *) rgbInfoValue));
  trace_emit ("\t\t\t\t  | %-40.40s |\n",
  	(i < elem) ? mask[i] : "UNKNOWN");
  goto print_end;


  /*
   *  All done
   */
print_end:
  return;
}