⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdint.pas

📁 SQLDirect Component Library is a light-weight Borland Database Engine replacement for Borland Delphi
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{$ENDIF}

  (*******************************************************************)
  (* Time & Date Support                                             *)
  (*******************************************************************)
const
  ISC_SECONDS_PRECISION       = 10000;
  ISC_SECONDS_PRECISION_SCALE = -4;

type
  TISC_DATE = Long;
  TISC_TIME = ULong;
  TISC_TIMESTAMP = record
    timestamp_date: TISC_DATE;
    timestamp_time: TISC_TIME;
  end;
{$IFDEF SD_CLR}
  PISC_DATE = Void;
  PISC_TIME = Void;
  PISC_TIMESTAMP = Void;
{$ELSE}
  PISC_DATE = ^TISC_DATE;
  PISC_TIME = ^TISC_TIME;
  PISC_TIMESTAMP = ^TISC_TIMESTAMP;
{$ENDIF}

  (*********************************************************************)
  (** Blob id structure                                               **)
  (*********************************************************************)
  TGDS_QUAD = record
    gds_quad_high      : ISC_LONG;
    gds_quad_low       : UISC_LONG;
  end;
  TGDS__QUAD           = TGDS_QUAD;
  TISC_QUAD            = TGDS_QUAD;
{$IFDEF SD_CLR}
  PGDS_QUAD            = Void;
  PGDS__QUAD           = Void;
  PISC_QUAD            = Void;
{$ELSE}
  PGDS_QUAD            = ^TGDS_QUAD;
  PGDS__QUAD           = ^TGDS__QUAD;
  PISC_QUAD            = ^TISC_QUAD;
{$ENDIF}

  TISC_ARRAY_BOUND = record
    array_bound_lower  : short;
    array_bound_upper  : short;
  end;
  PISC_ARRAY_BOUND     = ^TISC_ARRAY_BOUND;
  TISC_ARRAY_DESC = record
    array_desc_dtype            : UChar;
    array_desc_scale            : Char;
    array_desc_length           : UShort;
    array_desc_field_name       : array[0..31] of Char;
    array_desc_relation_name    : array[0..31] of Char;
    array_desc_dimensions       : Short;
    array_desc_flags            : Short;
    array_desc_bounds           : array[0..15] of TISC_ARRAY_BOUND;
  end; // TISC_ARRAY_DESC
  PISC_ARRAY_DESC = ^TISC_ARRAY_DESC;

  TISC_BLOB_DESC = record
    blob_desc_subtype           : Short;
    blob_desc_charset           : Short;
    blob_desc_segment_size      : Short;
    blob_desc_field_name        : array[0..31] of UChar;
    blob_desc_relation_name     : array[0..31] of UChar;
  end; // TISC_BLOB_DESC
  PISC_BLOB_DESC = {$IFDEF SD_CLR} Void {$ELSE} ^TISC_BLOB_DESC {$ENDIF};

  (*****************************)
  (** Blob control structure  **)
  (*****************************)
  TISC_BLOB_CTL_SOURCE_FUNCTION = function: ISC_STATUS; // ISC_FAR
  PISC_BLOB_CTL                 = {$IFDEF SD_CLR}Void{$ELSE}^TISC_BLOB_CTL{$ENDIF};        // ISC_FAR
  TISC_BLOB_CTL = record
    (** Source filter **)
    ctl_source                  : TISC_BLOB_CTL_SOURCE_FUNCTION;
    (** Argument to pass to source filter **)
    ctl_source_handle           : PISC_BLOB_CTL;
    ctl_to_sub_type             : Short;  	(** Target type **)
    ctl_from_sub_type           : Short;	(** Source type **)
    ctl_buffer_length           : UShort;	(** Length of buffer **)
    ctl_segment_length          : UShort;  	(** Length of current segment **)
    ctl_bpb_length              : UShort;	(** Length of blob parameter **)
					    	(** block **)
    ctl_bpb                     : TSDCharPtr;	(** Address of blob parameter **)
						(** block **)
    ctl_buffer                  : PUChar;	(** Address of segment buffer **)
    ctl_max_segment             : ISC_LONG;	(** Length of longest segment **)
    ctl_number_segments 	: ISC_LONG;     (** Total number of segments **)
    ctl_total_length            : ISC_LONG;  	(** Total length of blob **)
    ctl_status                  : PISC_STATUS;	(** Address of status vector **)
    ctl_data                    : array[0..7] of long; (** Application specific data **)
  end;
  (*****************************)
  (** Blob stream definitions **)
  (*****************************)
  TBSTREAM = record
    bstr_blob                   : PVoid;  	(** Blob handle **)
    bstr_buffer                 : TSDCharPtr;	(** Address of buffer **)
    bstr_ptr                    : TSDCharPtr;	(** Next character **)
    bstr_length                 : Short;	(** Length of buffer **)
    bstr_cnt                    : Short;	(** Characters in buffer **)
    bstr_mode                   : Char;  	(** (mode) ? OUTPUT : INPUT **)
  end;
  PBSTREAM                      = ^TBSTREAM;

type
  (********************************)
  (** Declare the extended SQLDA **)
  (********************************)
{$IFDEF SD_CLR}
  [StructLayout(LayoutKind.Sequential)]
  TXSQLVAR = record
    sqltype                     : Short;     (** datatype of field **)
    sqlscale                    : Short;     (** scale factor **)
    sqlsubtype                  : Short;     (** datatype subtype - BLOBs **)
					     (** & text types only **)
    sqllen                      : Short;     (** length of data area **)
    sqldata                     : TSDCharPtr;     (** address of data **)
    sqlind                      : PShort;    (** address of indicator **)
                                             (** variable **)
    sqlname_length              : Short;     (** length of sqlname field **)
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = METADATALEN)]
    sqlname                     : string;	{ array[0..31] of Char }
    relname_length              : Short;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = METADATALEN)]
    relname                     : string;
    ownname_length              : Short;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = METADATALEN)]
    ownname                     : string;
    aliasname_length            : Short;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = METADATALEN)]
    aliasname                   : string;
  end;  // TXSQLVAR (SizeOf(TXSQLVAR)=152)

  [StructLayout(LayoutKind.Sequential)]
  TXSQLDA = record
    version                     : Short;     (** version of this XSQLDA **)
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
    sqldaid                     : string;	{ array[0..7] of Char }
    sqldabc                     : ISC_LONG;  (** length in bytes of SQLDA **)
    sqln                        : Short;     (** number of fields allocated **)
    sqld                        : Short;     (** actual number of fields **)
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 156)]	// 156 ???
    sqlvar                      : string;	// array[0..0] of TXSQLVAR;
  end; // TXSQLDA

  PXSQLVAR                      = Void;
  PXSQLDA                       = Void;
{$ELSE}
  TXSQLVAR = record
    sqltype                     : Short;     (** datatype of field **)
    sqlscale                    : Short;     (** scale factor **)
    sqlsubtype                  : Short;     (** datatype subtype - BLOBs **)
					     (** & text types only **)
    sqllen                      : Short;     (** length of data area **)
    sqldata                     : TSDCharPtr;     (** address of data **)
    sqlind                      : PShort;    (** address of indicator **)
                                             (** variable **)
    sqlname_length              : Short;     (** length of sqlname field **)
    (** name of field, name length + space for NULL **)
    sqlname                     : array[0..31] of Char;
    relname_length              : Short;     (** length of relation name **)
    (** field's relation name + space for NULL **)
    relname                     : array[0..31] of Char;
    ownname_length              : Short;     (** length of owner name **)
    (** relation's owner name + space for NULL **)
    ownname                     : array[0..31] of Char;
    aliasname_length            : Short;     (** length of alias name **)
    (** relation's alias name + space for NULL **)
    aliasname                   : array[0..31] of Char;
  end;  // TXSQLVAR

  TXSQLDA = record
    version                     : Short;     (** version of this XSQLDA **)
    (** XSQLDA name field **)
    sqldaid                     : array[0..7] of Char;
    sqldabc                     : ISC_LONG;  (** length in bytes of SQLDA **)
    sqln                        : Short;     (** number of fields allocated **)
    sqld                        : Short;     (** actual number of fields **)
    (** first field address **)
    sqlvar                      : array[0..0] of TXSQLVAR;
  end; // TXSQLDA

  PXSQLVAR                      = ^TXSQLVAR;
  PXSQLDA                       = ^TXSQLDA;
{$ENDIF}

(********************************************************)
(** This record type is for passing arguments to       **)
(** isc_start_transaction (See docs)                   **)
(********************************************************)
  TISC_START_TRANS = record
    db_handle      : PISC_DB_HANDLE;
    tpb_length     : UShort;
    tpb_address    : TSDCharPtr;
  end;

(********************************************************)
(** This record type is for passing arguments to       **)
(** isc_start_multiple (see docs)                      **)
(********************************************************)
  TISC_TEB = record
    db_handle      : PISC_DB_HANDLE;
    tpb_length     : Long;
    tpb_address    : TSDCharPtr;
  end;
  PISC_TEB = ^TISC_TEB;
  TISC_TEB_ARRAY = array[0..0] of TISC_TEB;
  PISC_TEB_ARRAY = ^TISC_TEB_ARRAY;

(********************************************************)
(** Security Functions and structures                  **)
(********************************************************)
  TUSER_SEC_DATA = record
    sec_flags: Short;		// which fields are specified
    uid: Integer;    		// the user's id
    gid: Integer;    		// the user's group id
    protocol: Integer;		// protocol to use for connection
    server,          		// server to administer
    user_name,       		// the user's name
    password,        		// the user's password
    group_name,      		// the group name
    first_name,	     		// the user's first name
    middle_name,     		// the user's middle name
    last_name,	     		// the user's last name
    dba_user_name,   	    	// the dba user name
    dba_password: TSDCharPtr;    	// the dba password
  end;
  PUSER_SEC_DATA = ^TUSER_SEC_DATA;


(***********************)
(* Security structures *)
(***********************)
const
  sec_uid_spec		= $01;
  sec_gid_spec	       	= $02;
  sec_server_spec      	= $04;
  sec_password_spec    	= $08;
  sec_group_name_spec  	= $10;
  sec_first_name_spec  	= $20;
  sec_middle_name_spec 	= $40;
  sec_last_name_spec   	= $80;
  sec_dba_user_name_spec= $100;
  sec_dba_password_spec	= $200;

  sec_protocol_tcpip   	= 1;
  sec_protocol_netbeui 	= 2;
  sec_protocol_spx     	= 3;
  sec_protocol_local   	= 4;

(** Constants!!! **)
(*****************************************************)
(** Actions to pass to the blob filter (ctl_source) **)
(*****************************************************)

const
  isc_blob_filter_open           =          0;
  isc_blob_filter_get_segment    =          1;
  isc_blob_filter_close          =          2;
  isc_blob_filter_create         =          3;
  isc_blob_filter_put_segment    =          4;
  isc_blob_filter_alloc          =          5;
  isc_blob_filter_free           =          6;
  isc_blob_filter_seek           =          7;

(*********************)
(** Blr definitions **)
(*********************)

  // In pascal, how does one deal with the below "#define"?
  // blr_word(n) ((n) % 256), ((n) / 256)
  blr_text                       =         14;
  blr_text2                      =         15;
  blr_short                      =          7;
  blr_long                       =          8;
  blr_quad                       =          9;
  blr_int64                      =         16;
  blr_float                      =         10;
  blr_double                     =         27;
  blr_d_float                    =         11;
  blr_timestamp                  =         35;
  blr_varying                    =         37;
  blr_varying2                   =         38;
  blr_blob                       =        261;
  blr_cstring                    =         40;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -