📄 ibase.h
字号:
/* * MODULE: ibase.h * DESCRIPTION: OSRI entrypoints and defines * * The contents of this file are subject to the Interbase Public * License Version 1.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy * of the License at http://www.Inprise.com/IPL.html * * Software distributed under the License is distributed on an * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express * or implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code was created by Inprise Corporation * and its predecessors. Portions created by Inprise Corporation are * Copyright (C) Inprise Corporation. * * All Rights Reserved. * Contributor(s): ______________________________________. * Added TCP_NO_DELAY option for superserver on Linux * FSG 16.03.2001 * 2001.07.28: John Bellardo: Added blr_skip * 2001.09.18: Ann Harrison: New info codes *//*$Id: ibase.h,v 1.1 2001/10/13 10:22:56 dimitr Exp $ */#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#define ISC_USHORT unsigned short#define ISC_STATUS long#define DSQL_close 1#define DSQL_drop 2/******************************************************************//* 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 __cdecltypedef __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_lowtypedef struct { short array_bound_lower; short array_bound_upper;} ISC_ARRAY_BOUND;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;/***************************//* 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))))/********************************************************************//* CVC: Public blob interface definition held in val.h. *//* For some unknown reason, it was only documented in langRef *//* and being the structure passed by the engine to UDFs it never *//* made its way into this public definitions file. *//* Being its original name "blob", I renamed it blobcallback here. *//* I did the full definition with the proper parameters instead of *//* the weak C declaration with any number and type of parameters. *//* Since the first parameter -BLB- is unknown outside the engine, *//* it's more accurate to use void* than int* as the blob pointer/********************************************************************/#if !defined(_JRD_VAL_H_) && !defined(REQUESTER)/* Blob passing structure */enum lseek_mode {blb_seek_relative = 1, blb_seek_from_tail = 2};typedef struct blobcallback { short (ISC_FAR *blob_get_segment) (void ISC_FAR* hnd, unsigned char* buffer, ISC_USHORT buf_size, ISC_USHORT* result_len); void ISC_FAR *blob_handle; ISC_LONG blob_number_segments; ISC_LONG blob_max_segment; ISC_LONG blob_total_length; void (ISC_FAR *blob_put_segment) (void ISC_FAR* hnd, unsigned char* buffer, ISC_USHORT buf_size); ISC_LONG (ISC_FAR *blob_lseek) (void ISC_FAR* hnd, ISC_USHORT mode, ISC_LONG offset);} ISC_FAR *BLOBCALLBACK;#endif /* !defined(_JRD_VAL_H_) && !defined(REQUESTER) *//********************************************************************//* CVC: Public descriptor interface held in dsc.h. *//* We need it documented to be able to recognize NULL in UDFs. *//* Being its original name "dsc", I renamed it paramdsc here. *//* Notice that I adjust to the original definition: contrary to *//* other cases, the typedef is the same struct not the pointer. *//* I included the enumeration of dsc_dtype possible values. *//* Ultimately, dsc.h should be part of the public interface. *//********************************************************************/#if !defined(_JRD_DSC_H_)/* This is the famous internal descriptor that UDFs can use, too. */typedef struct paramdsc { unsigned char dsc_dtype; char dsc_scale; ISC_USHORT dsc_length; short dsc_sub_type; ISC_USHORT dsc_flags; unsigned char *dsc_address;} PARAMDSC;/* values for dsc_flags *//* Note: DSC_null is only reliably set for local variables (blr_variable) */#define DSC_null 1#define DSC_no_subtype 2 /* dsc has no sub type specified */#define DSC_nullable 4 /* not stored. instead, is derived from metadata primarily to flag SQLDA (in DSQL) *//* Overload text typing information into the dsc_sub_type field. See intl.h for definitions of text types */ #ifndef dsc_ttype#define dsc_ttype dsc_sub_type#endif/* Note that dtype_null actually means that we do not yet know the dtype for this descriptor. A nice cleanup item would be to globally change it to dtype_unknown. --chrisj 1999-02-17 */#define dtype_null 0#define dtype_text 1#define dtype_cstring 2#define dtype_varying 3#define dtype_packed 6#define dtype_byte 7#define dtype_short 8#define dtype_long 9#define dtype_quad 10#define dtype_real 11#define dtype_double 12#define dtype_d_float 13#define dtype_sql_date 14#define dtype_sql_time 15#define dtype_timestamp 16#define dtype_blob 17#define dtype_array 18#define dtype_int64 19#define DTYPE_TYPE_MAX 20#endif /* !defined(_JRD_DSC_H_) *//***************************//* Dynamic SQL definitions *//***************************/ /******************************//* Declare the extended SQLDA *//******************************/typedef struct { short sqltype; /* datatype of field */ short sqlscale; /* scale factor */ short sqlsubtype; /* datatype subtype - BLOBs & Text */ /* types only */ 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;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 XSQLDA_LENGTH(n) (sizeof (XSQLDA) + ((n)-1) * sizeof (XSQLVAR))#define SQLDA_VERSION1 1#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 __cplusplusextern "C" {#endifISC_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 *,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -