📄 sdmss.pas
字号:
// Following flags are used in the scrollopt parameter in dbcursoropen
CUR_FORWARD = 0; // Forward only scrolling
CUR_KEYSET = -1; // Keyset driven scrolling
CUR_DYNAMIC = 1; // Fully dynamic
CUR_INSENSITIVE= -2; // Server-side cursors only
// Following flags define the fetchtype in the dbcursorfetch function
FETCH_FIRST = 1; // Fetch first n rows
FETCH_NEXT = 2; // Fetch next n rows
FETCH_PREV = 3; // Fetch previous n rows
FETCH_RANDOM = 4; // Fetch n rows beginning with given row #
FETCH_RELATIVE= 5; // Fetch relative to previous fetch row #
FETCH_LAST = 6; // Fetch the last n rows
// Following flags define the per row status as filled by dbcursorfetch and/or dbcursorfetchex
FTC_EMPTY = $00; // No row available
FTC_SUCCEED = $01; // Fetch succeeded, (failed if not set)
FTC_MISSING = $02; // The row is missing
FTC_ENDOFKEYSET = $04; // End of the keyset reached
FTC_ENDOFRESULTS = $08; // End of results set reached
// Following flags define the operator types for the dbcursor function
CRS_UPDATE = 1; // Update operation
CRS_DELETE = 2; // Delete operation
CRS_INSERT = 3; // Insert operation
CRS_REFRESH = 4; // Refetch given row
CRS_LOCKCC = 5; // Lock given row
// Following value can be passed to the dbcursorbind function for NOBIND type
NOBIND = -2; // Return length and pointer to data
// Following are values used by DBCURSORINFO's Type parameter
CU_CLIENT = $00000001;
CU_SERVER = $00000002;
CU_KEYSET = $00000004;
CU_MIXED = $00000008;
CU_DYNAMIC = $00000010;
CU_FORWARD = $00000020;
CU_INSENSITIVE= $00000040;
CU_READONLY = $00000080;
CU_LOCKCC = $00000100;
CU_OPTCC = $00000200;
CU_OPTCCVAL = $00000400;
// Following are values used by DBCURSORINFO's Status parameter
CU_FILLING = $00000001;
CU_FILLED = $00000002;
// Following are values used by dbupdatetext's type parameter
UT_TEXTPTR = $0001;
UT_TEXT = $0002;
UT_MORETEXT = $0004;
UT_DELETEONLY = $0008;
UT_LOG = $0010;
// The following values are passed to dbserverenum for searching criteria.
NET_SEARCH = $0001;
LOC_SEARCH = $0002;
// These constants are the possible return values from dbserverenum.
ENUM_SUCCESS = $0000;
MORE_DATA = $0001;
NET_NOT_AVAIL = $0002;
OUT_OF_MEMORY = $0004;
NOT_SUPPORTED = $0008;
ENUM_INVALID_PARAM = $0010;
// Netlib Error problem codes. ConnectionError() should return one of
// these as the dblib-mapped problem code, so the corresponding string
// is sent to the dblib app's error handler as dberrstr. Return NE_E_NOMAP
// for a generic DB-Library error string (as in prior versions of dblib).
NE_E_NOMAP = 0; // No string; uses dblib default.
NE_E_NOMEMORY = 1; // Insufficient memory.
NE_E_NOACCESS = 2; // Access denied.
NE_E_CONNBUSY = 3; // Connection is busy.
NE_E_CONNBROKEN = 4; // Connection broken.
NE_E_TOOMANYCONN = 5; // Connection limit exceeded.
NE_E_SERVERNOTFOUND = 6; // Specified SQL server not found.
NE_E_NETNOTSTARTED = 7; // The network has not been started.
NE_E_NORESOURCE = 8; // Insufficient network resources.
NE_E_NETBUSY = 9; // Network is busy.
NE_E_NONETACCESS = 10; // Network access denied.
NE_E_GENERAL = 11; // General network error. Check your documentation.
NE_E_CONNMODE = 12; // Incorrect connection mode.
NE_E_NAMENOTFOUND = 13; // Name not found in directory service.
NE_E_INVALIDCONN = 14; // Invalid connection.
NE_E_NETDATAERR = 15; // Error reading or writing network data.
NE_E_TOOMANYFILES = 16; // Too many open file handles.
NE_E_CANTCONNECT = 17; // SQL Server does not exist or access denied.
NE_MAX_NETERROR = 17;
{*****************************************************************************
* *
* SQLDB.H - DB-Library header file for the Microsoft SQL Server. *
* *
*****************************************************************************}
{// Macros for setting the PLOGINREC
#define DBSETLHOST(a,b) dbsetlname ((a), (b), DBSETHOST)
#define DBSETLUSER(a,b) dbsetlname ((a), (b), DBSETUSER)
#define DBSETLPWD(a,b) dbsetlname ((a), (b), DBSETPWD)
#define DBSETLAPP(a,b) dbsetlname ((a), (b), DBSETAPP)
#define BCP_SETL(a,b) bcp_setl ((a), (b))
#define DBSETLNATLANG(a,b) dbsetlname ((a), (b), DBSETLANG)
#define DBSETLPACKET(a,b) dbsetlpacket ((a), (b))
#define DBSETLSECURE(a) dbsetlname ((a), 0, DBSETSECURE)
#define DBSETLVERSION(a,b) dbsetlname ((a), 0, (b))
#define DBSETLTIME(a,b) dbsetlname ((a), (LPCSTR)(ULONG)(b), DBSETLOGINTIME)
#define DBSETLFALLBACK(a,b) dbsetlname ((a), (b), DBSETFALLBACK)
}
{
/*****************************************************************************
* Windows 3.x and Non-Windows 3.x differences. *
*****************************************************************************/
#define dbwinexit()
#define DBLOCKLIB()
#define DBUNLOCKLIB()
typedef INT (SQLAPI *DBERRHANDLE_PROC)(PDBPROCESS, INT, INT, INT, LPCSTR, LPCSTR);
typedef INT (SQLAPI *DBMSGHANDLE_PROC)(PDBPROCESS, DBINT, INT, INT, LPCSTR, LPCSTR, LPCSTR, DBUSMALLINT);
extern DBERRHANDLE_PROC SQLAPI dberrhandle(DBERRHANDLE_PROC);
extern DBMSGHANDLE_PROC SQLAPI dbmsghandle(DBMSGHANDLE_PROC);
extern DBERRHANDLE_PROC SQLAPI dbprocerrhandle(PDBHANDLE, DBERRHANDLE_PROC);
extern DBMSGHANDLE_PROC SQLAPI dbprocmsghandle(PDBHANDLE, DBMSGHANDLE_PROC);
}
type
TDBERRHANDLE_PROC = function (dbproc: PDBPROCESS; severity, dberr, oserr: INT; dberrstr, oserrstr: TSDCharPtr): INT; {$IFNDEF SD_CLR}cdecl;{$ENDIF}
TDBMSGHANDLE_PROC = function (dbproc: PDBPROCESS; msgno: DBINT; msgstate, severity: INT;
msgtext, srvname, procname: TSDCharPtr; line: DBUSMALLINT): INT; {$IFNDEF SD_CLR}cdecl;{$ENDIF}
Tdberrhandle= function (handler: TDBERRHANDLE_PROC): TDBERRHANDLE_PROC;
Tdbmsghandle= function (handler: TDBMSGHANDLE_PROC): TDBMSGHANDLE_PROC;
{*****************************************************************************
* Function Prototypes *
*****************************************************************************}
{// Functions macros
#define DBCMDROW(a) dbcmdrow(a)
#define DBCOUNT(a) dbcount (a)
#define DBCURCMD(a) dbcurcmd(a)
#define DBCURROW(a) dbcurrow(a)
#define DBDEAD(a) dbdead(a)
#define DBFIRSTROW(a) dbfirstrow(a)
#define DBGETTIME() dbgettime()
#define DBISAVAIL(a) dbisavail(a)
#define DBLASTROW(a) dblastrow(a)
#define DBMORECMDS(a) dbmorecmds(a)
#define DBNUMORDERS(a) dbnumorders(a)
#define dbrbuf(a) ((DBINT)dbdataready(a))
#define DBRBUF(a) ((DBINT)dbdataready(a))
#define DBROWS(a) dbrows (a)
#define DBROWTYPE(a) dbrowtype (a)
}
{$IFDEF SD_CLR}
type
// SizeOf(TDBCOL) = 122, alignment on word boundary
[StructLayout(LayoutKind.Sequential)]
TDBCOL = packed record
SizeOfStruct: DBINT;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAXCOLNAMELEN+1)]
Name: string; // array[0..MAXCOLNAMELEN] of CHAR;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAXCOLNAMELEN+1)]
ActualName: string; // array[0..MAXCOLNAMELEN] of CHAR;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAXTABLENAME+1)]
TableName: string; // array[0..MAXTABLENAME] of CHAR;
dummy1: Byte;
ColType: SHORT;
UserType: DBINT;
MaxLength: DBINT;
Precision: BYTE;
Scale: BYTE;
VarLength: BOOL; // TRUE, FALSE
Null: BYTE; // TRUE, FALSE or DBUNKNOWN
CaseSensitive: BYTE; // TRUE, FALSE or DBUNKNOWN
Updatable: BYTE; // TRUE, FALSE or DBUNKNOWN
dummy2: Byte;
Identity: BOOL; // TRUE, FALSE
end;
{$ELSE}
// SizeOf(TDBCOL) = 122, alignment on word boundary
TDBCOL = packed record
SizeOfStruct: DBINT;
Name: array[0..MAXCOLNAMELEN] of CHAR;
ActualName: array[0..MAXCOLNAMELEN] of CHAR;
TableName: array[0..MAXTABLENAME] of CHAR;
dummy1: Byte;
ColType: SHORT;
UserType: DBINT;
MaxLength: DBINT;
Precision: BYTE;
Scale: BYTE;
VarLength: BOOL; // TRUE, FALSE
Null: BYTE; // TRUE, FALSE or DBUNKNOWN
CaseSensitive: BYTE; // TRUE, FALSE or DBUNKNOWN
Updatable: BYTE; // TRUE, FALSE or DBUNKNOWN
dummy2: Byte;
Identity: BOOL; // TRUE, FALSE
end;
LPDBCOL = ^TDBCOL;
{$ENDIF}
{$IFNDEF SD_CLR}
var
// Two-phase commit functions
abort_xact: function(connect: PDBPROCESS; CommId: DBINT): RETCODE; cdecl;
build_xact_string: procedure (xact_name, service_name: LPCSTR; CommId: DBINT; sResult: LPSTR); cdecl;
close_commit: procedure (connect: PDBPROCESS); cdecl;
commit_xact: function (connect: PDBPROCESS; commId: DBINT): RETCODE; cdecl;
open_commit: function (login: PLOGINREC; servername: LPCSTR): PDBPROCESS; cdecl;
remove_xact: function (connect: PDBPROCESS; commId: DBINT; n: INT): RETCODE; cdecl;
scan_xact: function (connect: PDBPROCESS; commId: DBINT): RETCODE; cdecl;
start_xact: function (connect: PDBPROCESS; application_name, xact_name: LPCSTR; site_count: INT): DBINT; cdecl;
stat_xact: function (connect: PDBPROCESS; commId: DBINT): INT; cdecl;
// BCP functions
bcp_batch: function (dbproc: PDBPROCESS): DBINT; cdecl;
bcp_bind: function (dbproc: PDBPROCESS; varaddr: LPCBYTE;
prefixlen: INT; varlen: DBINT; terminator: LPCBYTE;
termlen, datatype, table_column: INT): RETCODE; cdecl;
bcp_colfmt: function (dbproc: PDBPROCESS; file_column: INT; file_type: BYTE;
file_prefixlen: INT; file_collen: DBINT; file_term: LPCBYTE;
file_termlen, table_column: INT): RETCODE; cdecl;
bcp_collen: function (dbproc: PDBPROCESS; varlen: DBINT; table_column: INT): RETCODE; cdecl;
bcp_colptr: function (dbproc: PDBPROCESS; colptr: LPCBYTE; table_column: INT): RETCODE; cdecl;
bcp_columns: function (dbproc: PDBPROCESS; file_colcount: INT): RETCODE; cdecl;
bcp_control: function (dbproc: PDBPROCESS; field: INT; value: DBINT): RETCODE; cdecl;
bcp_done: function (dbproc: PDBPROCESS): DBINT; cdecl;
bcp_exec: function (dbproc: PDBPROCESS; rows_copied: LPDBINT): RETCODE; cdecl;
bcp_init: function (dbproc: PDBPROCESS; tblname, hfile, errfile: LPCSTR; direction: INT): RETCODE; cdecl;
bcp_moretext: function (dbproc: PDBPROCESS; size: DBINT; text: LPCBYTE): RETCODE; cdecl;
bcp_readfmt: function (dbproc: PDBPROCESS; filename: LPCSTR): RETCODE; cdecl;
bcp_sendrow: function (dbproc: PDBPROCESS): RETCODE; cdecl;
bcp_setl: function (loginrec: PLOGINREC; enable: BOOL): RETCODE; cdecl;
bcp_writefmt: function (dbproc: PDBPROCESS; filename: LPCSTR): RETCODE; cdecl;
// Standard DB-Library functions
dbadata: function (dbproc: PDBPROCESS; computeId, column: INT): LPCBYTE; cdecl;
dbadlen: function (dbproc: PDBPROCESS; computeId, column: INT): DBINT; cdecl;
dbaltbind: function (dbproc: PDBPROCESS; computeId, column, vartype: INT;
varlen: DBINT; varaddr: LPCBYTE): RETCODE; cdecl;
dbaltcolid: function (dbproc: PDBPROCESS; computeId, column: INT): INT; cdecl;
dbaltlen: function (dbproc: PDBPROCESS; computeId, column: INT): DBINT; cdecl;
dbaltop: function (dbproc: PDBPROCESS; computeId, column: INT): INT; cdecl;
dbalttype: function (dbproc: PDBPROCESS; computeId, column: INT): INT; cdecl;
dbaltutype: function (dbproc: PDBPROCESS; computeId, column: INT): DBINT; cdecl;
dbanullbind: function (dbproc: PDBPROCESS; computeId, column: INT; indicator: LPCDBINT): RETCODE; cdecl;
dbbind: function (dbproc: PDBPROCESS; column, vartype: INT; varlen: DBINT; varaddr: LPBYTE): RETCODE; cdecl;
dbbylist: function (dbproc: PDBPROCESS; computeId: INT; size: LPINT): LPCBYTE; cdecl;
dbcancel: function (dbproc: PDBPROCESS): RETCODE; cdecl;
dbcanquery: function (dbproc: PDBPROCESS): RETCODE; cdecl;
dbchange: function (dbproc: PDBPROCESS): LPCSTR; cdecl;
dbclose: function (dbproc: PDBPROCESS): RETCODE; cdecl;
dbclrbuf: procedure (dbproc: PDBPROCESS; n: DBINT); cdecl;
dbclropt: function (dbproc: PDBPROCESS; option: INT; param: LPCSTR): RETCODE; cdecl;
dbcmd: function (dbproc: PDBPROCESS; cmdstring: LPCSTR): RETCODE; cdecl;
dbcmdrow: function (dbproc: PDBPROCESS): RETCODE; cdecl;
dbcolbrowse: function (dbproc: PDBPROCESS; colnum: INT): BOOL; cdecl;
dbcolinfo: function (dbHandle: PDBHANDLE; colinfo, column, computeId: INT; var DbCol: TDBCOL): RETCODE; cdecl;
dbcollen: function (dbproc: PDBPROCESS; column: INT): DBINT; cdecl;
dbcolname: function (dbproc: PDBPROCESS; column: INT): LPCSTR; cdecl;
dbcolsource: function (dbproc: PDBPROCESS; colnum: INT): LPCSTR; cdecl;
dbcoltype: function (dbproc: PDBPROCESS; column: INT): INT; cdecl;
dbcolutype: function (dbproc: PDBPROCESS; column: INT): DBINT; cdecl;
dbconvert: function (dbproc: PDBPROCESS; srctype: INT; src: LPCBYTE; srclen: DBINT;
desttype: INT; dest: LPBYTE; destlen: DBINT): INT; cdecl;
dbcount: function (dbproc: PDBPROCESS): DBINT; cdecl;
dbcurcmd: function (dbproc: PDBPROCESS): INT; cdecl;
dbcurrow: function (dbproc: PDBPROCESS): DBINT; cdecl;
dbcursor: function (hc: PDBCURSOR; optype, row: INT; table, values: LPCSTR): RETCODE; cdecl;
dbcursorbind: function (hc: PDBCURSOR; col, vartype: INT; varlen: DBINT; poutlen: LPDBINT; pvaraddr: LPBYTE): RETCODE; cdecl;
dbcursorclose:function (handle: PDBHANDLE): RETCODE; cdecl;
dbcursorcolinfo:function (hcursor: PDBCURSOR; column: INT; colname: LPSTR;
coltype: LPINT; collen: LPDBINT; usertype: LPINT): RETCODE; cdecl;
dbcursorfetch:function (hc: PDBCURSOR; fetchtype, rownum: INT): RETCODE; cdecl;
dbcursorfetchex:function (hc: PDBCURSOR; fetchtype: INT; rownum, nfetchrows, reserved: DBINT): RETCODE; cdecl;
dbcursorinfo: function (hcursor: PDBCURSOR; ncols: LPINT; nrows: LPDBINT): RETCODE; cdecl;
dbcursorinfoex:function (hc: PDBCURSOR; pdbcursorinfo: LPDBCURSORINFO): RETCODE; cdecl;
dbcursoropen: function (dbproc: PDBPROCESS; stmt: LPCSTR; scrollopt, concuropt: INT;
nrows: UINT; pstatus: LPDBINT): PDBCURSOR; cdecl;
dbdata: function (dbproc: PDBPROCESS; column: INT): LPCBYTE; cdecl;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -