📄 ibase.pas
字号:
{***************************************************************}
{ FIBPlus - component library for direct access to Firebird and }
{ InterBase databases }
{ }
{ FIBPlus is based in part on the product }
{ Free IB Components, written by Gregory H. Deatz for }
{ Hoagland, Longo, Moran, Dunst & Doukas Company. }
{ mailto:gdeatz@hlmdd.com }
{ }
{ Copyright (c) 1998-2007 Devrace Ltd. }
{ Written by Serge Buzadzhy (buzz@devrace.com) }
{ }
{ ------------------------------------------------------------- }
{ FIBPlus home page: http://www.fibplus.com/ }
{ FIBPlus support : http://www.devrace.com/support/ }
{ ------------------------------------------------------------- }
{ }
{ Please see the file License.txt for full license information }
{***************************************************************}
unit ibase;
interface
uses
IB_Externals;
{$I FIBPlus.inc}
const
ISC_TRUE = 1;
ISC_FALSE = 0;
DSQL_close = 1;
DSQL_drop = 2;
DSQL_cancel = 4;
{$IFDEF MSWINDOWS}
{$J+}
IBASE_DLL: string = 'gds32.dll'; {do not localize}
{$J-}
{$ENDIF}
{$IFDEF LINUX}
IBASE_DLL = 'libgds.so'; {do not localize}
{$ENDIF}
const
SQLDA_VERSION1 = 1; (* pre V6.0 SQLDA *)
SQLDA_VERSION2 = 2; (* V6.0 SQLDA *)
{$IFDEF LONG_METADATA_NAMES}
SQLDA_VERSION_CURRENT = SQLDA_VERSION2;
LENGTH_METANAMES = 68;
{$ELSE}
SQLDA_VERSION_CURRENT = SQLDA_VERSION1;
LENGTH_METANAMES = 32;
{$ENDIF}
const
SQL_DIALECT_V5 = 1; (* meaning is same as DIALECT_xsqlda *)
SQL_DIALECT_V6_TRANSITION = 2; (* flagging anything that is delimited
by double quotes as an error and
flagging keyword DATE as an error *)
SQL_DIALECT_V6 = 3; (* supports SQL delimited identifier,
SQLDATE/DATE, TIME, TIMESTAMP,
CURRENT_DATE, CURRENT_TIME,
CURRENT_TIMESTAMP, and 64-bit exact
numeric type *)
SQL_DIALECT_CURRENT = SQL_DIALECT_V6; (* latest IB DIALECT *)
type
(**********************************)
(** InterBase Handle Definitions **)
(**********************************)
TISC_ATT_HANDLE = PVoid;
PISC_ATT_HANDLE = ^TISC_ATT_HANDLE;
TISC_BLOB_HANDLE = PVoid;
PISC_BLOB_HANDLE = ^TISC_BLOB_HANDLE;
TISC_DB_HANDLE = PVoid;
PISC_DB_HANDLE = ^TISC_DB_HANDLE;
TISC_FORM_HANDLE = PVoid;
PISC_FORM_HANDLE = ^TISC_FORM_HANDLE;
TISC_REQ_HANDLE = PVoid;
PISC_REQ_HANDLE = ^TISC_REQ_HANDLE;
TISC_STMT_HANDLE = PVoid;
PISC_STMT_HANDLE = ^TISC_STMT_HANDLE;
TISC_SVC_HANDLE = PVoid;
PISC_SVC_HANDLE = ^TISC_SVC_HANDLE;
TISC_TR_HANDLE = PVoid;
PISC_TR_HANDLE = ^TISC_TR_HANDLE;
TISC_WIN_HANDLE = PVoid;
PISC_WIN_HANDLE = ^TISC_WIN_HANDLE;
TISC_CALLBACK = procedure;
ISC_SVC_HANDLE = ISC_LONG;
(*******************************************************************)
(* Time & Date Support *)
(*******************************************************************)
const
TIME_SECONDS_PRECISION = 10000;
TIME_SECONDS_PRECISION_SCALE = -4;
type
ISC_DATE = Long;
PISC_DATE = ^ISC_DATE;
ISC_TIME = ULong;
PISC_TIME = ^ISC_TIME;
TISC_TIMESTAMP = record
timestamp_date: ISC_DATE;
timestamp_time: ISC_TIME;
end;
PISC_TIMESTAMP = ^TISC_TIMESTAMP;
(*********************************************************************)
(** 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;
PGDS_QUAD = ^TGDS_QUAD;
PGDS__QUAD = ^TGDS__QUAD;
PISC_QUAD = ^TISC_QUAD;
{Pointer to the 64-bit system-defined Blob ID, which is stored
in a field in the table and points to the first segment of the
Blob or to a page of pointers to Blob fragments}
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 : AnsiChar;
array_desc_length : UShort;
array_desc_field_name : array[0..LENGTH_METANAMES-1] of AnsiChar;
array_desc_relation_name : array[0..LENGTH_METANAMES-1] of AnsiChar;
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..LENGTH_METANAMES-1] of UChar;
blob_desc_relation_name : array[0..LENGTH_METANAMES-1] of UChar;
end; // TISC_BLOB_DESC
PISC_BLOB_DESC = ^TISC_BLOB_DESC;
(*****************************)
(** Blob control structure **)
(*****************************)
TISC_BLOB_CTL_SOURCE_FUNCTION = function: ISC_STATUS; // ISC_FAR
PISC_BLOB_CTL = ^TISC_BLOB_CTL; // 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 : PAnsiChar; (** 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 : PAnsiChar; (** Address of buffer **)
bstr_ptr : PAnsiChar; (** Next character **)
bstr_length : Short; (** Length of buffer **)
bstr_cnt : Short; (** Characters in buffer **)
bstr_mode : AnsiChar; (** (mode) ? OUTPUT : INPUT **)
end;
PBSTREAM = ^TBSTREAM;
(*****************************)
(** Dynamic SQL definitions **)
(*****************************)
(********************************)
(** Declare the extended SQLDA **)
(********************************)
TXSQLVAR = record
sqltype : Short; (** datatype of field **)
sqlscale : Short; (** scale factor **)
{$IFDEF LONG_METADATA_NAMES}
sqlprecision : Short; (** precision : Reserved for future **)
{$ENDIF}
sqlsubtype : Short; (** datatype subtype - BLOBs **)
(** & text types only **)
sqllen : Short; (** length of data area **)
sqldata : PAnsiChar; (** 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..LENGTH_METANAMES-1] of AnsiChar;
relname_length : Short; (** length of relation name **)
(** field's relation name + space for NULL **)
relname : array[0..LENGTH_METANAMES-1] of AnsiChar;
ownname_length : Short; (** length of owner name **)
(** relation's owner name + space for NULL **)
ownname : array[0..LENGTH_METANAMES-1] of AnsiChar;
aliasname_length : Short; (** length of alias name **)
(** relation's alias name + space for NULL **)
aliasname : array[0..LENGTH_METANAMES-1] of AnsiChar;
end; // TXSQLVAR
PXSQLVAR = ^TXSQLVAR;
PPXSQLVAR = ^PXSQLVAR;
TXSQLDA = record
version : Short; (** version of this XSQLDA **)
(** XSQLDA name field **)
sqldaid : array[0..7] of AnsiChar;
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
PXSQLDA = ^TXSQLDA;
(********************************************************)
(** 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 : PAnsiChar;
end;
(********************************************************)
(** This record type is for passing arguments to **)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -