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
00102
00103 #undef __P
00104 #if (defined(PROTOTYPES) || defined(__STDC__) || defined(__cplusplus) )
00105 # define __P(protos) protos
00106 #else
00107 # define __P(protos) ()
00108 #endif
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 #undef CONST
00120
00121 #ifndef const
00122 # if (defined(__STDC__) || defined(PROTOTYPES) || defined(__cplusplus))
00123 # define CONST const
00124 # else
00125 # define CONST
00126 # endif
00127 #else
00128 # define CONST
00129 #endif
00130
00131
00132
00146 enum sqlo_status_codes {
00147 SQLO_SUCCESS = 0,
00148 SQLO_ERROR = -1,
00149 SQLO_INVALID_HANDLE = -2,
00150 SQLO_STILL_EXECUTING = -3123,
00151 SQLO_CONTINUE = -24200,
00152 SQLO_SUCCESS_WITH_INFO = 1,
00153 SQLO_NEED_DATA = 99,
00154 SQLO_NO_DATA = 100
00155 };
00156
00157
00158
00165 enum sqlo_error_codes {
00166 SQLO_ERROR_BASE = -30000,
00167 SQLO_INVALID_DB_HANDLE = (SQLO_ERROR_BASE - 1),
00168 SQLO_ERRMALLOC = (SQLO_ERROR_BASE - 2),
00169 SQLO_INVALID_STMT_HANDLE = (SQLO_ERROR_BASE - 3),
00170 SQLO_STMT_NOT_OPENED = (SQLO_ERROR_BASE - 4),
00172 SQLO_INVALID_STMT_TYPE = (SQLO_ERROR_BASE - 5),
00174 SQLO_STMT_NOT_PARSED = (SQLO_ERROR_BASE - 6),
00176 SQLO_INVALID_OCI_HANDLE_TYPE = (SQLO_ERROR_BASE - 7),
00178 SQLO_MALFORMED_VERSION_STR = (SQLO_ERROR_BASE - 8),
00180 SQLO_WRONG_VERSION = (SQLO_ERROR_BASE - 9),
00182 SQLO_INVALID_COLPOS = (SQLO_ERROR_BASE - 10),
00183 SQLO_INVALID_SQL = (SQLO_ERROR_BASE -11),
00184 SQLO_UNSUPPORTED_DATA_TYPE = (SQLO_ERROR_BASE - 12)
00185 };
00186
00187
00188
00193 enum sqlo_constants {
00194 SQLO_OFF = 0,
00195 SQLO_ON = 1,
00196 SQLO_NULL_IND = -1,
00197 SQLO_NOT_NULL_IND = 0,
00198 SQLO_STH_INIT = -1,
00201
00202 SQLO_ONE_PIECE = 0,
00204 SQLO_FIRST_PIECE = 1,
00206 SQLO_NEXT_PIECE = 2,
00208 SQLO_LAST_PIECE = 3
00211 };
00212
00213
00214
00223 enum sqlo_data_types {
00224 SQLOT_CHR = 1,
00225 SQLOT_NUM = 2,
00226 SQLOT_INT = 3,
00227 SQLOT_FLT = 4,
00228 SQLOT_STR = 5,
00229 SQLOT_VNU = 6,
00230 SQLOT_PDN = 7,
00231 SQLOT_LNG = 8,
00232 SQLOT_VCS = 9,
00233 SQLOT_NON = 10,
00234 SQLOT_RID = 11,
00235 SQLOT_DAT = 12,
00236 SQLOT_VBI = 15,
00237 SQLOT_BIN = 23,
00238 SQLOT_LBI = 24,
00239 SQLOT_UIN = 68,
00240 SQLOT_SLS = 91,
00241 SQLOT_LVC = 94,
00242 SQLOT_LVB = 95,
00243 SQLOT_AFC = 96,
00244 SQLOT_AVC = 97,
00245 SQLOT_CUR = 102,
00246 SQLOT_RDD = 104,
00247 SQLOT_LAB = 105,
00248 SQLOT_OSL = 106,
00249 SQLOT_NTY = 108,
00250 SQLOT_REF = 110,
00251 SQLOT_CLOB = 112,
00252 SQLOT_BLOB = 113,
00253 SQLOT_BFILEE = 114,
00254 SQLOT_CFILEE = 115,
00255 SQLOT_RSET = 116,
00256 SQLOT_NCO = 122,
00257 SQLOT_VST = 155,
00258 SQLOT_ODT = 156,
00260
00261 SQLOT_DATE = 184,
00262 SQLOT_TIME = 185,
00263 SQLOT_TIME_TZ = 186,
00264 SQLOT_TIMESTAMP = 187,
00265 SQLOT_TIMESTAMP_TZ = 188,
00266 SQLOT_INTERVAL_YM = 189,
00267 SQLOT_INTERVAL_DS = 190,
00268 SQLOT_TIMESTAMP_LTZ = 232
00269 };
00270
00271
00272
00273
00274
00275 #define SQLOT_FILE SQLOT_BFILEE
00276 #define SQLOT_CFILE SQLOT_CFILEE
00277 #define SQLOT_BFILE SQLOT_BFILEE
00278
00279
00280
00285 enum sqlo_statement_states {
00286 SQLO_STMT_STATE_INITIALIZED = 1,
00287 SQLO_STMT_STATE_EXECUTED = 2,
00288 SQLO_STMT_STATE_END_OF_FETCH = 3
00289 };
00290
00291
00292
00307 typedef int sqlo_db_handle_t;
00308
00309
00310
00316 typedef int sqlo_stmt_handle_t;
00317
00318
00319
00323 typedef enum {
00324 SQLO_OCI_HTYPE_ENV = 1,
00325 SQLO_OCI_HTYPE_ERROR = 2,
00326 SQLO_OCI_HTYPE_SVCCTX = 3,
00327 SQLO_OCI_HTYPE_SERVER = 4,
00328 SQLO_OCI_HTYPE_SESSION = 5,
00329 SQLO_OCI_HTYPE_STMT = 6
00330 } sqlo_oci_handle_types_e;
00331
00332
00333
00339 typedef void * sqlo_lob_desc_t;
00340
00341
00342
00346 typedef void (*sqlo_signal_handler_t) __P((void));
00347
00348
00349
00354
00355
00356
00357
00369 extern CONST unsigned sqlo_major_version;
00370
00371
00372
00377 extern CONST unsigned sqlo_minor_version;
00378
00379
00380
00385 extern CONST unsigned sqlo_micro_version;
00386
00387
00388
00393 extern CONST unsigned sqlo_interface_age;
00394
00395
00396
00401 extern CONST unsigned sqlo_binary_age;
00402
00403
00404 extern CONST unsigned sqlora8_major_version;
00405 extern CONST unsigned sqlora8_minor_version;
00406 extern CONST unsigned sqlora8_micro_version;
00407 extern CONST unsigned sqlora8_interface_age;
00408 extern CONST unsigned sqlora8_binary_age;
00409
00410 #define SQLORA8_MAJOR_VERSION LIBSQLORA8_MAJOR_VERSION
00411 #define SQLORA8_MINOR_VERSION LIBSQLORA8_MINOR_VERSION
00412 #define SQLORA8_MICRO_VERSION LIBSQLORA8_MICRO_VERSION
00413
00414
00415
00416
00417
00418
00419
00426 #define SQLORA8_CHECK_VERSION(major,minor,micro) \
00427 (LIBSQLORA8_MAJOR_VERSION > (major) || \
00428 (LIBSQLORA8_MAJOR_VERSION == (major) && LIBSQLORA8_MINOR_VERSION > (minor)) || \
00429 (LIBSQLORA8_MAJOR_VERSION == (major) && LIBSQLORA8_MINOR_VERSION == (minor) && \
00430 LIBSQLORA8_MICRO_VERSION >= (micro)))
00431
00432
00433
00434
00435
00436
00437 __BEGIN_DECLS
00438
00465 int sqlo_init __P((int threaded_mode, unsigned int max_db, unsigned int max_cursors));
00466
00467
00468
00483 int sqlo_version __P((CONST char * version_str));
00484
00503 CONST char * sqlo_geterror __P(( sqlo_db_handle_t dbh ));
00504
00505
00506
00514 int sqlo_geterrcode __P(( sqlo_db_handle_t dbh ));
00515
00548 int sqlo_exists __P(( sqlo_db_handle_t dbh,
00549 CONST char * table,
00550 CONST char * colname,
00551 CONST char * colval,
00552 CONST char * where ));
00553
00554
00555
00575 int sqlo_count __P((sqlo_db_handle_t dbh,
00576 CONST char * table,
00577 CONST char * colname,
00578 CONST char * colval,
00579 CONST char * where ));
00580
00581
00582
00603 int sqlo_run __P(( sqlo_db_handle_t dbh, CONST char * stmt, int argc, CONST char ** argv));
00604
00605
00606
00633 sqlo_stmt_handle_t sqlo_open __P((sqlo_db_handle_t dbh,
00634 CONST char * stmt,
00635 int argc,
00636 CONST char ** argv));
00637
00638
00639
00673 int sqlo_open2 __P((sqlo_stmt_handle_t * sthp,
00674 sqlo_db_handle_t dbh,
00675 CONST char * stmt,
00676 int argc,
00677 CONST char ** argv));
00678
00679
00680
00702 int sqlo_reopen __P((sqlo_stmt_handle_t sth,
00703 int argc,
00704 CONST char ** argv));
00705
00706
00707
00736 int sqlo_fetch __P((sqlo_stmt_handle_t sth, unsigned int nrows));
00737
00738
00739
00758 CONST char **sqlo_values __P(( sqlo_stmt_handle_t sth, int * num, int dostrip ));
00759
00760
00761
00776 CONST unsigned short * sqlo_value_lens __P(( sqlo_stmt_handle_t sth, int * num));
00777
00778
00779
00796 CONST char **sqlo_ocol_names __P(( sqlo_stmt_handle_t sth, int * num));
00797
00798
00799
00814 int sqlo_ocol_names2 __P(( sqlo_stmt_handle_t sth, int * num, const char *** ocol_names));
00815
00816
00817
00832 CONST int *sqlo_ocol_name_lens __P(( sqlo_stmt_handle_t sth, int * num));
00833
00834
00835
00848 int sqlo_ncols __P((sqlo_stmt_handle_t sth, int in));
00849
00850
00869 int
00870 sqlo_query_result __P(( sqlo_stmt_handle_t sth,
00871 unsigned int * ncols,
00872 char *** values,
00873 unsigned short ** value_lens,
00874 char *** colnames,
00875 unsigned int ** colname_lens
00876 ));
00877
00885 CONST char *sqlo_command __P(( sqlo_stmt_handle_t sth ));
00886
00887
00888
00902 int sqlo_close __P(( sqlo_stmt_handle_t sth ));
00903
00904
00905
00922 int sqlo_exec __P(( sqlo_db_handle_t dbh, CONST char * stmt ));
00923
00924
00925
00938 int sqlo_isopen __P((sqlo_stmt_handle_t sth));
00939
00940
00941
00954 int sqlo_prows __P(( sqlo_stmt_handle_t sth ));
00955
00984 int sqlo_connect __P(( sqlo_db_handle_t * dbhp, CONST char * cstr ));
00985
00986
00987
01003 int sqlo_finish __P((sqlo_db_handle_t dbh ));
01004
01005
01006
01026 int sqlo_split_cstring __P((CONST char * cstr,
01027 char * uid,
01028 char * pwd,
01029 char * tnsname,
01030 unsigned int bufsize));
01031
01032
01033
01053 int sqlo_server_attach __P((sqlo_db_handle_t * dbhp, CONST char * tnsname));
01054
01055
01056
01077 int sqlo_session_begin __P((sqlo_db_handle_t dbh, CONST char * username, CONST char * password));
01078
01079
01080
01097 int sqlo_server_detach __P((sqlo_db_handle_t dbh));
01098
01099
01100
01120 int sqlo_server_free __P((sqlo_db_handle_t dbh));
01121
01122
01123
01143 int sqlo_session_end __P((sqlo_db_handle_t dbh));
01144
01145
01146
01159 CONST char * sqlo_getdatabase __P((sqlo_db_handle_t dbh ));
01160
01185 int sqlo_commit __P((sqlo_db_handle_t dbh));
01186
01187
01188
01202 int sqlo_rollback __P((sqlo_db_handle_t dbh));
01203
01204
01226 int sqlo_set_autocommit __P((sqlo_db_handle_t dbh, int on));
01227
01228
01239 #define sqlo_autocommit_on(_dbh) sqlo_set_autocommit(_dbh, SQLO_ON)
01240
01241
01252 #define sqlo_autocommit_off(_dbh) sqlo_set_autocommit(_dbh, SQLO_OFF)
01253
01254
01255
01272 int sqlo_autocommit __P((sqlo_db_handle_t dbh));
01273
01309 int sqlo_prepare __P((sqlo_db_handle_t dbh, CONST char * stmt));
01310
01311
01312
01340 int sqlo_bind_by_name __P((sqlo_stmt_handle_t sth,
01341 CONST char * name,
01342 int param_type,
01343 CONST void * param_addr,
01344 unsigned int param_size,
01345 short * ind_addr,
01346 int is_array));
01347
01348
01349
01369 int sqlo_bind_ref_cursor __P((sqlo_stmt_handle_t sth, CONST char * cursor_name, int * sth2p));
01370
01371
01372
01398 int sqlo_bind_by_pos __P((sqlo_stmt_handle_t sth,
01399 int position,
01400 int param_type,
01401 CONST void * param_addr,
01402 unsigned int param_size,
01403 short * ind_addr,
01404 int is_array));
01405
01406
01407
01434 int sqlo_bind_by_pos2 __P((sqlo_stmt_handle_t sth,
01435 int position,
01436 int param_type,
01437 CONST void * param_addr,
01438 unsigned int param_size,
01439 short * ind_addr,
01440 unsigned short * rcode_addr,
01441 unsigned int skip_size));
01442
01443
01444
01479 int sqlo_define_by_pos __P((sqlo_stmt_handle_t sth,
01480 int value_pos,
01481 int value_type,
01482 CONST void * value_addr,
01483 unsigned int value_size,
01484 short * ind_addr,
01485 short * rlen_addr,
01486 int is_array));
01487
01488
01489
01524 int sqlo_define_by_pos2 __P((sqlo_stmt_handle_t sth,
01525 int value_pos,
01526 int value_type,
01527 CONST void * value_addr,
01528 unsigned int value_size,
01529 short * ind_addr,
01530 unsigned short * rlen_addr,
01531 unsigned short * rcode_addr,
01532 unsigned int skip_size));
01533
01534
01535
01549 int sqlo_define_ntable __P((sqlo_stmt_handle_t sth, unsigned int pos, int * sth2p));
01550
01551
01552
01575 int sqlo_execute __P((sqlo_stmt_handle_t sth, unsigned int iterations));
01576
01598 int sqlo_alloc_lob_desc __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t *loblpp));
01599
01600
01601
01616 int sqlo_free_lob_desc __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t *loblpp));
01617
01618
01619
01646 int sqlo_lob_write_buffer __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int loblen,
01647 void *bufp, unsigned int bufl, unsigned int piece));
01648
01649
01650
01676 int sqlo_lob_append_buffer __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp,
01677 unsigned int loblen,
01678 void *bufp, unsigned int bufl,
01679 unsigned int piece));
01680
01681
01682
01705 int sqlo_lob_write_stream __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int filelen, FILE * fp));
01706
01707
01708
01722 int sqlo_lob_get_length __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int * loblenp));
01723
01724
01725
01750 int sqlo_lob_read_buffer __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int loblen, void *bufp, unsigned int bufl));
01751
01752
01753
01776 int sqlo_lob_read_stream __P((sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int loblen,
01777 FILE *fp));
01806 int sqlo_get_oci_handle __P((int sqloh, void * ocihp, sqlo_oci_handle_types_e type));
01807
01808
01809
01819 int sqlo_get_db_handle __P((sqlo_stmt_handle_t sth));
01820
01821
01822
01849 int sqlo_set_blocking __P((sqlo_db_handle_t dbh, unsigned int on));
01850
01851
01852
01864 int sqlo_get_blocking __P((sqlo_db_handle_t dbh, unsigned int * blocking));
01865
01866
01867
01888 int sqlo_break __P((sqlo_db_handle_t dbh));
01889
01890
01891
01903 int sqlo_set_prefetch_rows __P((sqlo_stmt_handle_t sth, unsigned int nrows));
01904
01905
01906
01923 int sqlo_server_version __P((sqlo_db_handle_t dbh, char *bufp, unsigned int buflen));
01924
01925
01926
01934 int sqlo_get_stmt_state __P((sqlo_stmt_handle_t sth));
01935
01936
01937
01944 CONST char * sqlo_get_stmt __P((sqlo_stmt_handle_t sth));
01945
01946
01947
01959 int sqlo_get_ocol_dtype __P((sqlo_stmt_handle_t sth, unsigned int pos));
01960
01961
01962
01976 int sqlo_trace __P((sqlo_db_handle_t dbh, int on ));
01977
01978
01979
01992 int sqlo_print __P(( sqlo_stmt_handle_t sth ));
01993
01994
01995
02007 int sqlo_register_int_handler __P((int * handle, sqlo_signal_handler_t signal_handler));
02008
02009
02010
02017 int sqlo_clear_int_handler __P((int handle));
02018
02019
02020
02021
02026
02027
02028
02029
02030 #ifndef DOXYGEN_SHOULD_SKIP_THIS
02031
02032 int sql_init __P(( void ));
02033
02034 int sql_trace __P(( int on ));
02035
02036 CONST char * sql_geterror __P(( void ));
02037
02038 int sql_geterrcode __P(( void ));
02039
02040 int sql_exists __P((CONST char * table, CONST char * field,
02041 CONST char * value, CONST char * where ));
02042 int sql_run __P((CONST char * stmt, int argc, CONST char ** argv));
02043
02044 int sql_open __P((CONST char * stmt, int argc,
02045 CONST char ** argv));
02046
02047 int sql_reopen __P((int sth, int argc, CONST char ** argv));
02048
02049 int sql_fetch __P((int sth ));
02050
02051 CONST char **sql_values __P(( int sth, int * num, int dostrip ));
02052
02053 CONST char *sql_command __P(( int sth ));
02054
02055 int sql_close __P(( int sth ));
02056
02057 int sql_print __P(( int sth ));
02058
02059 int sql_finish __P((void));
02060
02061 CONST char * sql_getdatabase __P(( void ));
02062
02063 CONST char ** sql_cnam __P(( int sth, int in, int * num ));
02064
02065 CONST char ** sql_sclen __P(( int sth, int in, int * num ));
02066
02067 int sql_prows __P(( int sth ));
02068
02069 int sql_connect __P(( CONST char * connect_str ));
02070
02071 int sql_commit __P(( void ));
02072
02073 int sql_rollback __P(( void ));
02074
02075 int sql_count __P((CONST char * table,
02076 CONST char * field,
02077 CONST char * value,
02078 CONST char * where ));
02079
02080 int sql_exec __P(( CONST char * stmt ));
02081
02082 int sql_setparam __P(( int argc , CONST char ** argv));
02083
02084 char CONST ** sql_getparam __P(( int namec, CONST char ** name, int *numvalues ));
02085 int sql_isopen __P((int sth));
02086
02087 int sql_prepare __P((CONST char * stmt));
02088
02089 int sql_bind_by_name __P((int sth, CONST char * name, int param_type,
02090 CONST void * param_addr, unsigned int param_size,
02091 short * ind_addr, int is_array));
02092
02093 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));
02094
02095 int sql_define_by_pos __P((int sth, int value_pos, int value_type,
02096 CONST void * value_addr,
02097 unsigned int value_size,
02098 short * ind_addr,
02099 short * rlen_addr,
02100 int is_array));
02101
02102 int sql_execute __P((int sth, int iterations));
02103
02104 char CONST **sql_ocol_names __P((int sth, int * num));
02105
02106 int CONST *sql_ocol_name_lens __P((int sth, int * num));
02107
02108 unsigned short CONST * sql_value_lens __P((int sth, int * num));
02109
02110 int sql_ncols __P((int sth, int in));
02111
02112 int sql_getdbh __P((void));
02113
02114 #define SQLO_DEFDBH (sql_getdbh())
02115 #endif
02116
02117 __END_DECLS
02118
02119
02120 #endif
02121