Main Page | Modules | File List | Globals | Related Pages | Examples

sqlora.h File Reference

libsqlora8 - Easy C API to Oracle using OCI. More...

Go to the source code of this file.

Defines

#define SQLORA8_CHECK_VERSION(major, minor, micro)
 A macro used during compile time to check the version This macro is used during the configure process of your program to check for the right version.
#define sqlo_autocommit_on(_dbh)   sqlo_set_autocommit(_dbh, SQLO_ON)
 A macro used to set autocommit on.
#define sqlo_autocommit_off(_dbh)   sqlo_set_autocommit(_dbh, SQLO_OFF)
 A macro used to set autocommit off.

Typedefs

typedef int sqlo_db_handle_t
 A database handle type.
typedef int sqlo_stmt_handle_t
 A statement handle type.
typedef void * sqlo_lob_desc_t
 LOB descriptor type Hides the Oracle type OCILobLocator*.
typedef void(* sqlo_signal_handler_t )(void)
 The type of the signal handler function.

Enumerations

enum  sqlo_status_codes {
  SQLO_SUCCESS = 0, SQLO_ERROR = -1,
  SQLO_INVALID_HANDLE = -2, SQLO_STILL_EXECUTING = -3123,
  SQLO_CONTINUE = -24200, SQLO_SUCCESS_WITH_INFO = 1,
  SQLO_NEED_DATA = 99, SQLO_NO_DATA = 100
}
 Constants defining the return codes of the functions. More...
enum  sqlo_error_codes {
  SQLO_ERROR_BASE = -30000, SQLO_INVALID_DB_HANDLE = (SQLO_ERROR_BASE - 1),
  SQLO_ERRMALLOC = (SQLO_ERROR_BASE - 2), SQLO_INVALID_STMT_HANDLE = (SQLO_ERROR_BASE - 3),
  SQLO_STMT_NOT_OPENED = (SQLO_ERROR_BASE - 4), SQLO_INVALID_STMT_TYPE = (SQLO_ERROR_BASE - 5),
  SQLO_STMT_NOT_PARSED = (SQLO_ERROR_BASE - 6), SQLO_INVALID_OCI_HANDLE_TYPE = (SQLO_ERROR_BASE - 7),
  SQLO_MALFORMED_VERSION_STR = (SQLO_ERROR_BASE - 8), SQLO_WRONG_VERSION = (SQLO_ERROR_BASE - 9),
  SQLO_INVALID_COLPOS = (SQLO_ERROR_BASE - 10), SQLO_INVALID_SQL = (SQLO_ERROR_BASE -11),
  SQLO_UNSUPPORTED_DATA_TYPE = (SQLO_ERROR_BASE - 12)
}
 Constants defining error codes returned by the library. More...
enum  sqlo_constants {
  SQLO_OFF = 0, SQLO_ON = 1,
  SQLO_NULL_IND = -1, SQLO_NOT_NULL_IND = 0,
  SQLO_STH_INIT = -1, SQLO_ONE_PIECE = 0,
  SQLO_FIRST_PIECE = 1, SQLO_NEXT_PIECE = 2,
  SQLO_LAST_PIECE = 3
}
 Some constants used to pass to the functions. More...
