📄 sqlfront.h
字号:
#ifndef _INC_SQLFRONT
#define _INC_SQLFRONT
#ifdef DBNTWIN32
#ifndef _WINDOWS_
#pragma message (__FILE__ " : db-library error: windows.h must be included before sqlfront.h.")
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* *
* SQLFRONT.H - DB-Library header file for the Microsoft SQL Server. *
* *
* Copyright (c) 1989 - 1995 by Microsoft Corp. All rights reserved. *
* *
* All constant and macro definitions for DB-Library applications programming *
* are contained in this file. This file must be included before SQLDB.H and *
* one of the following #defines must be made, depending on the operating *
* system: DBMSDOS, DBMSWIN or DBNTWIN32. *
* *
*****************************************************************************/
/*****************************************************************************
* Datatype definitions *
*****************************************************************************/
// Note this has changed because Windows 3.1 defines API as 'pascal far'
#if !defined(M_I86SM) && !defined(DBNTWIN32)
#define SQLAPI cdecl far
#else
#define SQLAPI _cdecl
#endif
#ifndef API
#define API SQLAPI
#endif
#ifndef DOUBLE
typedef double DOUBLE;
#endif
/*****************************************************************************
* DBPROCESS, LOGINREC and DBCURSOR *
*****************************************************************************/
#define DBPROCESS void // dbprocess structure type
#define LOGINREC void // login record type
#define DBCURSOR void // cursor record type
#define DBHANDLE void // generic handle
// DOS Specific
#ifdef DBMSDOS
typedef DBPROCESS * PDBPROCESS;
typedef LOGINREC * PLOGINREC;
typedef DBCURSOR * PDBCURSOR;
typedef DBHANDLE * PDBHANDLE;
#define PTR *
#endif
// WIN 3.x Specific. The handle pointers are near for Windows 3.x
#ifdef DBMSWIN
typedef DBPROCESS near * PDBPROCESS;
typedef LOGINREC near * PLOGINREC;
typedef DBCURSOR near * PDBCURSOR;
typedef DBHANDLE near * PDBHANDLE;
#define PTR far *
#endif
// Windows NT Specific
#ifdef DBNTWIN32
typedef DBPROCESS * PDBPROCESS;
typedef LOGINREC * PLOGINREC;
typedef DBCURSOR * PDBCURSOR;
typedef DBHANDLE * PDBHANDLE;
#define PTR *
typedef int (SQLAPI *SQLFARPROC)();
#else
typedef long (far pascal *LGFARPROC)(); // Windows loadable driver fp
#endif
/*****************************************************************************
* Win32 compatibility datatype definitions *
* Note: The following datatypes are provided for Win32 compatibility. *
* Since some of the datatypes are already defined in unrelated include files *
* there may definition duplication. Every attempt has been made to check *
* for such problems. *
*****************************************************************************/
#ifndef DBNTWIN32
#ifndef SHORT
typedef short SHORT;
#endif
#ifndef INT
typedef int INT;
#endif
#ifndef UINT
typedef unsigned int UINT;
#endif
#ifndef USHORT
typedef unsigned short USHORT;
#endif
#ifndef ULONG
typedef unsigned long ULONG;
#endif
#ifndef CHAR
typedef char CHAR;
#endif
#ifndef LPINT
typedef INT PTR LPINT;
#endif
typedef unsigned char BYTE;
typedef CHAR PTR LPSTR;
typedef BYTE PTR LPBYTE;
typedef void PTR LPVOID;
typedef const CHAR PTR LPCSTR;
typedef int BOOL;
#endif
/*****************************************************************************
* DB-Library datatype definitions *
*****************************************************************************/
#define DBMAXCHAR 256 // Max length of DBVARBINARY and DBVARCHAR, etc.
#ifndef DBTYPEDEFS // srv.h (Open Server include) not already included
#define DBTYPEDEFS
#define RETCODE INT
#define STATUS INT
// DB-Library datatypes
typedef char DBCHAR;
typedef unsigned char DBBINARY;
typedef unsigned char DBTINYINT;
typedef short DBSMALLINT;
typedef unsigned short DBUSMALLINT;
typedef long DBINT;
typedef double DBFLT8;
typedef unsigned char DBBIT;
typedef unsigned char DBBOOL;
typedef float DBFLT4;
typedef long DBMONEY4;
typedef DBFLT4 DBREAL;
typedef UINT DBUBOOL;
typedef struct dbdatetime4
{
USHORT numdays; // No of days since Jan-1-1900
USHORT nummins; // No. of minutes since midnight
} DBDATETIM4;
typedef struct dbvarychar
{
DBSMALLINT len;
DBCHAR str[DBMAXCHAR];
} DBVARYCHAR;
typedef struct dbvarybin
{
DBSMALLINT len;
BYTE array[DBMAXCHAR];
} DBVARYBIN;
typedef struct dbmoney
{
DBINT mnyhigh;
ULONG mnylow;
} DBMONEY;
typedef struct dbdatetime
{
DBINT dtdays;
ULONG dttime;
} DBDATETIME;
// DBDATEREC structure used by dbdatecrack
typedef struct dbdaterec
{
INT year; // 1753 - 9999
INT quarter; // 1 - 4
INT month; // 1 - 12
INT dayofyear; // 1 - 366
INT day; // 1 - 31
INT week; // 1 - 54 (for leap years)
INT weekday; // 1 - 7 (Mon - Sun)
INT hour; // 0 - 23
INT minute; // 0 - 59
INT second; // 0 - 59
INT millisecond; // 0 - 999
} DBDATEREC;
#define MAXNUMERICLEN 16
#define MAXNUMERICDIG 38
#define DEFAULTPRECISION 18
#define DEFAULTSCALE 0
typedef struct dbnumeric
{
BYTE precision;
BYTE scale;
BYTE sign; // 1 = Positive, 0 = Negative
BYTE val[MAXNUMERICLEN];
} DBNUMERIC;
typedef DBNUMERIC DBDECIMAL;
// Pack the following structures on a word boundary
#ifdef __BORLANDC__
#pragma option -a+
#else
#ifndef DBLIB_SKIP_PRAGMA_PACK // Define this if your compiler does not support #pragma pack()
#pragma pack(2)
#endif
#endif
#define MAXCOLNAMELEN 30
#define MAXTABLENAME 30
typedef struct
{
DBINT SizeOfStruct;
CHAR Name[MAXCOLNAMELEN+1];
CHAR ActualName[MAXCOLNAMELEN+1];
CHAR TableName[MAXTABLENAME+1];
SHORT Type;
DBINT UserType;
DBINT MaxLength;
BYTE Precision;
BYTE Scale;
BOOL VarLength; // TRUE, FALSE
BYTE Null; // TRUE, FALSE or DBUNKNOWN
BYTE CaseSensitive; // TRUE, FALSE or DBUNKNOWN
BYTE Updatable; // TRUE, FALSE or DBUNKNOWN
BOOL Identity; // TRUE, FALSE
} DBCOL, PTR LPDBCOL;
#define MAXSERVERNAME 30
#define MAXNETLIBNAME 255
#define MAXNETLIBCONNSTR 255
typedef struct
{
DBINT SizeOfStruct;
BYTE ServerType;
USHORT ServerMajor;
USHORT ServerMinor;
USHORT ServerRevision;
CHAR ServerName[MAXSERVERNAME+1];
CHAR NetLibName[MAXNETLIBNAME+1];
CHAR NetLibConnStr[MAXNETLIBCONNSTR+1];
} DBPROCINFO, PTR LPDBPROCINFO;
typedef struct
{
DBINT SizeOfStruct; // Use sizeof(DBCURSORINFO)
ULONG TotCols; // Total Columns in cursor
ULONG TotRows; // Total Rows in cursor
ULONG CurRow; // Current actual row in server
ULONG TotRowsFetched; // Total rows actually fetched
ULONG Type; // See CU_...
ULONG Status; // See CU_...
} DBCURSORINFO, PTR LPDBCURSORINFO;
#define INVALID_UROWNUM ((ULONG)(-1))
// Reset default alignment
#ifdef __BORLANDC__
#pragma option -a-
#else
#ifndef DBLIB_SKIP_PRAGMA_PACK // Define this if your compiler does not support #pragma pack()
#pragma pack()
#endif
#endif
#endif // End DBTYPEDEFS
/*****************************************************************************
* Pointer Datatypes *
*****************************************************************************/
typedef const LPINT LPCINT;
typedef const LPBYTE LPCBYTE ;
typedef USHORT PTR LPUSHORT;
typedef const LPUSHORT LPCUSHORT;
typedef DBINT PTR LPDBINT;
typedef const LPDBINT LPCDBINT;
typedef DBBINARY PTR LPDBBINARY;
typedef const LPDBBINARY LPCDBBINARY;
typedef DBDATEREC PTR LPDBDATEREC;
typedef const LPDBDATEREC LPCDBDATEREC;
typedef DBDATETIME PTR LPDBDATETIME;
typedef const LPDBDATETIME LPCDBDATETIME;
/*****************************************************************************
* General #defines *
*****************************************************************************/
#define TIMEOUT_IGNORE (ULONG)-1
#define TIMEOUT_INFINITE (ULONG)0
#define TIMEOUT_MAXIMUM (ULONG)1200 // 20 minutes maximum timeout value
// Used for ServerType in dbgetprocinfo
#define SERVTYPE_UNKNOWN 0
#define SERVTYPE_MICROSOFT 1
// Used by dbcolinfo
enum CI_TYPES { CI_REGULAR=1, CI_ALTERNATE=2, CI_CURSOR=3 };
// Bulk Copy Definitions (bcp)
#define DB_IN 1 // Transfer from client to server
#define DB_OUT 2 // Transfer from server to client
#define BCPMAXERRS 1 // bcp_control parameter
#define BCPFIRST 2 // bcp_control parameter
#define BCPLAST 3 // bcp_control parameter
#define BCPBATCH 4 // bcp_control parameter
#define BCPKEEPNULLS 5 // bcp_control parameter
#define BCPABORT 6 // bcp_control parameter
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#define TINYBIND 1
#define SMALLBIND 2
#define INTBIND 3
#define CHARBIND 4
#define BINARYBIND 5
#define BITBIND 6
#define DATETIMEBIND 7
#define MONEYBIND 8
#define FLT8BIND 9
#define STRINGBIND 10
#define NTBSTRINGBIND 11
#define VARYCHARBIND 12
#define VARYBINBIND 13
#define FLT4BIND 14
#define SMALLMONEYBIND 15
#define SMALLDATETIBIND 16
#define DECIMALBIND 17
#define NUMERICBIND 18
#define SRCDECIMALBIND 19
#define SRCNUMERICBIND 20
#define MAXBIND SRCNUMERICBIND
#define DBSAVE 1
#define DBNOSAVE 0
#define DBNOERR -1
#define DBFINDONE 0x04 // Definately done
#define DBMORE 0x10 // Maybe more commands waiting
#define DBMORE_ROWS 0x20 // This command returned rows
#define MAXNAME 31
#define DBTXTSLEN 8 // Timestamp length
#define DBTXPLEN 16 // Text pointer length
// Error code returns
#define INT_EXIT 0
#define INT_CONTINUE 1
#define INT_CANCEL 2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -