Перевод ODS API mssql2000 на Delphi (написание extended stored procedures)

{codecitation class=»brush: pascal; gutter: false;» width=»600px»}

Автор: Wicked

WEB-сайт: http://delphibase.endimus.com

{ **** UBPFD *********** by delphibase.endimus.com ****

>> перевод ODS API mssql2000 на Delphi (написание extended stored procedures)

перевод (как я понял, один из многих) заголовочных файлов

ODS API mssql2000 на object pascal…. для успешной работы необходима opends60.dll…

выполнен с помощью утилиты c2p, её комментарии я оставил…

часть функций, помеченные как устаревшие, не были переведены…

имхо перевод не лишен недостатков, поэтому используйте as is…

добавлю, что у меня всё работает… 🙂

Зависимости: windows

Автор: wicked, wilk@ua.fm, ICQ:92356239, Тернополь

Copyright: (1) Microsoft (srv.h), (2) Oleg Bulychov, (3) wicked aka Andy Wilk

Дата: 15 ноября 2002 г.

***************************************************** }

{*********************************}

{ Generated by c2pas32 v0.9b }

{ (c) 2001 Oleg Bulychov }

{ Gladiators Software }

{ http://www.astonshell.com/ }

{*********************************}

{(c) 2002 corrections by andy wilk }

unit srv_h;

interface

uses windows;

//————————————————————

// Open Data Services header file: srv.h

// Copyright (c) 1989, 1990, 1991, 1997 by Microsoft Corp.

//

// Avoid double inclusion

// ODS uses pack(4) on all CPU types

{$A }

// define model

//dll name

const

opends_dll = ‘opends60.dll’;

//————————————————————

// Formats of data types

type

DBBOOL = boolean;

DBBYTE = byte;

DBTINYINT = byte;

DBSMALLINT = smallint;

DBUSMALLINT = word;

DBINT = integer;

DBCHAR = char;

pDBCHAR = ^DBCHAR;

DBBINARY = byte;

DBBIT = byte;

DBFLT8 = double;

pinteger = ^integer;

USHORT = word;

srv_datetime = record // Format for SRVDATETIME

dtdays: integer; // number of days since 1/1/1900

dttime: UINT; // number 300th second since mid

end;

DBDATETIME = srv_datetime;

srv_money = record // Format for SRVMONEY

mnyhigh: integer;

mnylow: UINT;

end;

DBMONEY = srv_money;

DBFLT4 = single;

DBMONEY4 = integer;

dbdatetime4 = record // Format for SRVDATETIM4

numdays: word; // number of days since 1/1/1900

nummins: word; // number of minutes sicne midnight

end;

DBDATETIM4 = dbdatetime4;

const

MAXNUMERICLEN = 16;

type

dbnumeric = record // Format for SRVNUMERIC,SRVNUMERICN,SRVDECIMAL,SRVDECIMALN

precision: BYTE;

scale: BYTE;

sign: BYTE;

val: array[0..Pred(MAXNUMERICLEN)] of BYTE;

end;

//DBNUMERIC = dbnumeric;

DBDECIMAL = DBNUMERIC;

//————————————————————

// Constants used by APIs

// Type Tokens

const

SRV_TDS_NULL = {!!!a type cast? =>} {BYTE(} $1F;

SRV_TDS_TEXT = {!!!a type cast? =>} {BYTE(} $23;

SRV_TDS_GUID = {!!!a type cast? =>} {BYTE(} $24;

SRV_TDS_VARBINARY = {!!!a type cast? =>} {BYTE(} $25;

SRV_TDS_INTN = {!!!a type cast? =>} {BYTE(} $26;

SRV_TDS_VARCHAR = {!!!a type cast? =>} {BYTE(} $27;

SRV_TDS_BINARY = {!!!a type cast? =>} {BYTE(} $2D;

SRV_TDS_IMAGE = {!!!a type cast? =>} {BYTE(} $22;

SRV_TDS_CHAR = {!!!a type cast? =>} {BYTE(} $2F;

SRV_TDS_INT1 = {!!!a type cast? =>} {BYTE(} $30;

SRV_TDS_BIT = {!!!a type cast? =>} {BYTE(} $32;

SRV_TDS_INT2 = {!!!a type cast? =>} {BYTE(} $34;

SRV_TDS_DECIMAL = {!!!a type cast? =>} {BYTE(} $37;

SRV_TDS_INT4 = {!!!a type cast? =>} {BYTE(} $38;

SRV_TDS_DATETIM4 = {!!!a type cast? =>} {BYTE(} $3A;

SRV_TDS_FLT4 = {!!!a type cast? =>} {BYTE(} $3B;

SRV_TDS_MONEY = {!!!a type cast? =>} {BYTE(} $3C;

SRV_TDS_DATETIME = {!!!a type cast? =>} {BYTE(} $3D;

SRV_TDS_FLT8 = {!!!a type cast? =>} {BYTE(} $3E;

SRV_TDS_NUMERIC = {!!!a type cast? =>} {BYTE(} $3F;

SRV_TDS_SSVARIANT = {!!!a type cast? =>} {BYTE(} $62;

SRV_TDS_NTEXT = {!!!a type cast? =>} {BYTE(} $63;

SRV_TDS_BITN = {!!!a type cast? =>} {BYTE(} $68;

SRV_TDS_DECIMALN = {!!!a type cast? =>} {BYTE(} $6A;

SRV_TDS_NUMERICN = {!!!a type cast? =>} {BYTE(} $6C;

SRV_TDS_FLTN = {!!!a type cast? =>} {BYTE(} $6D;

SRV_TDS_MONEYN = {!!!a type cast? =>} {BYTE(} $6E;

SRV_TDS_DATETIMN = {!!!a type cast? =>} {BYTE(} $6F;

SRV_TDS_MONEY4 = {!!!a type cast? =>} {BYTE(} $7A;

SRV_TDS_INT8 = {!!!a type cast? =>} {BYTE(} $7F;

SRV_TDS_BIGVARBINARY = {!!!a type cast? =>} {BYTE(} $A5;

SRV_TDS_BIGVARCHAR = {!!!a type cast? =>} {BYTE(} $A7;

SRV_TDS_BIGBINARY = {!!!a type cast? =>} {BYTE(} $AD;

SRV_TDS_BIGCHAR = {!!!a type cast? =>} {BYTE(} $AF;

SRV_TDS_NVARCHAR = {!!!a type cast? =>} {BYTE(} $E7;

SRV_TDS_NCHAR = {!!!a type cast? =>} {BYTE(} $EF;

// Datatypes

// Also: values of symbol parameter to srv_symbol when type = SRV_DATATYPE

SRVNULL = SRV_TDS_NULL;

SRVTEXT = SRV_TDS_TEXT;

SRVGUID = SRV_TDS_GUID;

SRVVARBINARY = SRV_TDS_VARBINARY;

SRVINTN = SRV_TDS_INTN;

SRVVARCHAR = SRV_TDS_VARCHAR;

SRVBINARY = SRV_TDS_BINARY;

SRVIMAGE = SRV_TDS_IMAGE;

SRVCHAR = SRV_TDS_CHAR;

SRVINT1 = SRV_TDS_INT1;

SRVBIT = SRV_TDS_BIT;

SRVINT2 = SRV_TDS_INT2;

SRVDECIMAL = SRV_TDS_DECIMAL;

SRVINT4 = SRV_TDS_INT4;

SRVDATETIM4 = SRV_TDS_DATETIM4;

SRVFLT4 = SRV_TDS_FLT4;

SRVMONEY = SRV_TDS_MONEY;

SRVDATETIME = SRV_TDS_DATETIME;

SRVFLT8 = SRV_TDS_FLT8;

SRVNUMERIC = SRV_TDS_NUMERIC;

SRVSSVARIANT = SRV_TDS_SSVARIANT;

SRVNTEXT = SRV_TDS_NTEXT;

SRVBITN = SRV_TDS_BITN;

SRVDECIMALN = SRV_TDS_DECIMALN;

SRVNUMERICN = SRV_TDS_NUMERICN;

SRVFLTN = SRV_TDS_FLTN;

SRVMONEYN = SRV_TDS_MONEYN;

SRVDATETIMN = SRV_TDS_DATETIMN;

SRVMONEY4 = SRV_TDS_MONEY4;

SRVINT8 = SRV_TDS_INT8;

SRVBIGVARBINARY = SRV_TDS_BIGVARBINARY;

SRVBIGVARCHAR = SRV_TDS_BIGVARCHAR;

SRVBIGBINARY = SRV_TDS_BIGBINARY;

SRVBIGCHAR = SRV_TDS_BIGCHAR;

SRVNVARCHAR = SRV_TDS_NVARCHAR;

SRVNCHAR = SRV_TDS_NCHAR;

// values for srv_symbol type parameter

SRV_ERROR = 0;

SRV_DONE = 1;

SRV_DATATYPE = 2;

SRV_EVENT = 4;

// values for srv_symbol symbol parameter, when type = SRV_ERROR

SRV_ENO_OS_ERR = 0;

SRV_INFO = 1;

SRV_FATAL_PROCESS = 10;

SRV_FATAL_SERVER = 19;

// Types of server events

// Also: values for srv_symbol symbol parameter, when type = SRV_EVENT

SRV_CONTINUE = 0;

SRV_LANGUAGE = 1;

SRV_CONNECT = 2;

SRV_RPC = 3;

SRV_RESTART = 4;

SRV_DISCONNECT = 5;

SRV_ATTENTION = 6;

SRV_SLEEP = 7;

SRV_START = 8;

SRV_STOP = 9;

SRV_EXIT = 10;

SRV_CANCEL = 11;

SRV_SETUP = 12;

SRV_CLOSE = 13;

SRV_PRACK = 14;

SRV_PRERROR = 15;

SRV_ATTENTION_ACK = 16;

SRV_CONNECT_V7 = 16;

// TDS type for TDS 7 clients. Overloaded with SRV_ATTENTION_ACK

SRV_SKIP = 17;

SRV_TRANSMGR = 18;

SRV_PRELOGIN = 19;

SRV_OLEDB = 20;

SRV_INTERNAL_HANDLER = 99;

SRV_PROGRAMMER_DEFINED = 100;

// values for srv_sfield field parameter

SRV_SERVERNAME = 0;

SRV_VERSION = 6;

// Length to indicate string is null terminated

SRV_NULLTERM = -1;

// values of msgtype parameter to srv_sendmsg

SRV_MSG_INFO = 1;

SRV_MSG_ERROR = 2;

// values of status parameter to srv_senddone

// Also: values for symbol parameters to srv_symbol when type = SRV_DONE

SRV_DONE_FINAL = {!!!a type cast? =>} {USHORT(} $0000;

SRV_DONE_MORE = {!!!a type cast? =>} {USHORT(} $0001;

SRV_DONE_ERROR = {!!!a type cast? =>} {USHORT(} $0002;

SRV_DONE_COUNT = {!!!a type cast? =>} {USHORT(} $0010;

SRV_DONE_RPC_IN_BATCH = {!!!a type cast? =>} {USHORT(} $0080;

// return values of srv_paramstatus

SRV_PARAMRETURN = $0001;

SRV_PARAMDEFAULT = $0002;

SRV_PARAMSORTORDER = $0004;

// This is sent by clients in RPC, unset in processRPC

// return values of srv_rpcoptions

SRV_RECOMPILE = $0001;

SRV_NOMETADATA = $0002;

// values of field parameter to srv_pfield

//#define SRV_LANGUAGE 1 already defined above

//#define SRV_EVENT 4 already defined above

SRV_SPID = 10;

SRV_NETSPID = 11;

SRV_TYPE = 12;

SRV_STATUS = 13;

SRV_RMTSERVER = 14;

SRV_HOST = 15;

SRV_USER = 16;

SRV_PWD = 17;

SRV_CPID = 18;

SRV_APPLNAME = 19;

SRV_TDS = 20;

SRV_CLIB = 21;

SRV_LIBVERS = 22;

SRV_ROWSENT = 23;

SRV_BCPFLAG = 24;

SRV_NATLANG = 25;

SRV_PIPEHANDLE = 26;

SRV_NETWORK_MODULE = 27;

SRV_NETWORK_VERSION = 28;

SRV_NETWORK_CONNECTION = 29;

SRV_LSECURE = 30;

SRV_SAXP = 31;

SRV_UNICODE_USER = 33;

SRV_UNICODE_PWD = 35;

SRV_SPROC_CODEPAGE = 36;

SRV_MSGLCID = 37;

SRV_INSTANCENAME = 38;

SRV_HASHPWD = 39;

// return value of SRV_TDSVERSION macro

SRV_TDS_NONE = 0;

SRV_TDS_2_0 = 1;

SRV_TDS_3_4 = 2;

SRV_TDS_4_2 = 3;

SRV_TDS_6_0 = 4;

SRV_TDS_7_0 = 5;

// Return values from APIs

type

SRVRETCODE = integer; // SUCCEED or FAIL

//{$ifndef ODBCVER}

RETCODE = integer;

//{$endif}

//{$if !defined( SUCCEED )}

const

_SUCCEED = 1; // Successful return value

//{$endif}

//{$if !defined( FAIL )}

_FAIL = 0; // Unsuccessful return value

//{$endif}

SRV_DUPLICATE_HANDLER = 2; // additional return value for srv_pre/post_handle

//————————————————

//PreDeclare structures

//

type

srv_server = record

end;

pSRV_SERVER = ^srv_server;

srv_config = record

end;

pSRV_CONFIG = ^srv_config;

srv_proc = record

end;

pSRV_PROC = ^srv_proc;

//————————————————

//————————————————

// ODS MACROs

Добавить комментарий