📄 ibase.h
字号:
/*
* MODULE: ibase.h
* DESCRIPTION: OSRI entrypoints and defines
*
* Copyright (C) 2001 Borland Software Corporation
* All Rights Reserved.
*/
#ifndef _JRD_IBASE_H_
#define _JRD_IBASE_H_
#ifndef HARBOR_MERGE
#define HARBOR_MERGE
#endif
#define isc_version4
#define ISC_TRUE 1
#define ISC_FALSE 0
#if !(defined __cplusplus)
#define ISC__TRUE ISC_TRUE
#define ISC__FALSE ISC_FALSE
#endif
#if (defined __osf__ && defined __alpha)
#define ISC_LONG int
#define ISC_ULONG unsigned int
#else
#define ISC_LONG long
#define ISC_ULONG unsigned long
#endif
#ifndef ISC_BOOLEAN
#define ISC_BOOLEAN signed short
#endif
#define ISC_USHORT unsigned short
#define ISC_STATUS long
#define DSQL_close 1
#define DSQL_drop 2
#define DSQL_cancel 4
#define METADATALENGTH 68
/******************************************************************/
/* Define type, export and other stuff based on c/c++ and Windows */
/******************************************************************/
#if (defined(_MSC_VER) && defined(_WIN32)) || \
(defined(__BORLANDC__) && (defined(__WIN32__) || defined(__OS2__)))
#define ISC_FAR
#define ISC_EXPORT __stdcall
#define ISC_EXPORT_VARARG __cdecl
typedef __int64 ISC_INT64;
typedef unsigned __int64 ISC_UINT64;
#define ISC_INT64_DEFINED
#else /* Not Windows/NT */
#if (defined(__IBMC__) && defined(__OS2__))
#define ISC_FAR
#define ISC_EXPORT _System
#define ISC_EXPORT_VARARG ISC_EXPORT
#else /* not IBM C Set++ for OS/2 */
#if ( defined( _Windows) || defined( _WINDOWS))
#define ISC_FAR __far
#define ISC_EXPORT ISC_FAR __cdecl __loadds __export
#define ISC_EXPORT_VARARG ISC_EXPORT
#else /* Not Windows/NT, OS/2 or Windows */
#define ISC_FAR
#define ISC_EXPORT
#define ISC_EXPORT_VARARG
#endif /* Windows and Not Windows/NT or OS/2 */
#endif /* IBM C Set++ for OS/2 */
#endif /* Windows/NT */
/*******************************************************************/
/* 64 bit Integers */
/*******************************************************************/
#ifndef ISC_INT64_DEFINED
typedef long long int ISC_INT64;
typedef unsigned long long int ISC_UINT64;
#else
#undef ISC_INT64_DEFINED
#endif
/*******************************************************************/
/* Time & Date Support */
/*******************************************************************/
#ifndef _ISC_TIMESTAMP_
typedef long ISC_DATE;
typedef unsigned long ISC_TIME;
typedef struct {
ISC_DATE timestamp_date;
ISC_TIME timestamp_time;
} ISC_TIMESTAMP;
#define _ISC_TIMESTAMP_ 1
#endif
#define ISC_TIME_SECONDS_PRECISION 10000L
#define ISC_TIME_SECONDS_PRECISION_SCALE -4
/*******************************************************************/
/* Blob id structure */
/*******************************************************************/
typedef struct {
ISC_LONG gds_quad_high;
unsigned ISC_LONG gds_quad_low;
} GDS_QUAD;
#if !(defined __cplusplus)
typedef GDS_QUAD GDS__QUAD;
#endif /* !(defined __cplusplus) */
#define ISC_QUAD GDS_QUAD
#define isc_quad_high gds_quad_high
#define isc_quad_low gds_quad_low
typedef struct {
short array_bound_lower;
short array_bound_upper;
} ISC_ARRAY_BOUND;
typedef struct {
short array_desc_version;
unsigned char array_desc_dtype;
unsigned char array_desc_subtype;
char array_desc_scale;
unsigned short array_desc_length;
char array_desc_field_name [METADATALENGTH];
char array_desc_relation_name [METADATALENGTH];
short array_desc_dimensions;
short array_desc_flags;
ISC_ARRAY_BOUND array_desc_bounds [16];
} ISC_ARRAY_DESC_V2;
#define ARR_DESC_VERSION2 2
#define ARR_DESC_CURRENT_VERSION ARR_DESC_VERSION2
typedef struct {
short blob_desc_version;
short blob_desc_subtype;
short blob_desc_charset;
short blob_desc_segment_size;
unsigned char blob_desc_field_name [METADATALENGTH];
unsigned char blob_desc_relation_name [METADATALENGTH];
} ISC_BLOB_DESC_V2;
#define BLB_DESC_VERSION2 2
#define BLB_DESC_CURRENT_VERSION BLB_DESC_VERSION2
/***************************/
/* Blob control structure */
/***************************/
typedef struct isc_blob_ctl{
ISC_STATUS (ISC_FAR *ctl_source)(); /* Source filter */
struct isc_blob_ctl ISC_FAR *ctl_source_handle; /* Argument to pass to source */
/* filter */
short ctl_to_sub_type; /* Target type */
short ctl_from_sub_type; /* Source type */
unsigned short ctl_buffer_length; /* Length of buffer */
unsigned short ctl_segment_length; /* Length of current segment */
unsigned short ctl_bpb_length; /* Length of blob parameter */
/* block */
char ISC_FAR *ctl_bpb; /* Address of blob parameter */
/* block */
unsigned char ISC_FAR *ctl_buffer; /* Address of segment buffer */
ISC_LONG ctl_max_segment; /* Length of longest segment */
ISC_LONG ctl_number_segments; /* Total number of segments */
ISC_LONG ctl_total_length; /* Total length of blob */
ISC_STATUS ISC_FAR *ctl_status; /* Address of status vector */
long ctl_data [8]; /* Application specific data */
} ISC_FAR *ISC_BLOB_CTL;
/***************************/
/* Blob stream definitions */
/***************************/
typedef struct bstream {
void ISC_FAR *bstr_blob; /* Blob handle */
char ISC_FAR *bstr_buffer; /* Address of buffer */
char ISC_FAR *bstr_ptr; /* Next character */
short bstr_length; /* Length of buffer */
short bstr_cnt; /* Characters in buffer */
char bstr_mode; /* (mode) ? OUTPUT : INPUT */
} BSTREAM;
#define getb(p) (--(p)->bstr_cnt >= 0 ? *(p)->bstr_ptr++ & 0377: BLOB_get (p))
#define putb(x,p) (((x) == '\n' || (!(--(p)->bstr_cnt))) ? BLOB_put ((x),p) : ((int) (*(p)->bstr_ptr++ = (unsigned) (x))))
#define putbx(x,p) ((!(--(p)->bstr_cnt)) ? BLOB_put ((x),p) : ((int) (*(p)->bstr_ptr++ = (unsigned) (x))))
/***********************************************************************
* Older and obsolete XSQLVAR, ISC_BLOB_DESC, ISC_ARRAY_DESC strucutres.
* NOTE:These structure will no longer be available in future releases.
* This is kept only for backward compatability.
* Please refrain from using these old structures.
* It is strongly recomended to use the newer SQLDA version
* and related XSQLVAR, ISC_BLOB_DESC, ISC_ARRAY_DESC structures.
***********************************************************************/
typedef struct {
short sqltype; /* datatype of field */
short sqlscale; /* scale factor */
short sqlsubtype; /* datatype subtype */
short sqllen; /* length of data area */
char ISC_FAR *sqldata; /* address of data */
short ISC_FAR *sqlind; /* address of indicator variable */
short sqlname_length; /* length of sqlname field */
char sqlname [32]; /* name of field, name length + space */
/* for NULL */
short relname_length; /* length of relation name */
char relname [32]; /* field's relation name + space for */
/* NULL */
short ownname_length; /* length of owner name */
char ownname [32]; /* relation's owner name + space for */
/* NULL */
short aliasname_length; /* length of alias name */
char aliasname [32]; /* relation's alias name + space for */
/* NULL */
} XSQLVAR_V1;
#define SQLDA_VERSION1 1
typedef struct {
unsigned char array_desc_dtype;
char array_desc_scale;
unsigned short array_desc_length;
char array_desc_field_name [32];
char array_desc_relation_name [32];
short array_desc_dimensions;
short array_desc_flags;
ISC_ARRAY_BOUND array_desc_bounds [16];
} ISC_ARRAY_DESC;
typedef struct {
short blob_desc_subtype;
short blob_desc_charset;
short blob_desc_segment_size;
unsigned char blob_desc_field_name [32];
unsigned char blob_desc_relation_name [32];
} ISC_BLOB_DESC;
/***********************************************/
/***************************/
/* Dynamic SQL definitions */
/***************************/
/******************************/
/* Declare the extended SQLDA */
/******************************/
typedef struct {
short sqltype; /* datatype of field */
short sqlscale; /* scale factor */
short sqlprecision; /* precision : Reserved for future */
short sqlsubtype; /* datatype subtype */
short sqllen; /* length of data area */
char ISC_FAR *sqldata; /* address of data */
short ISC_FAR *sqlind; /* address of indicator variable */
short sqlname_length; /* length of sqlname field */
char sqlname [METADATALENGTH]; /* name of field, name length + space */
/* for NULL */
short relname_length; /* length of relation name */
char relname [METADATALENGTH]; /* field's relation name + space for */
/* NULL */
short ownname_length; /* length of owner name */
char ownname [METADATALENGTH]; /* relation's owner name + space for */
/* NULL */
short aliasname_length; /* length of alias name */
char aliasname [METADATALENGTH]; /* relation's alias name + space for */
/* NULL */
} XSQLVAR;
typedef struct {
short version; /* version of this XSQLDA */
char sqldaid [8]; /* XSQLDA name field */
ISC_LONG sqldabc; /* length in bytes of SQLDA */
short sqln; /* number of fields allocated */
short sqld; /* actual number of fields */
XSQLVAR sqlvar[1]; /* first field address */
} XSQLDA;
#define SQLDA_VERSION2 2
#define SQLDA_CURRENT_VERSION SQLDA_VERSION2
#define XSQLDA_LENGTH(n) (sizeof (XSQLDA) + (n) * sizeof (XSQLVAR))
#define SQL_DIALECT_V5 1/* meaning is same as DIALECT_xsqlda */
#define SQL_DIALECT_V6_TRANSITION 2/* flagging anything that is delimited
by double quotes as an error and
flagging keyword DATE as an error */
#define SQL_DIALECT_V6 3/* supports SQL delimited identifier,
SQLDATE/DATE, TIME, TIMESTAMP,
CURRENT_DATE, CURRENT_TIME,
CURRENT_TIMESTAMP, and 64-bit exact
numeric type */
#define SQL_DIALECT_CURRENT SQL_DIALECT_V6/* latest IB DIALECT */
/********************************/
/* InterBase Handle Definitions */
/********************************/
typedef void ISC_FAR *isc_att_handle;
typedef void ISC_FAR *isc_blob_handle;
typedef void ISC_FAR *isc_db_handle;
typedef void ISC_FAR *isc_form_handle;
typedef void ISC_FAR *isc_req_handle;
typedef void ISC_FAR *isc_stmt_handle;
typedef void ISC_FAR *isc_svc_handle;
typedef void ISC_FAR *isc_tr_handle;
typedef void ISC_FAR *isc_win_handle;
typedef void (ISC_FAR *isc_callback)();
typedef ISC_LONG isc_resv_handle;
/***************************/
/* OSRI database functions */
/***************************/
#if defined(__cplusplus) || defined(__STDC__) || defined(_Windows) || \
(defined(_MSC_VER) && defined(WIN32)) || defined( _WINDOWS) || \
(defined(__BORLANDC__) && (defined(__WIN32__) || defined(__OS2__))) || \
(defined(__IBMC__) && defined(__OS2__)) || defined(AIX_PPC)
#ifdef __cplusplus
extern "C" {
#endif
ISC_STATUS ISC_EXPORT isc_attach_database (ISC_STATUS ISC_FAR *,
short,
char ISC_FAR *,
isc_db_handle ISC_FAR *,
short,
char ISC_FAR *);
ISC_STATUS ISC_EXPORT isc_array_gen_sdl (ISC_STATUS ISC_FAR *,
ISC_ARRAY_DESC ISC_FAR *,
short ISC_FAR *,
char ISC_FAR *,
short ISC_FAR *);
ISC_STATUS ISC_EXPORT isc_array_gen_sdl2 (ISC_STATUS ISC_FAR *,
ISC_ARRAY_DESC_V2 ISC_FAR *,
short ISC_FAR *,
char ISC_FAR *,
short ISC_FAR *);
ISC_STATUS ISC_EXPORT isc_array_get_slice (ISC_STATUS ISC_FAR *,
isc_db_handle ISC_FAR *,
isc_tr_handle ISC_FAR *,
ISC_QUAD ISC_FAR *,
ISC_ARRAY_DESC ISC_FAR *,
void ISC_FAR *,
ISC_LONG ISC_FAR *);
ISC_STATUS ISC_EXPORT isc_array_get_slice2 (ISC_STATUS ISC_FAR *,
isc_db_handle ISC_FAR *,
isc_tr_handle ISC_FAR *,
ISC_QUAD ISC_FAR *,
ISC_ARRAY_DESC_V2 ISC_FAR *,
void ISC_FAR *,
ISC_LONG ISC_FAR *);
ISC_STATUS ISC_EXPORT isc_array_lookup_bounds (ISC_STATUS ISC_FAR *,
isc_db_handle ISC_FAR *,
isc_tr_handle ISC_FAR *,
char ISC_FAR *,
char ISC_FAR *,
ISC_ARRAY_DESC ISC_FAR *);
ISC_STATUS ISC_EXPORT isc_array_lookup_bounds2 (ISC_STATUS ISC_FAR *,
isc_db_handle ISC_FAR *,
isc_tr_handle ISC_FAR *,
char ISC_FAR *,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -