/*
** ODBCSS.H - This is the application include file for the
** SQL Server driver specific defines.
**
** (C) Copyright 1993-1996 By Microsoft Corp.
**
*/
//SQLSetConnectOption/SQLSetStmtOption driver specific defines.
//Microsoft has 1200 thru 1249 reserved for Microsoft SQL Server driver usage.
//Connection Options
#define SQL_COPT_SS_BASE1200
#define SQL_REMOTE_PWD(SQL_COPT_SS_BASE+1) // dbrpwset SQLSetConnectOption only
#define SQL_USE_PROCEDURE_FOR_PREPARE(SQL_COPT_SS_BASE+2) // Use create proc for SQLPrepare
#define SQL_INTEGRATED_SECURITY (SQL_COPT_SS_BASE+3) // Force integrated security on login
#define SQL_PRESERVE_CURSORS(SQL_COPT_SS_BASE+4) // Preserve server cursors after SQLTransact
#define SQL_COPT_SS_USER_DATA(SQL_COPT_SS_BASE+5) // dbgetuserdata/dbsetuserdata
#define SQL_COPT_SS_ANSI_OEM(SQL_COPT_SS_BASE+6) // dbsetopt/DBANSItoOEM/DBOEMtoANSI
#define SQL_COPT_SS_ENLIST_IN_DTC(SQL_COPT_SS_BASE+7) // Enlist in a Viper transaction
#define SQL_COPT_SS_ENLIST_IN_XA(SQL_COPT_SS_BASE+8) // Enlist in a XA transaction
#define SQL_COPT_SS_CONNECTION_DEAD(SQL_COPT_SS_BASE+9) // dbdead SQLGetConnectOption only
#define SQL_COPT_SS_FALLBACK_CONNECT(SQL_COPT_SS_BASE+10) // Enables FallBack connections
#define SQL_COPT_SS_PERF_DATA(SQL_COPT_SS_BASE+11) // Used to access SQL Server ODBC driver performance data
#define SQL_COPT_SS_PERF_DATA_LOG(SQL_COPT_SS_BASE+12) // Used to set the logfile name for the Performance data
#define SQL_COPT_SS_PERF_QUERY_INTERVAL (SQL_COPT_SS_BASE+13) // Used to set the query logging threshold in milliseconds.
#define SQL_COPT_SS_PERF_QUERY_LOG(SQL_COPT_SS_BASE+14) // Used to set the logfile name for saving queryies.
#define SQL_COPT_SS_PERF_QUERY(SQL_COPT_SS_BASE+15) // Used to start and stop query logging.
#define SQL_COPT_SS_PERF_DATA_LOG_NOW(SQL_COPT_SS_BASE+16) // Used to make a statistics log entry to disk.
#define SQL_COPT_SS_MAX_USEDSQL_COPT_SS_PERF_DATA_LOG_NOW
//Statement Options
#define SQL_SOPT_SS_BASE1225
#define SQL_TEXTPTR_LOGGING (SQL_SOPT_SS_BASE+0) // Text pointer logging
#define SQL_SOPT_SS_CURRENT_COMMAND(SQL_SOPT_SS_BASE+1) // dbcurcmd SQLGetStmtOption only
#define SQL_SOPT_SS_MAX_USEDSQL_SOPT_SS_CURRENT_COMMAND
//Defines for use with SQL_USE_PROCEDURE_FOR_PREPARE
#define SQL_UP_OFF0L//Procedures won't be used for prepare
#define SQL_UP_ON1L//Procedures will be used for prepare
#define SQL_UP_ON_DROP2L//Temp procedures will be explicitly dropped
#define SQL_UP_DEFAULTSQL_UP_ON
//Defines for use with SQL_INTEGRATED_SECURITY - only useable before connecting
#define SQL_IS_OFF0L//Integrated security isn't used
#define SQL_IS_ON1L//Integrated security is used
#define SQL_IS_DEFAULTSQL_IS_OFF
//Defines for use with SQL_PRESERVE_CURSORS
#define SQL_PC_OFF0L//Cursors are closed on SQLTransact
#define SQL_PC_ON1L//Cursors remain open on SQLTransact
#define SQL_PC_DEFAULTSQL_PC_OFF
//Defines for use with SQL_COPT_SS_USER_DATA
#define SQL_UD_NOTSET0L//No user data pointer set
//Defines for use with SSQL_COPT_SS_ANSI_OEMQL_ANSI_OEM
#define SQL_AO_OFF0L//ANSI/OEM translation is not performed
#define SQL_AO_ON1L//ANSI/OEM translation is performed
#define SQL_AO_DEFAULTSQL_AO_OFF//Default unless DSN OEM/ANSI checkbox is checked
//Defines for use with SQL_COPT_SS_CONNECTION_DEAD
#define SQL_CD_FALSE0L//Connection is open/available
#define SQL_CD_TRUE1L//Connection is closed/dead
//Defines for use with SQL_COPT_SS_FALLBACK_CONNECT
#define SQL_FB_OFF0L//FallBack connections are disabled
#define SQL_FB_ON1L//FallBack connections are enabled
#define SQL_FB_DEFAULTSQL_FB_OFF
//Defines for use with SQL_ENLIST_IN_DTC
#define SQL_DTC_DONE0L//Delimits end of Viper transaction
//Defines for use with SQL_TEXTPTR_LOGGING
#define SQL_TL_OFF0L//No logging on text pointer ops
#define SQL_TL_ON1L//Logging occurs on text pointer ops
#define SQL_TL_DEFAULTSQL_TL_ON
//SQLColAttributes driver specific defines.
//SQLSet/GetDescField driver specific defines.
//Microsoft has 1200 thru 1249 reserved for Microsoft SQL Server driver usage.
#define SQL_CA_SS_BASE1200
#define SQL_CA_SS_COLUMN_SSTYPE(SQL_CA_SS_BASE+0)//dbcoltype/dbaltcoltype
#define SQL_CA_SS_COLUMN_UTYPE(SQL_CA_SS_BASE+1)//dbcolutype/dbaltcolutype
#define SQL_CA_SS_NUM_ORDERS(SQL_CA_SS_BASE+2)//dbnumorders
#define SQL_CA_SS_COLUMN_ORDER(SQL_CA_SS_BASE+3)//dbcolorder
#define SQL_CA_SS_COLUMN_VARYLEN(SQL_CA_SS_BASE+4)//dbvarylen
#define SQL_CA_SS_NUM_COMPUTES(SQL_CA_SS_BASE+5)//dbnumcompute
#define SQL_CA_SS_COMPUTE_ID(SQL_CA_SS_BASE+6)//dbnextrow status return
#define SQL_CA_SS_COMPUTE_BYLIST(SQL_CA_SS_BASE+7)//dbbylist
#define SQL_CA_SS_COLUMN_ID(SQL_CA_SS_BASE+8)//dbaltcolid
#define SQL_CA_SS_COLUMN_OP(SQL_CA_SS_BASE+9)//dbaltcolop
#define SQL_CA_SS_MAX_USEDSQL_CA_SS_COLUMN_OP
// SQL Server Data Type Tokens. Returned by SQLColAttributes/SQL_CA_SS_COLUMN_SSTYPE.
#define SQLTEXT 0x23
#define SQLVARBINARY0x25
#define SQLINTN 0x26
#define SQLVARCHAR0x27
#define SQLBINARY0x2d
#define SQLIMAGE0x22
#define SQLCHARACTER0x2f
#define SQLINT1 0x30
#define SQLBIT0x32
#define SQLINT2 0x34
#define SQLINT4 0x38
#define SQLMONEY0x3c
#define SQLDATETIME 0x3d
#define SQLFLT8 0x3e
#define SQLFLTN 0x6d
#define SQLMONEYN0x6e
#define SQLDATETIMN 0x6f
#define SQLFLT4 0x3b
#define SQLMONEY40x7a
#define SQLDATETIM4 0x3a
#define SQLDECIMAL0x37
#define SQLDECIMALN0x6a
#define SQLNUMERIC0x3f
#define SQLNUMERICN 0x6c
//User Data Type definitions. Returned by SQLColAttributes/SQL_CA_SS_COLUMN_UTYPE.
#define SQLudtTEXT19
#define SQLudtVARBINARY 4
#define SQLudtINTN13
#define SQLudtVARCHAR2
#define SQLudtBINARY3
#define SQLudtIMAGE 20
#define SQLudtCHAR1
#define SQLudtINT15
#define SQLudtBIT16
#define SQLudtINT26
#define SQLudtINT47
#define SQLudtMONEY 11
#define SQLudtDATETIME12
#define SQLudtFLT88
#define SQLudtFLTN14
#define SQLudtMONEYN17
#define SQLudtDATETIMN15
#define SQLudtSYSNAME18
#define SQLudtTIMESTAMP 80
#define SQLudtFLT423
#define SQLudtMONEY421
#define SQLudtDATETIM422
#define SQLudtDECML24
#define SQLudtDECMLN26
#define SQLudtNUM10
#define SQLudtNUMN25
#define MIN_USER_DATATYPE100
// aggregate operator types (returned by SQLColAttributes/SQL_CA_SS_COLUMN_OP)
#define SQLAOPCNT0x4b
#define SQLAOPSUM0x4d
#define SQLAOPAVG0x4f
#define SQLAOPMIN0x51
#define SQLAOPMAX0x52
#define SQLAOPANY0x53
#define SQLAOPNOOP0x56
//SQLGetInfo driver specific defines.
//Microsoft has 1200 thru 1249 reserved for Microsoft SQL Server driver usage.
#define SQL_INFO_SS_FIRST1200
#define SQL_INFO_SS_NETLIB_NAME (SQL_INFO_SS_FIRST+0) // dbprocinfo
#define SQL_INFO_SS_MAX_USEDSQL_INFO_SS_NETLIB_NAME
//Internal server datatypes - used when binding to SQL_C_BINARY
#ifndef MAXNUMERICLEN// Resolve ODS/DBLib conflicts
typedef struct dbmoney
{// Internal representation of MONEY data type
LONG mnyhigh;// Money value *10,000 (High 32 bits/signed)
ULONG mnylow;// Money value *10,000 (Low 32 bits/unsigned)
} DBMONEY;
typedef struct dbdatetime
{// Internal representation of DATETIME data type
LONG dtdays;// No of days since Jan-1-1900 (maybe negative)
ULONG dttime;// No. of 300 hundredths of a second since midnight
} DBDATETIME;
typedef struct dbdatetime4
{// Internal representation of SMALLDATETIME data type
USHORT numdays; // No of days since Jan-1-1900
USHORT nummins; // No. of minutes since midnight
} DBDATETIM4;
typedef LONG DBMONEY4;// Internal representation of SMALLMONEY data type
// Money value *10,000
#define MAXNUMERICLEN 16
#define DBNUM_PREC_TYPE BYTE
#define DBNUM_SCALE_TYPE BYTE
#define DBNUM_VAL_TYPE BYTE
typedef struct dbnumeric
{// Internal representation of NUMERIC data type
DBNUM_PREC_TYPE precision;// Precision
DBNUM_SCALE_TYPE scale;// Scale
BYTE sign; // Sign (1 if positive, 0 if negative)
DBNUM_VAL_TYPE val[MAXNUMERICLEN];// Value
} DBNUMERIC;
typedef DBNUMERIC DBDECIMAL;// Internal representation of DECIMAL data type
#endif //MAXNUMERICLEN
/*****************************************************************
This struct is a global used for
gathering statistal data on the driver.
Access to this struct is controled via the
pStatCrit;
******************************************************************/
typedef struct sqlperf
{
// Application Profile Statistics
DWORD TimerResolution;
DWORD SQLidu;
DWORD SQLiduRows;
DWORD SQLSelects;
DWORD SQLSelectRows;
DWORD Transactions;
DWORD SQLPrepares;
DWORD ExecDirects;
DWORD SQLExecutes;
DWORD CursorOpens;
DWORD CursorSize;
DWORD CursorUsed;
LDOUBLE PercentCursorUsed;
LDOUBLE AvgFetchTime;
LDOUBLE AvgCursorSize;
LDOUBLE AvgCursorUsed;
DWORD SQLFetchTime;
DWORD SQLFetchCount;
DWORD CurrentStmtCount;
DWORD MaxOpenStmt;
DWORD SumOpenStmt;
// Connection Statistics
DWORD CurrentConnectionCount;
DWORD MaxConnectionsOpened;
DWORD SumConnectionsOpened;
DWORD SumConnectiontime;
LDOUBLE AvgTimeOpened;
// Network Statistics
DWORD ServerRndTrips;
DWORD BuffersSent;
DWORD BuffersRec;
DWORD BytesSent;
DWORD BytesRec;
// Time Statistics;
DWORD msExecutionTime;
DWORD msNetWorkServerTime;
} SQLPERF;
// The following are option for SQL_COPT_SS_PERF_DATA and SQL_COPT_SS_PERF_QUERY
#define SQL_PERF_START1// Starts the driver sampling performance data.
#define SQL_PERF_STOP2// Stops the counters from sampling performance data.
//The following options have been deprecated
#define SQL_FAST_CONNECT(SQL_COPT_SS_BASE+0)
//Defines for use with SQL_FAST_CONNECT - only useable before connecting
#define SQL_FC_OFF0L//Fast connect is off
#define SQL_FC_ON1L//Fast connect is on
#define SQL_FC_DEFAULTSQL_FC_OFF
/*
The following data struct is used as the vParam with
SQL_COPT_SS_ENLIST_IN_XA to enlist in a XA stansaction
when calling SQLSetStmtAttribute();
*/
typedef struct SQLXaTranTAG
{
void FAR *transManager;
void FAR *xaTransID;
ULONGxaTransIDLength;
DWORD dwErrorInfo;
} SQLXaTran;
//End of odbcss.h