enum  sqlo_data_types {
  SQLOT_CHR = 1, SQLOT_NUM = 2,
  SQLOT_INT = 3, SQLOT_FLT = 4,
  SQLOT_STR = 5, SQLOT_VNU = 6,
  SQLOT_PDN = 7, SQLOT_LNG = 8,
  SQLOT_VCS = 9, SQLOT_NON = 10,
  SQLOT_RID = 11, SQLOT_DAT = 12,
  SQLOT_VBI = 15, SQLOT_BIN = 23,
  SQLOT_LBI = 24, SQLOT_UIN = 68,
  SQLOT_SLS = 91, SQLOT_LVC = 94,
  SQLOT_LVB = 95, SQLOT_AFC = 96,
  SQLOT_AVC = 97, SQLOT_CUR = 102,
  SQLOT_RDD = 104, SQLOT_LAB = 105,
  SQLOT_OSL = 106, SQLOT_NTY = 108,
  SQLOT_REF = 110, SQLOT_CLOB = 112,
  SQLOT_BLOB = 113, SQLOT_BFILEE = 114,
  SQLOT_CFILEE = 115, SQLOT_RSET = 116,
  SQLOT_NCO = 122, SQLOT_VST = 155,
  SQLOT_ODT = 156, SQLOT_DATE = 184,
  SQLOT_TIME = 185, SQLOT_TIME_TZ = 186,
  SQLOT_TIMESTAMP = 187, SQLOT_TIMESTAMP_TZ = 188,
  SQLOT_INTERVAL_YM = 189, SQLOT_INTERVAL_DS = 190,
  SQLOT_TIMESTAMP_LTZ = 232
}
 The data types for bind variables The oracle constants are copied from $ORACLE_HOME/rdbms/demo/ocidfn.h. More...
enum  sqlo_statement_states {
  SQLO_STMT_STATE_INITIALIZED = 1, SQLO_STMT_STATE_EXECUTED = 2,
  SQLO_STMT_STATE_END_OF_FETCH = 3
}
 Possible statement states returned by sqlo_get_stmt_state. More...
enum  sqlo_oci_handle_types_e {
  SQLO_OCI_HTYPE_ENV = 1, SQLO_OCI_HTYPE_ERROR = 2,
  SQLO_OCI_HTYPE_SVCCTX = 3, SQLO_OCI_HTYPE_SERVER = 4,
  SQLO_OCI_HTYPE_SESSION = 5, SQLO_OCI_HTYPE_STMT = 6
}
 Oracle OCI Handle types used by sqlo_get_oci_handle. More...

Functions

int sqlo_init (int threaded_mode, unsigned int max_db, unsigned int max_cursors)
 Init the library.
int sqlo_version (const char *version_str)
 Checks if the version is sufficient.
const char * sqlo_geterror (sqlo_db_handle_t dbh)
 Return last error string.
int sqlo_geterrcode (sqlo_db_handle_t dbh)
 Return the last error code.
int sqlo_exists (sqlo_db_handle_t dbh, const char *table, const char *colname, const char *colval, const char *where)
 Tests if a value exists in a table.
int sqlo_count (sqlo_db_handle_t dbh, const char *table, const char *colname, const char *colval, const char *where)
 Counts the number of items in the table.
int sqlo_run (sqlo_db_handle_t dbh, const char *stmt, int argc, const char **argv)
 Run a simple sql statements with parameters.
sqlo_stmt_handle_t sqlo_open (sqlo_db_handle_t dbh, const char *stmt, int argc, const char **argv)
 Open a new cursor.
int sqlo_open2 (sqlo_stmt_handle_t *sthp, sqlo_db_handle_t dbh, const char *stmt, int argc, const char **argv)
 Open a new cursor.
int sqlo_reopen (sqlo_stmt_handle_t sth, int argc, const char **argv)
 Reopens a already used cursor.
int sqlo_fetch (sqlo_stmt_handle_t sth, unsigned int nrows)
 Fetches the data from an open cursor.
const char ** sqlo_values (sqlo_stmt_handle_t sth, int *num, int dostrip)
 Get one dataset.
const unsigned short * sqlo_value_lens (sqlo_stmt_handle_t sth, int *num)
 Get the length of the returned values.
const char ** sqlo_ocol_names (sqlo_stmt_handle_t sth, int *num)
 Get the select list columns.
int sqlo_ocol_names2 (sqlo_stmt_handle_t sth, int *num, const char ***ocol_names)
 Get the select list columns.
const int * sqlo_ocol_name_lens (sqlo_stmt_handle_t sth, int *num)
 Get the select list columns name lengths.
int sqlo_ncols (sqlo_stmt_handle_t sth, int in)
 Get the number of bind/select-list variables.
int sqlo_query_result (sqlo_stmt_handle_t sth, unsigned int *ncols, char ***values, unsigned short **value_lens, char ***colnames, unsigned int **colname_lens)
 Fetch the next row from the resultset and return the columns.
const char * sqlo_command (sqlo_stmt_handle_t sth)
 Return the sql command.
int sqlo_close (sqlo_stmt_handle_t sth)
 Close the cursor.
int sqlo_exec (sqlo_db_handle_t dbh, const char *stmt)
 Execute a simple sql statement.
int sqlo_isopen (sqlo_stmt_handle_t sth)
 Test if a cursor is open.
int sqlo_prows (sqlo_stmt_handle_t sth)
 Return the number of processed rows by this statement.
int sqlo_connect (sqlo_db_handle_t *dbhp, const char *cstr)
 Connect to a database.
int sqlo_finish (sqlo_db_handle_t dbh)
 Finish the session.
int sqlo_split_cstring (const char *cstr, char *uid, char *pwd, char *tnsname, unsigned int bufsize)
 Split an Oracle connect string.
int sqlo_server_attach (sqlo_db_handle_t *dbhp, const char *tnsname)
 Attach to a database server.
int sqlo_session_begin (sqlo_db_handle_t dbh, const char *username, const char *password)
 Begin a session.
int sqlo_server_detach (sqlo_db_handle_t dbh)
 Detach from server.
int sqlo_server_free (sqlo_db_handle_t dbh)
 Free a server connection This is your emergency exit when a connection to a database gets lost (end of file on communication channel).
int sqlo_session_end (sqlo_db_handle_t dbh)
 End a session.
const char * sqlo_getdatabase (sqlo_db_handle_t dbh)
 Returns the tnsname.
int sqlo_commit (sqlo_db_handle_t dbh)
 Commit.
int sqlo_rollback (sqlo_db_handle_t dbh)
 Rollback.
int sqlo_set_autocommit (sqlo_db_handle_t dbh, int on)
 sqlo_set_autocommit
int sqlo_autocommit (sqlo_db_handle_t dbh)
 sqlo_autocommit
int sqlo_prepare (sqlo_db_handle_t dbh, const char *stmt)
 Parse a statement.
int sqlo_bind_by_name (sqlo_stmt_handle_t sth, const char *name, int param_type, const void *param_addr, unsigned int param_size, short *ind_addr, int is_array)
 Bind a variable by name.
int sqlo_bind_ref_cursor (sqlo_stmt_handle_t sth, const char *cursor_name, int *sth2p)
 Bind a REF CURSOR.
int sqlo_bind_by_pos (sqlo_stmt_handle_t sth, int position, int param_type, const void *param_addr, unsigned int param_size, short *ind_addr, int is_array)
 Bind a variable by position.
int sqlo_bind_by_pos2 (sqlo_stmt_handle_t sth, int position, int param_type, const void *param_addr, unsigned int param_size, short *ind_addr, unsigned short *rcode_addr, unsigned int skip_size)
 Bind a variable by position.
int sqlo_define_by_pos (sqlo_stmt_handle_t sth, int value_pos, int value_type, const void *value_addr, unsigned int value_size, short *ind_addr, short *rlen_addr, int is_array)
 Define a output variable of the select list.
int sqlo_define_by_pos2 (sqlo_stmt_handle_t sth, int value_pos, int value_type, const void *value_addr, unsigned int value_size, short *ind_addr, unsigned short *rlen_addr, unsigned short *rcode_addr, unsigned int skip_size)
 Define a output variable of the select list.
int sqlo_define_ntable (sqlo_stmt_handle_t sth, unsigned int pos, int *sth2p)
 Define a nested table Please visit the example for details.
int sqlo_execute (sqlo_stmt_handle_t sth, unsigned int iterations)
 Execute a statement.
int sqlo_alloc_lob_desc (sqlo_db_handle_t dbh, sqlo_lob_desc_t *loblpp)
 Allocate a lob descriptor.
int sqlo_free_lob_desc (sqlo_db_handle_t dbh, sqlo_lob_desc_t *loblpp)
 Free a lob descriptor.
int sqlo_lob_write_buffer (sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int loblen, void *bufp, unsigned int bufl, unsigned int piece)
 Write lob data from buffer into the lob column.
int sqlo_lob_append_buffer (sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int loblen, void *bufp, unsigned int bufl, unsigned int piece)
 Append lob data from buffer to the lob column.
int sqlo_lob_write_stream (sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int filelen, FILE *fp)
 Write lob data from a file into the lob column.
int sqlo_lob_get_length (sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int *loblenp)
 Get the length of a lob.
int sqlo_lob_read_buffer (sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int loblen, void *bufp, unsigned int bufl)
 Read lob data from lob column into a buffer.
int sqlo_lob_read_stream (sqlo_db_handle_t dbh, sqlo_lob_desc_t loblp, unsigned int loblen, FILE *fp)
 Read lob data from lob column into a stream.
int sqlo_get_oci_handle (int sqloh, void *ocihp, sqlo_oci_handle_types_e type)
 Get the specified OCI handle.
int sqlo_get_db_handle (sqlo_stmt_handle_t sth)
 Return the database handle of a statement handle.
int sqlo_set_blocking (sqlo_db_handle_t dbh, unsigned int on)
 Set OCI blocking mode on/off.
int sqlo_get_blocking (sqlo_db_handle_t dbh, unsigned int *blocking)
 Get OCI blocking mode.
int sqlo_break (sqlo_db_handle_t dbh)
 Abort all operations in non-blocking mode.
int sqlo_set_prefetch_rows (sqlo_stmt_handle_t sth, unsigned int nrows)
 Set the prefetch row attribute for a statement.
int sqlo_server_version (sqlo_db_handle_t dbh, char *bufp, unsigned int buflen)
 Get the server version string.
int sqlo_get_stmt_state (sqlo_stmt_handle_t sth)
 Get the state of the statement.
const char * sqlo_get_stmt (sqlo_stmt_handle_t sth)
 Get the sql statement text for the statement handle.
int sqlo_get_ocol_dtype (sqlo_stmt_handle_t sth, unsigned int pos)
 Get the datatype of a column in the select list.
int sqlo_trace (sqlo_db_handle_t dbh, int on)
 Switches Oracle trace on/off.
int sqlo_print (sqlo_stmt_handle_t sth)
 Print info about the statement to stdout.
int sqlo_register_int_handler (int *handle, sqlo_signal_handler_t signal_handler)
 Register a signal handler for interrupts.
int sqlo_clear_int_handler (int handle)
 Clear an interrupt handler.

Variables

const unsigned sqlo_major_version
 The major version of the library.
const unsigned sqlo_minor_version
 The minor version of the library.
const unsigned sqlo_micro_version
 The micro version of the library.
const unsigned sqlo_interface_age
 The interface age used by libtool.
const unsigned sqlo_binary_age
 The binary age used by libtool.


Detailed Description

libsqlora8 - Easy C API to Oracle using OCI.

Version:
2.3
Author:
Kai Poitschke
Copyright (c) 1991-2004 Kai Poitschke (kai[_at_]poitschke.de)

This file is part of the libsqlora8 package which can be found at http://www.poitschke.de/libsqlora8/

Definition in file sqlora.h.


Define Documentation

#define SQLORA8_CHECK_VERSION major,
minor,
micro   ) 
 

Value:

(LIBSQLORA8_MAJOR_VERSION > (major) || \ (LIBSQLORA8_MAJOR_VERSION == (major) && LIBSQLORA8_MINOR_VERSION > (minor)) || \ (LIBSQLORA8_MAJOR_VERSION == (major) && LIBSQLORA8_MINOR_VERSION == (minor) && \ LIBSQLORA8_MICRO_VERSION >= (micro)))
A macro used during compile time to check the version This macro is used during the configure process of your program to check for the right version.

Used in libsqlora8.m4 Definition at line 426 of file sqlora.h.


Generated on Sat Feb 26 16:02:43 2005 for libsqlora8 by doxygen 1.3.8