00001 #ifndef __SQLORA8_H_LOADED
00002 #define __SQLORA8_H_LOADED
00003
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00063 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00064 #include <stdio.h>
00065 #include "libsqlora8-config.h"
00066 #endif
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 #undef __BEGIN_DECLS
00084 #undef __END_DECLS
00085 #ifdef __cplusplus
00086 # define __BEGIN_DECLS extern "C" {
00087 # define __END_DECLS }
00088 #else
00089 # define __BEGIN_DECLS
00090 # define __END_DECLS
00091 #endif
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 #undef __P
00102 #if (defined(PROTOTYPES) || defined(__STDC__) || defined(__cplusplus) )
00103 # define __P(protos) protos
00104 #else
00105 # define __P(protos) ()
00106 #endif
00107
00108
00109
00110
00111
00112
00113
00114
00115 #undef CONST
00116
00117 #ifndef const
00118 # if (defined(__STDC__) || defined(PROTOTYPES) || defined(__cplusplus))
00119 # define CONST const
00120 # else
00121 # define CONST
00122 # endif
00123 #else
00124 # define CONST
00125 #endif
00126
00138 enum sqlo_status_codes {
00139 SQLO_SUCCESS = 0,
00140 SQLO_ERROR = -1,
00141 SQLO_INVALID_HANDLE = -2,
00142 SQLO_STILL_EXECUTING = -3123,
00143 SQLO_CONTINUE = -24200,
00144 SQLO_SUCCESS_WITH_INFO = 1,
00145 SQLO_NEED_DATA = 99,
00146 SQLO_NO_DATA = 100
00147 };
00148
00155 enum sqlo_error_codes {
00156 SQLO_ERROR_BASE = -30000,
00157 SQLO_INVALID_DB_HANDLE = (SQLO_ERROR_BASE - 1),
00158 SQLO_ERRMALLOC = (SQLO_ERROR_BASE - 2),
00159 SQLO_INVALID_STMT_HANDLE = (SQLO_ERROR_BASE - 3),
00160 SQLO_STMT_NOT_OPENED = (SQLO_ERROR_BASE - 4),
00162 SQLO_INVALID_STMT_TYPE = (SQLO_ERROR_BASE - 5),
00164 SQLO_STMT_NOT_PARSED = (SQLO_ERROR_BASE - 6),
00166 SQLO_INVALID_OCI_HANDLE_TYPE = (SQLO_ERROR_BASE - 7),
00168 SQLO_MALFORMED_VERSION_STR = (SQLO_ERROR_BASE - 8),
00170 SQLO_WRONG_VERSION = (SQLO_ERROR_BASE - 9),
00172 SQLO_INVALID_COLPOS = (SQLO_ERROR_BASE - 10),
00173 SQLO_INVALID_SQL = (SQLO_ERROR_BASE -11)
00174 };
00175
00180 enum sqlo_constants {
00181 SQLO_OFF = 0,
00182 SQLO_ON = 1,
00183 SQLO_NULL_IND = -1,
00184 SQLO_NOT_NULL_IND = 0,
00185 SQLO_STH_INIT = -1,
00188
00189 SQLO_ONE_PIECE = 0,
00191 SQLO_FIRST_PIECE = 1,
00193 SQLO_NEXT_PIECE = 2,
00195 SQLO_LAST_PIECE = 3
00198 };
00199
00208 enum sqlo_data_types {
00209 SQLOT_CHR = 1,
00210 SQLOT_NUM = 2,
00211 SQLOT_INT = 3,
00212 SQLOT_FLT = 4,
00213 SQLOT_STR = 5,
00214 SQLOT_VNU = 6,
00215 SQLOT_PDN = 7,
00216 SQLOT_LNG = 8,
00217 SQLOT_VCS = 9,
00218 SQLOT_NON = 10,
00219 SQLOT_RID = 11,
00220 SQLOT_DAT = 12,
00221 SQLOT_VBI = 15,
00222 SQLOT_BIN = 23,
00223 SQLOT_LBI = 24,
00224 SQLOT_UIN = 68,
00225 SQLOT_SLS = 91,
00226 SQLOT_LVC = 94,
00227 SQLOT_LVB = 95,
00228 SQLOT_AFC = 96,
00229 SQLOT_AVC = 97,
00230 SQLOT_CUR = 102,
00231 SQLOT_RDD = 104,
00232 SQLOT_LAB = 105,
00233 SQLOT_OSL = 106,
00234 SQLOT_NTY = 108,
00235 SQLOT_REF = 110,
00236 SQLOT_CLOB = 112,
00237 SQLOT_BLOB = 113,
00238 SQLOT_BFILEE = 114,
00239 SQLOT_CFILEE = 115,
00240 SQLOT_RSET = 116,
00241 SQLOT_NCO = 122,
00242 SQLOT_VST = 155,
00243 SQLOT_ODT = 156,
00245
00246 SQLOT_DATE = 184,
00247 SQLOT_TIME = 185,
00248 SQLOT_TIME_TZ = 186,
00249 SQLOT_TIMESTAMP = 187,
00250 SQLOT_TIMESTAMP_TZ = 188,
00251 SQLOT_INTERVAL_YM = 189,
00252 SQLOT_INTERVAL_DS = 190,
00253 SQLOT_TIMESTAMP_LTZ = 232
00254 };
00255
00256
00257
00258 #define SQLOT_FILE SQLOT_BFILEE
00259 #define SQLOT_CFILE SQLOT_CFILEE
00260 #define SQLOT_BFILE SQLOT_BFILEE
00261
00266 enum sqlo_statement_states {
00267 SQLO_STMT_STATE_INITIALIZED = 1,
00268 SQLO_STMT_STATE_EXECUTED = 2,
00269 SQLO_STMT_STATE_END_OF_FETCH = 3
00270 };
00271
00282 typedef int sqlo_db_handle_t;
00283
00287 typedef int sqlo_stmt_handle_t;
00288
00292 typedef enum {
00293 SQLO_OCI_HTYPE_ENV = 1,
00294 SQLO_OCI_HTYPE_ERROR = 2,
00295 SQLO_OCI_HTYPE_SVCCTX = 3,
00296 SQLO_OCI_HTYPE_SERVER = 4,
00297 SQLO_OCI_HTYPE_SESSION = 5,
00298 SQLO_OCI_HTYPE_STMT = 6
00299 } sqlo_oci_handle_types_e;
00300
00301
00307 typedef void * sqlo_lob_desc_t;
00308
00309
00313 typedef void (*sqlo_signal_handler_t) __P((void));
00314
00315
00318
00319
00320
00330 extern CONST unsigned sqlo_major_version;
00335 extern CONST unsigned sqlo_minor_version;
00340 extern CONST unsigned sqlo_micro_version;
00345 extern CONST unsigned sqlo_interface_age;
00350 extern CONST unsigned sqlo_binary_age;
00351
00352
00353 extern CONST unsigned sqlora8_major_version;
00354 extern CONST unsigned sqlora8_minor_version;
00355 extern CONST unsigned sqlora8_micro_version;
00356 extern CONST unsigned sqlora8_interface_age;
00357 extern CONST unsigned sqlora8_binary_age;
00358 #define SQLORA8_MAJOR_VERSION LIBSQLORA8_MAJOR_VERSION
00359 #define SQLORA8_MINOR_VERSION LIBSQLORA8_MINOR_VERSION
00360 #define SQLORA8_MICRO_VERSION LIBSQLORA8_MICRO_VERSION
00361
00362
00363
00370 #define SQLORA8_CHECK_VERSION(major,minor,micro) \
00371 (LIBSQLORA8_MAJOR_VERSION > (major) || \
00372 (LIBSQLORA8_MAJOR_VERSION == (major) && LIBSQLORA8_MINOR_VERSION > (minor)) || \
00373 (LIBSQLORA8_MAJOR_VERSION == (major) && LIBSQLORA8_MINOR_VERSION == (minor) && \
00374 LIBSQLORA8_MICRO_VERSION >= (micro)))
00375
00376
00377
00378
00379
00380
00381 __BEGIN_DECLS
00382
00407 int sqlo_init __P((int threaded_mode, unsigned int max_db, unsigned int max_cursors));
00408
00423 int sqlo_version __P((CONST char * version_str));
00424
00439 CONST char * sqlo_geterror __P(( sqlo_db_handle_t dbh ));
00440
00448 int sqlo_geterrcode __P(( sqlo_db_handle_t dbh ));
00449
00478 int sqlo_exists __P(( sqlo_db_handle_t dbh,
00479 CONST char * table,
00480 CONST char * colname,
00481 CONST char * colval,
00482 CONST char * where ));
00502 int sqlo_count __P((sqlo_db_handle_t dbh,
00503 CONST char * table,
00504 CONST char * colname,
00505 CONST char * colval,
00506 CONST char * where ));
00507
00528 int sqlo_run __P(( sqlo_db_handle_t dbh, CONST char * stmt, int argc, CONST char ** argv));
00529
00530
00555 sqlo_stmt_handle_t sqlo_open __P((sqlo_db_handle_t dbh,
00556 CONST char * stmt,
00557 int argc,
00558 CONST char ** argv));
00559
00591 int sqlo_open2 __P((sqlo_stmt_handle_t * sthp,
00592 sqlo_db_handle_t dbh,
00593 CONST char * stmt,
00594 int argc,
00595 CONST char ** argv));
00596
00619 int sqlo_reopen __P((sqlo_stmt_handle_t sth,
00620 int argc,
00621 CONST char ** argv));
00622
00644 int sqlo_fetch __P((sqlo_stmt_handle_t sth, unsigned int nrows));
00645
00665 CONST char **sqlo_values __P(( sqlo_stmt_handle_t sth, int * num, int dostrip ));
00666
00681 CONST unsigned short * sqlo_value_lens __P(( sqlo_stmt_handle_t sth, int * num));
00682
00697 CONST char **sqlo_ocol_names __P(( sqlo_stmt_handle_t sth, int * num));
00698
00699
00714 CONST int *sqlo_ocol_name_lens __P(( sqlo_stmt_handle_t sth, int * num));
00715
00728 int sqlo_ncols __P((sqlo_stmt_handle_t sth, int in));
00729
00737 CONST char *sqlo_command __P(( sqlo_stmt_handle_t sth ));
00738
00752 int sqlo_close __P(( sqlo_stmt_handle_t sth ));
00753
00770 int sqlo_exec __P(( sqlo_db_handle_t dbh, CONST char * stmt ));
00771
00772
00773
00786 int sqlo_isopen __P((sqlo_stmt_handle_t sth));
00787
00800 int sqlo_prows __P(( sqlo_stmt_handle_t sth ));
00801
00827 int sqlo_connect __P(( sqlo_db_handle_t * dbhp, CONST char * cstr ));
00828
00829
00845 int sqlo_finish __P((sqlo_db_handle_t dbh ));
00846
00866 int sqlo_split_cstring __P((CONST char * cstr,
00867 char * uid,
00868 char * pwd,
00869 char * tnsname,
00870 unsigned int bufsize));
00871
00891 int sqlo_server_attach __P((sqlo_db_handle_t * dbhp, CONST char * tnsname));
00892
00913 int sqlo_session_begin __P((sqlo_db_handle_t dbh, CONST char * username, CONST char * password));
00914
00931 int sqlo_server_detach __P((sqlo_db_handle_t dbh));
00932
00952 int sqlo_session_end __P((sqlo_db_handle_t dbh));
00953
00954
00967 CONST char * sqlo_getdatabase __P((sqlo_db_handle_t dbh ));
00968
00989 int sqlo_commit __P((sqlo_db_handle_t dbh));
00990
01004 int sqlo_rollback __P((sqlo_db_handle_t dbh));
01038 int sqlo_prepare __P((sqlo_db_handle_t dbh, CONST char * stmt));
01039
01068 int sqlo_bind_by_name __P((sqlo_stmt_handle_t sth,
01069 CONST char * name,
01070 int param_type,
01071 CONST void * param_addr,
01072 unsigned int param_size,
01073 short * ind_addr,
01074 int is_array));
01075
01095 int sqlo_bind_ref_cursor __P((sqlo_stmt_handle_t sth, CONST char * cursor_name, int * sth2p));
01096
01122 int sqlo_bind_by_pos __P((sqlo_stmt_handle_t sth,
01123 int position,
01124 int param_type,
01125 CONST void * param_addr,
01126 unsigned int param_size,
01127 short * ind_addr,
01128 int is_array));
01129
01156 int sqlo_bind_by_pos2 __P((sqlo_stmt_handle_t sth,
01157 int position,
01158 int param_type,
01159 CONST void * param_addr,
01160 unsigned int param_size,
01161 short * ind_addr,
01162 unsigned short * rcode_addr,
01163 unsigned int skip_size));
01164
01165
01200 int sqlo_define_by_pos __P((sqlo_stmt_handle_t sth,
01201 int value_pos,
01202 int value_type,
01203 CONST void * value_addr,
01204 unsigned int value_size,
01205 short * ind_addr,
01206 short * rlen_addr,
01207 int is_array));
01208
01244 int sqlo_define_by_pos2 __P((sqlo_stmt_handle_t sth,
01245 int value_pos,
01246 int value_type,
01247 CONST void * value_addr,
01248 unsigned int value_size,
01249 short * ind_addr,
01250 unsigned short * rlen_addr,
01251 unsigned short * rcode_addr,
01252 unsigned int skip_size));
01253
01267 int sqlo_define_ntable __P((sqlo_stmt_handle_t sth, unsigned int pos, int * sth2p));
01268
01269
01291 int sqlo_execute __P((sqlo_stmt_handle_t sth, unsigned int iterations));
01292
01310 int sqlo_alloc_lob_desc __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t *loblpp));
01311
01326 int sqlo_free_lob_desc __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t *loblpp));
01327
01353 int sqlo_lob_write_buffer __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int loblen,
01354 void *bufp, unsigned int bufl, unsigned int piece));
01380 int sqlo_lob_append_buffer __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp,
01381 unsigned int loblen,
01382 void *bufp, unsigned int bufl,
01383 unsigned int piece));
01384
01407 int sqlo_lob_write_stream __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int filelen, FILE * fp));
01408
01409
01423 int sqlo_lob_get_length __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int * loblenp));
01424
01449 int sqlo_lob_read_buffer __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int loblen, void *bufp, unsigned int bufl));
01450
01451
01474 int sqlo_lob_read_stream __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int loblen,
01475 FILE *fp));
01499 int sqlo_get_oci_handle __P((int sqloh, void * ocihp, sqlo_oci_handle_types_e type));
01500
01510 int sqlo_get_db_handle __P((sqlo_stmt_handle_t sth));
01511
01512
01539 int sqlo_set_blocking __P((sqlo_db_handle_t dbh, unsigned int on));
01540
01541
01553 int sqlo_get_blocking __P((sqlo_db_handle_t dbh, unsigned int * blocking));
01554
01555
01576 int sqlo_break __P((sqlo_db_handle_t dbh));
01577
01578
01590 int sqlo_set_prefetch_rows __P((sqlo_stmt_handle_t sth, unsigned int nrows));
01591
01592
01609 int sqlo_server_version __P((sqlo_db_handle_t dbh, char *bufp, unsigned int buflen));
01610
01618 int sqlo_get_stmt_state __P((sqlo_stmt_handle_t sth));
01619
01626 CONST char * sqlo_get_stmt __P((sqlo_stmt_handle_t sth));
01627
01639 int sqlo_get_ocol_dtype __P((sqlo_stmt_handle_t sth, unsigned int pos));
01640
01641
01655 int sqlo_trace __P((sqlo_db_handle_t dbh, int on ));
01656
01657
01670 int sqlo_print __P(( sqlo_stmt_handle_t sth ));
01671
01683 int sqlo_register_int_handler __P((int * handle, sqlo_signal_handler_t signal_handler));
01684
01691 int sqlo_clear_int_handler __P((int handle));
01692
01693
01698
01699
01700
01701
01702 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01703
01704 int sql_init __P(( void ));
01705
01706 int sql_trace __P(( int on ));
01707
01708 CONST char * sql_geterror __P(( void ));
01709
01710 int sql_geterrcode __P(( void ));
01711
01712 int sql_exists __P((CONST char * table, CONST char * field,
01713 CONST char * value, CONST char * where ));
01714 int sql_run __P((CONST char * stmt, int argc, CONST char ** argv));
01715
01716 int sql_open __P((CONST char * stmt, int argc,
01717 CONST char ** argv));
01718
01719 int sql_reopen __P((int sth, int argc, CONST char ** argv));
01720
01721 int sql_fetch __P((int sth ));
01722
01723 CONST char **sql_values __P(( int sth, int * num, int dostrip ));
01724
01725 CONST char *sql_command __P(( int sth ));
01726
01727 int sql_close __P(( int sth ));
01728
01729 int sql_print __P(( int sth ));
01730
01731 int sql_finish __P((void));
01732
01733 CONST char * sql_getdatabase __P(( void ));
01734
01735 CONST char ** sql_cnam __P(( int sth, int in, int * num ));
01736
01737 CONST char ** sql_sclen __P(( int sth, int in, int * num ));
01738
01739 int sql_prows __P(( int sth ));
01740
01741 int sql_connect __P(( CONST char * connect_str ));
01742
01743 int sql_commit __P(( void ));
01744
01745 int sql_rollback __P(( void ));
01746
01747 int sql_count __P((CONST char * table,
01748 CONST char * field,
01749 CONST char * value,
01750 CONST char * where ));
01751
01752 int sql_exec __P(( CONST char * stmt ));
01753
01754 int sql_setparam __P(( int argc , CONST char ** argv));
01755
01756 char CONST ** sql_getparam __P(( int namec, CONST char ** name, int *numvalues ));
01757 int sql_isopen __P((int sth));
01758
01759 int sql_prepare __P((CONST char * stmt));
01760
01761 int sql_bind_by_name __P((int sth, CONST char * name, int param_type,
01762 CONST void * param_addr, unsigned int param_size,
01763 short * ind_addr, int is_array));
01764
01765 int sql_bind_by_pos __P((int sth, int position, int param_type, CONST void * param_addr, unsigned int param_size, short * ind_addr, int is_array));
01766
01767 int sql_define_by_pos __P((int sth, int value_pos, int value_type,
01768 CONST void * value_addr,
01769 unsigned int value_size,
01770 short * ind_addr,
01771 short * rlen_addr,
01772 int is_array));
01773
01774 int sql_execute __P((int sth, int iterations));
01775
01776 char CONST **sql_ocol_names __P((int sth, int * num));
01777
01778 int CONST *sql_ocol_name_lens __P((int sth, int * num));
01779
01780 unsigned short CONST * sql_value_lens __P((int sth, int * num));
01781
01782 int sql_ncols __P((int sth, int in));
01783
01784 int sql_getdbh __P((void));
01785
01786 #define SQLO_DEFDBH (sql_getdbh())
01787 #endif
01788
01789 __END_DECLS
01790
01791
01792 #endif
01793