dbd.h | dbd.h | |||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
* | * | |||
* This library is distributed in the hope that it will be useful, | * This library is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | * Lesser General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | |||
* | * | |||
* $Id: dbd.h,v 1.20 2003/06/21 21:36:19 dap24 Exp $ | * $Id: dbd.h,v 1.29 2005/08/15 19:18:18 mhoenicka Exp $ | |||
*/ | */ | |||
#ifndef __DBD_H__ | #ifndef __DBD_H__ | |||
#define __DBD_H__ | #define __DBD_H__ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#include <dbi/dbi.h> | #include <dbi/dbi.h> | |||
#include <dbi/dbi-dev.h> | #include <dbi/dbi-dev.h> | |||
/* FUNCTIONS EXPORTED BY EACH DRIVER */ | /* FUNCTIONS EXPORTED BY EACH DRIVER */ | |||
void dbd_register_driver(const dbi_info_t **_driver_info, const char ***_cu stom_functions, const char ***_reserved_words); | void dbd_register_driver(const dbi_info_t **_driver_info, const char ***_cu stom_functions, const char ***_reserved_words); | |||
int dbd_initialize(dbi_driver_t *driver); | int dbd_initialize(dbi_driver_t *driver); | |||
int dbd_connect(dbi_conn_t *conn); | int dbd_connect(dbi_conn_t *conn); | |||
int dbd_disconnect(dbi_conn_t *conn); | int dbd_disconnect(dbi_conn_t *conn); | |||
int dbd_fetch_row(dbi_result_t *result, unsigned long long rownum); | int dbd_fetch_row(dbi_result_t *result, unsigned long long rowidx); | |||
int dbd_free_query(dbi_result_t *result); | int dbd_free_query(dbi_result_t *result); | |||
int dbd_goto_row(dbi_result_t *result, unsigned long long row); | int dbd_goto_row(dbi_result_t *result, unsigned long long rowidx); | |||
int dbd_get_socket(dbi_conn_t *conn); | ||||
const char *dbd_get_encoding(dbi_conn_t *conn); | ||||
const char* dbd_encoding_from_iana(const char *iana_encoding); | ||||
const char* dbd_encoding_to_iana(const char *iana_encoding); | ||||
char *dbd_get_engine_version(dbi_conn_t *conn, char *versionstring); | ||||
dbi_result_t *dbd_list_dbs(dbi_conn_t *conn, const char *pattern); | dbi_result_t *dbd_list_dbs(dbi_conn_t *conn, const char *pattern); | |||
dbi_result_t *dbd_list_tables(dbi_conn_t *conn, const char *db, const char *pattern); | dbi_result_t *dbd_list_tables(dbi_conn_t *conn, const char *db, const char *pattern); | |||
dbi_result_t *dbd_query(dbi_conn_t *conn, const char *statement); | dbi_result_t *dbd_query(dbi_conn_t *conn, const char *statement); | |||
dbi_result_t *dbd_query_null(dbi_conn_t *conn, const unsigned char *stateme | dbi_result_t *dbd_query_null(dbi_conn_t *conn, const unsigned char *stateme | |||
nt, unsigned long st_length); | nt, size_t st_length); | |||
int dbd_quote_string(dbi_driver_t *driver, const char *orig, char *dest); | size_t dbd_quote_string(dbi_driver_t *driver, const char *orig, char *dest) | |||
char *dbd_select_db(dbi_conn_t *conn, const char *db); | ; | |||
size_t dbd_quote_binary(dbi_conn_t *conn, const unsigned char *orig, size_t | ||||
from_length, unsigned char **ptr_dest); | ||||
size_t dbd_conn_quote_string(dbi_conn_t *conn, const char *orig, char *dest | ||||
); | ||||
const char *dbd_select_db(dbi_conn_t *conn, const char *db); | ||||
int dbd_geterror(dbi_conn_t *conn, int *errno, char **errstr); | int dbd_geterror(dbi_conn_t *conn, int *errno, char **errstr); | |||
unsigned long long dbd_get_seq_last(dbi_conn_t *conn, const char *sequence) ; | unsigned long long dbd_get_seq_last(dbi_conn_t *conn, const char *sequence) ; | |||
unsigned long long dbd_get_seq_next(dbi_conn_t *conn, const char *sequence) ; | unsigned long long dbd_get_seq_next(dbi_conn_t *conn, const char *sequence) ; | |||
int dbd_ping(dbi_conn_t *conn); | int dbd_ping(dbi_conn_t *conn); | |||
/* _DBD_* DRIVER AUTHORS HELPER FUNCTIONS */ | /* _DBD_* DRIVER AUTHORS HELPER FUNCTIONS */ | |||
dbi_result_t *_dbd_result_create(dbi_conn_t *conn, void *handle, unsigned l ong long numrows_matched, unsigned long long numrows_affected); | dbi_result_t *_dbd_result_create(dbi_conn_t *conn, void *handle, unsigned l ong long numrows_matched, unsigned long long numrows_affected); | |||
void _dbd_result_set_numfields(dbi_result_t *result, unsigned short numfiel | void _dbd_result_set_numfields(dbi_result_t *result, unsigned int numfields | |||
ds); | ); | |||
void _dbd_result_add_field(dbi_result_t *result, unsigned short idx, char * | void _dbd_result_add_field(dbi_result_t *result, unsigned int fieldidx, cha | |||
name, unsigned short type, unsigned int attribs); | r *name, unsigned short type, unsigned int attribs); | |||
dbi_row_t *_dbd_row_allocate(unsigned short numfields); | dbi_row_t *_dbd_row_allocate(unsigned int numfields); | |||
void _dbd_row_finalize(dbi_result_t *result, dbi_row_t *row, unsigned long | void _dbd_row_finalize(dbi_result_t *result, dbi_row_t *row, unsigned long | |||
long idx); | long rowidx); | |||
void _dbd_internal_error_handler(dbi_conn_t *conn, const char *errmsg, cons t int errno); | void _dbd_internal_error_handler(dbi_conn_t *conn, const char *errmsg, cons t int errno); | |||
dbi_result_t *_dbd_result_create_from_stringarray(dbi_conn_t *conn, unsigne d long long numrows_matched, const char **stringarray); | dbi_result_t *_dbd_result_create_from_stringarray(dbi_conn_t *conn, unsigne d long long numrows_matched, const char **stringarray); | |||
void _dbd_register_driver_cap(dbi_driver_t *driver, const char *capname, in t value); | void _dbd_register_driver_cap(dbi_driver_t *driver, const char *capname, in t value); | |||
void _dbd_register_conn_cap(dbi_conn_t *conn, const char *capname, int valu e); | void _dbd_register_conn_cap(dbi_conn_t *conn, const char *capname, int valu e); | |||
int _dbd_result_add_to_conn(dbi_result_t *result); | int _dbd_result_add_to_conn(dbi_result_t *result); | |||
time_t _dbd_parse_datetime(const char *raw, unsigned long attribs); | time_t _dbd_parse_datetime(const char *raw, unsigned int attribs); | |||
size_t _dbd_escape_chars(char *dest, const char *orig, size_t orig_size, co | ||||
nst char *toescape); | ||||
size_t _dbd_encode_binary(const unsigned char *in, size_t n, unsigned char | ||||
*out); | ||||
size_t _dbd_decode_binary(const unsigned char *in, unsigned char *out); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif /* __cplusplus */ | #endif /* __cplusplus */ | |||
#endif /* __DBD_H__ */ | #endif /* __DBD_H__ */ | |||
End of changes. 6 change blocks. | ||||
15 lines changed or deleted | 30 lines changed or added | |||
dbi-dev.h | dbi-dev.h | |||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
* | * | |||
* This library is distributed in the hope that it will be useful, | * This library is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | * Lesser General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | |||
* | * | |||
* $Id: dbi-dev.h,v 1.29 2004/01/03 17:21:25 mhoenicka Exp $ | * $Id: dbi-dev.h,v 1.39 2005/08/14 21:02:05 mhoenicka Exp $ | |||
*/ | */ | |||
#ifndef __DBI_DEV_H__ | #ifndef __DBI_DEV_H__ | |||
#define __DBI_DEV_H__ | #define __DBI_DEV_H__ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#include <dbi/dbi.h> /* for dbi_conn_error_handler_func */ | #include <dbi/dbi.h> /* for dbi_conn_error_handler_func */ | |||
skipping to change at line 44 | skipping to change at line 44 | |||
*********************/ | *********************/ | |||
/* to fool the compiler into letting us use the following structs before th ey're actually defined: */ | /* to fool the compiler into letting us use the following structs before th ey're actually defined: */ | |||
typedef struct dbi_driver_s *dbi_driver_t_pointer; | typedef struct dbi_driver_s *dbi_driver_t_pointer; | |||
typedef struct dbi_conn_s *dbi_conn_t_pointer; | typedef struct dbi_conn_s *dbi_conn_t_pointer; | |||
typedef struct _field_binding_s *_field_binding_t_pointer; | typedef struct _field_binding_s *_field_binding_t_pointer; | |||
typedef union dbi_data_u { | typedef union dbi_data_u { | |||
char d_char; | char d_char; | |||
short d_short; | short d_short; | |||
long d_long; | int d_long; /* misnomer */ | |||
long long d_longlong; | long long d_longlong; | |||
float d_float; | float d_float; | |||
double d_double; | double d_double; | |||
char *d_string; | char *d_string; | |||
time_t d_datetime; | time_t d_datetime; | |||
} dbi_data_t; | } dbi_data_t; | |||
typedef struct dbi_row_s { | typedef struct dbi_row_s { | |||
dbi_data_t *field_values; | dbi_data_t *field_values; | |||
unsigned long long *field_sizes; /* NULL field = 0, string field = l | size_t *field_sizes; /* strlen() for strings, 0 otherwise */ | |||
en, anything else = -1 */ | unsigned char *field_flags; /* field-specific metadata for this part | |||
/* | icular row */ | |||
XXX TODO: above is false as of 8/6/02. no -1 */ | ||||
} dbi_row_t; | } dbi_row_t; | |||
typedef struct dbi_result_s { | typedef struct dbi_result_s { | |||
dbi_conn_t_pointer conn; | dbi_conn_t_pointer conn; | |||
void *result_handle; /* will be typecast into conn-specific type */ | void *result_handle; /* will be typecast into conn-specific type */ | |||
unsigned long long numrows_matched; /* set immediately after query * / | unsigned long long numrows_matched; /* set immediately after query * / | |||
unsigned long long numrows_affected; | unsigned long long numrows_affected; | |||
_field_binding_t_pointer field_bindings; | _field_binding_t_pointer field_bindings; | |||
unsigned short numfields; /* can be zero or NULL until first fetchro w */ | unsigned int numfields; /* can be zero or NULL until first fetchrow */ | |||
char **field_names; | char **field_names; | |||
unsigned short *field_types; | unsigned short *field_types; | |||
unsigned long *field_attribs; | unsigned int *field_attribs; | |||
enum { NOTHING_RETURNED, ROWS_RETURNED } result_state; | enum { NOTHING_RETURNED, ROWS_RETURNED } result_state; | |||
dbi_row_t **rows; /* array of filled rows, elements set to NULL if n ot fetched yet */ | dbi_row_t **rows; /* array of filled rows, elements set to NULL if n ot fetched yet */ | |||
unsigned long long currowidx; | unsigned long long currowidx; | |||
} dbi_result_t; | } dbi_result_t; | |||
typedef struct _field_binding_s { | typedef struct _field_binding_s { | |||
void (*helper_function)(_field_binding_t_pointer); | void (*helper_function)(_field_binding_t_pointer); | |||
dbi_result_t *result; | dbi_result_t *result; | |||
const char *fieldname; | const char *fieldname; | |||
skipping to change at line 122 | skipping to change at line 122 | |||
int (*connect)(dbi_conn_t_pointer); | int (*connect)(dbi_conn_t_pointer); | |||
int (*disconnect)(dbi_conn_t_pointer); | int (*disconnect)(dbi_conn_t_pointer); | |||
int (*fetch_row)(dbi_result_t *, unsigned long long); | int (*fetch_row)(dbi_result_t *, unsigned long long); | |||
int (*free_query)(dbi_result_t *); | int (*free_query)(dbi_result_t *); | |||
int (*goto_row)(dbi_result_t *, unsigned long long); | int (*goto_row)(dbi_result_t *, unsigned long long); | |||
int (*get_socket)(dbi_conn_t_pointer); | int (*get_socket)(dbi_conn_t_pointer); | |||
const char *(*get_encoding)(dbi_conn_t_pointer); | const char *(*get_encoding)(dbi_conn_t_pointer); | |||
dbi_result_t *(*list_dbs)(dbi_conn_t_pointer, const char *); | dbi_result_t *(*list_dbs)(dbi_conn_t_pointer, const char *); | |||
dbi_result_t *(*list_tables)(dbi_conn_t_pointer, const char *, const char *); | dbi_result_t *(*list_tables)(dbi_conn_t_pointer, const char *, const char *); | |||
dbi_result_t *(*query)(dbi_conn_t_pointer, const char *); | dbi_result_t *(*query)(dbi_conn_t_pointer, const char *); | |||
dbi_result_t *(*query_null)(dbi_conn_t_pointer, const unsigned char | dbi_result_t *(*query_null)(dbi_conn_t_pointer, const unsigned char | |||
*, unsigned long); | *, size_t); | |||
int (*quote_string)(dbi_driver_t_pointer, const char *, char *); | size_t (*quote_string)(dbi_driver_t_pointer, const char *, char *); | |||
char *(*select_db)(dbi_conn_t_pointer, const char *); | size_t (*conn_quote_string)(dbi_conn_t_pointer, const char *, char * | |||
); | ||||
size_t (*quote_binary)(dbi_conn_t_pointer, const unsigned char *, si | ||||
ze_t, unsigned char **); | ||||
const char *(*encoding_to_iana)(const char *); | ||||
const char *(*encoding_from_iana)(const char *); | ||||
char *(*get_engine_version)(dbi_conn_t_pointer,char *); | ||||
const char *(*select_db)(dbi_conn_t_pointer, const char *); | ||||
int (*geterror)(dbi_conn_t_pointer, int *, char **); | int (*geterror)(dbi_conn_t_pointer, int *, char **); | |||
unsigned long long (*get_seq_last)(dbi_conn_t_pointer, const char *) ; | unsigned long long (*get_seq_last)(dbi_conn_t_pointer, const char *) ; | |||
unsigned long long (*get_seq_next)(dbi_conn_t_pointer, const char *) ; | unsigned long long (*get_seq_next)(dbi_conn_t_pointer, const char *) ; | |||
int (*ping)(dbi_conn_t_pointer); | int (*ping)(dbi_conn_t_pointer); | |||
} dbi_functions_t; | } dbi_functions_t; | |||
typedef struct dbi_custom_function_s { | typedef struct dbi_custom_function_s { | |||
const char *name; | const char *name; | |||
void *function_pointer; | void *function_pointer; | |||
struct dbi_custom_function_s *next; | struct dbi_custom_function_s *next; | |||
skipping to change at line 165 | skipping to change at line 170 | |||
int error_number; /*XXX*/ | int error_number; /*XXX*/ | |||
char *error_message; /*XXX*/ | char *error_message; /*XXX*/ | |||
dbi_conn_error_handler_func error_handler; | dbi_conn_error_handler_func error_handler; | |||
void *error_handler_argument; | void *error_handler_argument; | |||
dbi_result_t **results; /* for garbage-collector-mandated result dis joins */ | dbi_result_t **results; /* for garbage-collector-mandated result dis joins */ | |||
int results_used; | int results_used; | |||
int results_size; | int results_size; | |||
struct dbi_conn_s *next; /* so libdbi can unload all conns at exit * / | struct dbi_conn_s *next; /* so libdbi can unload all conns at exit * / | |||
} dbi_conn_t; | } dbi_conn_t; | |||
unsigned long _isolate_attrib(unsigned long attribs, unsigned long rangemin , unsigned long rangemax); | unsigned int _isolate_attrib(unsigned int attribs, unsigned int rangemin, u nsigned int rangemax); | |||
void _error_handler(dbi_conn_t *conn, dbi_error_flag errflag); | void _error_handler(dbi_conn_t *conn, dbi_error_flag errflag); | |||
int _disjoin_from_conn(dbi_result_t *result); | int _disjoin_from_conn(dbi_result_t *result); | |||
void _set_field_flag(dbi_row_t *row, unsigned int fieldidx, unsigned char f | ||||
lag, unsigned char value); | ||||
int _get_field_flag(dbi_row_t *row, unsigned int fieldidx, unsigned char fl | ||||
ag); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif /* __cplusplus */ | #endif /* __cplusplus */ | |||
#endif /* __DBI_DEV_H__ */ | #endif /* __DBI_DEV_H__ */ | |||
End of changes. 8 change blocks. | ||||
13 lines changed or deleted | 23 lines changed or added | |||
dbi.h | dbi.h | |||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
* | * | |||
* This library is distributed in the hope that it will be useful, | * This library is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | * Lesser General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU Lesser General Public | * You should have received a copy of the GNU Lesser General Public | |||
* License along with this library; if not, write to the Free Software | * License along with this library; if not, write to the Free Software | |||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | |||
* | * | |||
* $Id: dbi.h,v 1.50 2004/01/03 17:22:52 mhoenicka Exp $ | * $Id: dbi.h,v 1.60 2005/08/14 21:02:05 mhoenicka Exp $ | |||
*/ | */ | |||
#ifndef __DBI_H__ | #ifndef __DBI_H__ | |||
#define __DBI_H__ | #define __DBI_H__ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <stdarg.h> | #include <stdarg.h> | |||
#include <time.h> | #include <time.h> | |||
#include <limits.h> /* for the *_MAX definitions */ | ||||
/* opaque type definitions */ | /* opaque type definitions */ | |||
typedef void * dbi_driver; | typedef void * dbi_driver; | |||
typedef void * dbi_conn; | typedef void * dbi_conn; | |||
typedef void * dbi_result; | typedef void * dbi_result; | |||
/* other type definitions */ | /* other type definitions */ | |||
typedef enum { DBI_ERROR_USER = -1, DBI_ERROR_NONE = 0, DBI_ERROR_DBD, DBI_ | typedef enum { DBI_ERROR_USER = -1, DBI_ERROR_NONE = 0, DBI_ERROR_DBD, DBI_ | |||
ERROR_BADOBJECT, DBI_ERROR_BADTYPE, DBI_ERROR_BADIDX, DBI_ERROR_BADNAME, DB | ERROR_BADOBJECT, DBI_ERROR_BADTYPE, DBI_ERROR_BADIDX, DBI_ERROR_BADNAME, DB | |||
I_ERROR_UNSUPPORTED, DBI_ERROR_NOCONN, DBI_ERROR_NOMEM } dbi_error_flag; | I_ERROR_UNSUPPORTED, DBI_ERROR_NOCONN, DBI_ERROR_NOMEM, DBI_ERROR_BADPTR } | |||
dbi_error_flag; | ||||
/* some _MAX definitions. The size_t hack may not be portable */ | ||||
#ifndef SIZE_T_MAX | ||||
# define SIZE_T_MAX UINT_MAX | ||||
#endif | ||||
#ifndef ULLONG_MAX | ||||
# define ULLONG_MAX ULONG_LONG_MAX | ||||
#endif | ||||
typedef struct { | typedef struct { | |||
unsigned char month; | unsigned char month; | |||
unsigned char day; | unsigned char day; | |||
signed short year; // may be negative (B.C.) | signed short year; // may be negative (B.C.) | |||
} dbi_date; | } dbi_date; | |||
typedef struct { | typedef struct { | |||
// when used as an interval value, at most one of these values may b e negative. | // when used as an interval value, at most one of these values may b e negative. | |||
// when used as a counter, the hour may be greater than 23. | // when used as a counter, the hour may be greater than 23. | |||
skipping to change at line 92 | skipping to change at line 101 | |||
#define DBI_DECIMAL_UNSIGNED (1 << 0) | #define DBI_DECIMAL_UNSIGNED (1 << 0) | |||
#define DBI_DECIMAL_SIZE4 (1 << 1) | #define DBI_DECIMAL_SIZE4 (1 << 1) | |||
#define DBI_DECIMAL_SIZE8 (1 << 2) | #define DBI_DECIMAL_SIZE8 (1 << 2) | |||
#define DBI_STRING_FIXEDSIZE (1 << 0) /* XXX unused as of now */ | #define DBI_STRING_FIXEDSIZE (1 << 0) /* XXX unused as of now */ | |||
#define DBI_DATETIME_DATE (1 << 0) | #define DBI_DATETIME_DATE (1 << 0) | |||
#define DBI_DATETIME_TIME (1 << 1) | #define DBI_DATETIME_TIME (1 << 1) | |||
/* values for the bitmask in field_flags (unique to each row) */ | ||||
#define DBI_VALUE_NULL (1 << 0) | ||||
/* error code for type retrieval functions */ | ||||
#define DBI_TYPE_ERROR 0 | ||||
/* error code for attribute retrieval functions */ | ||||
#define DBI_ATTRIBUTE_ERROR SHRT_MAX | ||||
/* functions with a return type of size_t return this in case of an | ||||
error if 0 is a valid return value */ | ||||
#define DBI_LENGTH_ERROR SIZE_T_MAX | ||||
/* functions with a return type of unsigned long long return this in | ||||
case of an error if 0 is a valid return value */ | ||||
#define DBI_ROW_ERROR ULLONG_MAX | ||||
/* functions with a return type of unsigned int return this in case of an e | ||||
rror */ | ||||
#define DBI_FIELD_ERROR UINT_MAX | ||||
/* error code for field attribute retrieval functions */ | ||||
#define DBI_FIELD_FLAG_ERROR -1 | ||||
/* error code for bind* functions */ | ||||
#define DBI_BIND_ERROR -1 | ||||
/* needed by get_engine_version functions */ | ||||
#define VERSIONSTRING_LENGTH 32 | ||||
int dbi_initialize(const char *driverdir); | int dbi_initialize(const char *driverdir); | |||
void dbi_shutdown(); | void dbi_shutdown(); | |||
const char *dbi_version(); | const char *dbi_version(); | |||
int dbi_set_verbosity(int verbosity); | int dbi_set_verbosity(int verbosity); | |||
dbi_driver dbi_driver_list(dbi_driver Current); /* returns next driver. if current is NULL, return first driver. */ | dbi_driver dbi_driver_list(dbi_driver Current); /* returns next driver. if current is NULL, return first driver. */ | |||
dbi_driver dbi_driver_open(const char *name); /* goes thru linked list unti l it finds the right one */ | dbi_driver dbi_driver_open(const char *name); /* goes thru linked list unti l it finds the right one */ | |||
int dbi_driver_is_reserved_word(dbi_driver Driver, const char *word); | int dbi_driver_is_reserved_word(dbi_driver Driver, const char *word); | |||
void *dbi_driver_specific_function(dbi_driver Driver, const char *name); | void *dbi_driver_specific_function(dbi_driver Driver, const char *name); | |||
int dbi_driver_quote_string_copy(dbi_driver Driver, const char *orig, char | size_t dbi_driver_quote_string_copy(dbi_driver Driver, const char *orig, ch | |||
**newstr); | ar **newstr); | |||
int dbi_driver_quote_string(dbi_driver Driver, char **orig); | size_t dbi_driver_quote_string(dbi_driver Driver, char **orig); | |||
const char* dbi_driver_encoding_from_iana(dbi_driver Driver, const char* ia | ||||
na_encoding); | ||||
const char* dbi_driver_encoding_to_iana(dbi_driver Driver, const char* db_e | ||||
ncoding); | ||||
int dbi_driver_cap_get(dbi_driver Driver, const char *capname); | int dbi_driver_cap_get(dbi_driver Driver, const char *capname); | |||
const char *dbi_driver_get_name(dbi_driver Driver); | const char *dbi_driver_get_name(dbi_driver Driver); | |||
const char *dbi_driver_get_filename(dbi_driver Driver); | const char *dbi_driver_get_filename(dbi_driver Driver); | |||
const char *dbi_driver_get_description(dbi_driver Driver); | const char *dbi_driver_get_description(dbi_driver Driver); | |||
const char *dbi_driver_get_maintainer(dbi_driver Driver); | const char *dbi_driver_get_maintainer(dbi_driver Driver); | |||
const char *dbi_driver_get_url(dbi_driver Driver); | const char *dbi_driver_get_url(dbi_driver Driver); | |||
const char *dbi_driver_get_version(dbi_driver Driver); | const char *dbi_driver_get_version(dbi_driver Driver); | |||
const char *dbi_driver_get_date_compiled(dbi_driver Driver); | const char *dbi_driver_get_date_compiled(dbi_driver Driver); | |||
skipping to change at line 136 | skipping to change at line 176 | |||
int dbi_conn_disjoin_results(dbi_conn Conn); | int dbi_conn_disjoin_results(dbi_conn Conn); | |||
void dbi_conn_close(dbi_conn Conn); | void dbi_conn_close(dbi_conn Conn); | |||
int dbi_conn_error(dbi_conn Conn, const char **errmsg_dest); | int dbi_conn_error(dbi_conn Conn, const char **errmsg_dest); | |||
void dbi_conn_error_handler(dbi_conn Conn, dbi_conn_error_handler_func func tion, void *user_argument); | void dbi_conn_error_handler(dbi_conn Conn, dbi_conn_error_handler_func func tion, void *user_argument); | |||
dbi_error_flag dbi_conn_error_flag(dbi_conn Conn); | dbi_error_flag dbi_conn_error_flag(dbi_conn Conn); | |||
int dbi_conn_set_error(dbi_conn Conn, int errnum, const char *formatstr, .. .); | int dbi_conn_set_error(dbi_conn Conn, int errnum, const char *formatstr, .. .); | |||
int dbi_conn_connect(dbi_conn Conn); | int dbi_conn_connect(dbi_conn Conn); | |||
int dbi_conn_get_socket(dbi_conn Conn); | int dbi_conn_get_socket(dbi_conn Conn); | |||
unsigned int dbi_conn_get_engine_version(dbi_conn Conn); | ||||
char *dbi_conn_get_engine_version_string(dbi_conn Conn, char *versionstring | ||||
); | ||||
const char *dbi_conn_get_encoding(dbi_conn Conn); | const char *dbi_conn_get_encoding(dbi_conn Conn); | |||
dbi_result dbi_conn_get_db_list(dbi_conn Conn, const char *pattern); | dbi_result dbi_conn_get_db_list(dbi_conn Conn, const char *pattern); | |||
dbi_result dbi_conn_get_table_list(dbi_conn Conn, const char *db, const cha r *pattern); | dbi_result dbi_conn_get_table_list(dbi_conn Conn, const char *db, const cha r *pattern); | |||
dbi_result dbi_conn_query(dbi_conn Conn, const char *statement); | dbi_result dbi_conn_query(dbi_conn Conn, const char *statement); | |||
dbi_result dbi_conn_queryf(dbi_conn Conn, const char *formatstr, ...); | dbi_result dbi_conn_queryf(dbi_conn Conn, const char *formatstr, ...); | |||
dbi_result dbi_conn_query_null(dbi_conn Conn, const unsigned char *statemen t, unsigned long st_length); | dbi_result dbi_conn_query_null(dbi_conn Conn, const unsigned char *statemen t, size_t st_length); | |||
int dbi_conn_select_db(dbi_conn Conn, const char *db); | int dbi_conn_select_db(dbi_conn Conn, const char *db); | |||
unsigned long long dbi_conn_sequence_last(dbi_conn Conn, const char *name); /* name of the sequence or table */ | unsigned long long dbi_conn_sequence_last(dbi_conn Conn, const char *name); /* name of the sequence or table */ | |||
unsigned long long dbi_conn_sequence_next(dbi_conn Conn, const char *name); | unsigned long long dbi_conn_sequence_next(dbi_conn Conn, const char *name); | |||
int dbi_conn_ping(dbi_conn Conn); | int dbi_conn_ping(dbi_conn Conn); | |||
size_t dbi_conn_quote_string_copy(dbi_conn Conn, const char *orig, char **n | ||||
ewstr); | ||||
size_t dbi_conn_quote_string(dbi_conn Conn, char **orig); | ||||
size_t dbi_conn_quote_binary_copy(dbi_conn Conn, const unsigned char *orig, | ||||
size_t from_length, unsigned char **newstr); | ||||
dbi_conn dbi_result_get_conn(dbi_result Result); | dbi_conn dbi_result_get_conn(dbi_result Result); | |||
int dbi_result_free(dbi_result Result); | int dbi_result_free(dbi_result Result); | |||
int dbi_result_seek_row(dbi_result Result, unsigned long long row); | int dbi_result_seek_row(dbi_result Result, unsigned long long rowidx); | |||
int dbi_result_first_row(dbi_result Result); | int dbi_result_first_row(dbi_result Result); | |||
int dbi_result_last_row(dbi_result Result); | int dbi_result_last_row(dbi_result Result); | |||
int dbi_result_has_prev_row(dbi_result Result); | int dbi_result_has_prev_row(dbi_result Result); | |||
int dbi_result_prev_row(dbi_result Result); | int dbi_result_prev_row(dbi_result Result); | |||
int dbi_result_has_next_row(dbi_result Result); | int dbi_result_has_next_row(dbi_result Result); | |||
int dbi_result_next_row(dbi_result Result); | int dbi_result_next_row(dbi_result Result); | |||
unsigned long long dbi_result_get_currow(dbi_result Result); | unsigned long long dbi_result_get_currow(dbi_result Result); | |||
unsigned long long dbi_result_get_numrows(dbi_result Result); | unsigned long long dbi_result_get_numrows(dbi_result Result); | |||
unsigned long long dbi_result_get_numrows_affected(dbi_result Result); | unsigned long long dbi_result_get_numrows_affected(dbi_result Result); | |||
unsigned long long dbi_result_get_field_size(dbi_result Result, const char | size_t dbi_result_get_field_size(dbi_result Result, const char *fieldname); | |||
*fieldname); | size_t dbi_result_get_field_size_idx(dbi_result Result, unsigned int fieldi | |||
unsigned long long dbi_result_get_field_size_idx(dbi_result Result, unsigne | dx); | |||
d short idx); | size_t dbi_result_get_field_length(dbi_result Result, const char *fieldname | |||
unsigned long long dbi_result_get_field_length(dbi_result Result, const cha | ); | |||
r *fieldname); /* size-1 */ | size_t dbi_result_get_field_length_idx(dbi_result Result, unsigned int fiel | |||
unsigned long long dbi_result_get_field_length_idx(dbi_result Result, unsig | didx); | |||
ned short idx); | unsigned int dbi_result_get_field_idx(dbi_result Result, const char *fieldn | |||
unsigned short dbi_result_get_field_idx(dbi_result Result, const char *fiel | ame); | |||
dname); | const char *dbi_result_get_field_name(dbi_result Result, unsigned int field | |||
const char *dbi_result_get_field_name(dbi_result Result, unsigned short idx | idx); | |||
); | unsigned int dbi_result_get_numfields(dbi_result Result); | |||
unsigned short dbi_result_get_numfields(dbi_result Result); | ||||
unsigned short dbi_result_get_field_type(dbi_result Result, const char *fie ldname); | unsigned short dbi_result_get_field_type(dbi_result Result, const char *fie ldname); | |||
unsigned short dbi_result_get_field_type_idx(dbi_result Result, unsigned sh | unsigned short dbi_result_get_field_type_idx(dbi_result Result, unsigned in | |||
ort idx); | t fieldidx); | |||
unsigned long dbi_result_get_field_attrib(dbi_result Result, const char *fi | unsigned int dbi_result_get_field_attrib(dbi_result Result, const char *fie | |||
eldname, unsigned long attribmin, unsigned long attribmax); | ldname, unsigned int attribmin, unsigned int attribmax); | |||
unsigned long dbi_result_get_field_attrib_idx(dbi_result Result, unsigned s | unsigned int dbi_result_get_field_attrib_idx(dbi_result Result, unsigned in | |||
hort idx, unsigned long attribmin, unsigned long attribmax); | t fieldidx, unsigned int attribmin, unsigned int attribmax); | |||
unsigned long dbi_result_get_field_attribs(dbi_result Result, const char *f | unsigned int dbi_result_get_field_attribs(dbi_result Result, const char *fi | |||
ieldname); | eldname); | |||
unsigned long dbi_result_get_field_attribs_idx(dbi_result Result, unsigned | unsigned int dbi_result_get_field_attribs_idx(dbi_result Result, unsigned i | |||
short idx); | nt fieldidx); | |||
int dbi_result_field_is_null(dbi_result Result, const char *fieldname); | ||||
int dbi_result_field_is_null_idx(dbi_result Result, unsigned int fieldidx); | ||||
int dbi_result_disjoin(dbi_result Result); | int dbi_result_disjoin(dbi_result Result); | |||
int dbi_result_get_fields(dbi_result Result, const char *format, ...); | unsigned int dbi_result_get_fields(dbi_result Result, const char *format, . | |||
int dbi_result_bind_fields(dbi_result Result, const char *format, ...); | ..); | |||
unsigned int dbi_result_bind_fields(dbi_result Result, const char *format, | ||||
...); | ||||
signed char dbi_result_get_char(dbi_result Result, const char *fieldname); | signed char dbi_result_get_char(dbi_result Result, const char *fieldname); | |||
unsigned char dbi_result_get_uchar(dbi_result Result, const char *fieldname ); | unsigned char dbi_result_get_uchar(dbi_result Result, const char *fieldname ); | |||
short dbi_result_get_short(dbi_result Result, const char *fieldname); | short dbi_result_get_short(dbi_result Result, const char *fieldname); | |||
unsigned short dbi_result_get_ushort(dbi_result Result, const char *fieldna me); | unsigned short dbi_result_get_ushort(dbi_result Result, const char *fieldna me); | |||
long dbi_result_get_long(dbi_result Result, const char *fieldname); | int dbi_result_get_int(dbi_result Result, const char *fieldname); | |||
unsigned long dbi_result_get_ulong(dbi_result Result, const char *fieldname | unsigned int dbi_result_get_uint(dbi_result Result, const char *fieldname); | |||
); | int dbi_result_get_long(dbi_result Result, const char *fieldname); /* depre | |||
cated */ | ||||
unsigned int dbi_result_get_ulong(dbi_result Result, const char *fieldname) | ||||
; /* deprecated */ | ||||
long long dbi_result_get_longlong(dbi_result Result, const char *fieldname) ; | long long dbi_result_get_longlong(dbi_result Result, const char *fieldname) ; | |||
unsigned long long dbi_result_get_ulonglong(dbi_result Result, const char * fieldname); | unsigned long long dbi_result_get_ulonglong(dbi_result Result, const char * fieldname); | |||
float dbi_result_get_float(dbi_result Result, const char *fieldname); | float dbi_result_get_float(dbi_result Result, const char *fieldname); | |||
double dbi_result_get_double(dbi_result Result, const char *fieldname); | double dbi_result_get_double(dbi_result Result, const char *fieldname); | |||
const char *dbi_result_get_string(dbi_result Result, const char *fieldname) ; | const char *dbi_result_get_string(dbi_result Result, const char *fieldname) ; | |||
const unsigned char *dbi_result_get_binary(dbi_result Result, const char *f ieldname); | const unsigned char *dbi_result_get_binary(dbi_result Result, const char *f ieldname); | |||
char *dbi_result_get_string_copy(dbi_result Result, const char *fieldname); | char *dbi_result_get_string_copy(dbi_result Result, const char *fieldname); | |||
unsigned char *dbi_result_get_binary_copy(dbi_result Result, const char *fi eldname); | unsigned char *dbi_result_get_binary_copy(dbi_result Result, const char *fi eldname); | |||
time_t dbi_result_get_datetime(dbi_result Result, const char *fieldname); | time_t dbi_result_get_datetime(dbi_result Result, const char *fieldname); | |||
int dbi_result_bind_char(dbi_result Result, const char *fieldname, char *bi ndto); | int dbi_result_bind_char(dbi_result Result, const char *fieldname, char *bi ndto); | |||
int dbi_result_bind_uchar(dbi_result Result, const char *fieldname, unsigne d char *bindto); | int dbi_result_bind_uchar(dbi_result Result, const char *fieldname, unsigne d char *bindto); | |||
int dbi_result_bind_short(dbi_result Result, const char *fieldname, short * bindto); | int dbi_result_bind_short(dbi_result Result, const char *fieldname, short * bindto); | |||
int dbi_result_bind_ushort(dbi_result Result, const char *fieldname, unsign ed short *bindto); | int dbi_result_bind_ushort(dbi_result Result, const char *fieldname, unsign ed short *bindto); | |||
int dbi_result_bind_long(dbi_result Result, const char *fieldname, long *bi | int dbi_result_bind_long(dbi_result Result, const char *fieldname, int *bin | |||
ndto); | dto); | |||
int dbi_result_bind_ulong(dbi_result Result, const char *fieldname, unsigne | int dbi_result_bind_ulong(dbi_result Result, const char *fieldname, unsigne | |||
d long *bindto); | d int *bindto); | |||
int dbi_result_bind_int(dbi_result Result, const char *fieldname, int *bind | ||||
to); | ||||
int dbi_result_bind_uint(dbi_result Result, const char *fieldname, unsigned | ||||
int *bindto); | ||||
int dbi_result_bind_longlong(dbi_result Result, const char *fieldname, long long *bindto); | int dbi_result_bind_longlong(dbi_result Result, const char *fieldname, long long *bindto); | |||
int dbi_result_bind_ulonglong(dbi_result Result, const char *fieldname, uns igned long long *bindto); | int dbi_result_bind_ulonglong(dbi_result Result, const char *fieldname, uns igned long long *bindto); | |||
int dbi_result_bind_float(dbi_result Result, const char *fieldname, float * bindto); | int dbi_result_bind_float(dbi_result Result, const char *fieldname, float * bindto); | |||
int dbi_result_bind_double(dbi_result Result, const char *fieldname, double *bindto); | int dbi_result_bind_double(dbi_result Result, const char *fieldname, double *bindto); | |||
int dbi_result_bind_string(dbi_result Result, const char *fieldname, const char **bindto); | int dbi_result_bind_string(dbi_result Result, const char *fieldname, const char **bindto); | |||
int dbi_result_bind_binary(dbi_result Result, const char *fieldname, const unsigned char **bindto); | int dbi_result_bind_binary(dbi_result Result, const char *fieldname, const unsigned char **bindto); | |||
int dbi_result_bind_string_copy(dbi_result Result, const char *fieldname, c har **bindto); | int dbi_result_bind_string_copy(dbi_result Result, const char *fieldname, c har **bindto); | |||
int dbi_result_bind_binary_copy(dbi_result Result, const char *fieldname, u nsigned char **bindto); | int dbi_result_bind_binary_copy(dbi_result Result, const char *fieldname, u nsigned char **bindto); | |||
int dbi_result_bind_datetime(dbi_result Result, const char *fieldname, time _t *bindto); | int dbi_result_bind_datetime(dbi_result Result, const char *fieldname, time _t *bindto); | |||
/* and now for the same exact thing in index form: */ | /* and now for the same exact thing in index form: */ | |||
signed char dbi_result_get_char_idx(dbi_result Result, unsigned short idx); | signed char dbi_result_get_char_idx(dbi_result Result, unsigned int fieldid | |||
unsigned char dbi_result_get_uchar_idx(dbi_result Result, unsigned short id | x); | |||
x); | unsigned char dbi_result_get_uchar_idx(dbi_result Result, unsigned int fiel | |||
short dbi_result_get_short_idx(dbi_result Result, unsigned short idx); | didx); | |||
unsigned short dbi_result_get_ushort_idx(dbi_result Result, unsigned short | short dbi_result_get_short_idx(dbi_result Result, unsigned int fieldidx); | |||
idx); | unsigned short dbi_result_get_ushort_idx(dbi_result Result, unsigned int fi | |||
long dbi_result_get_long_idx(dbi_result Result, unsigned short idx); | eldidx); | |||
unsigned long dbi_result_get_ulong_idx(dbi_result Result, unsigned short id | int dbi_result_get_long_idx(dbi_result Result, unsigned int fieldidx); | |||
x); | int dbi_result_get_int_idx(dbi_result Result, unsigned int fieldidx); | |||
long long dbi_result_get_longlong_idx(dbi_result Result, unsigned short idx | unsigned int dbi_result_get_uint_idx(dbi_result Result, unsigned int fieldi | |||
); | dx); | |||
unsigned long long dbi_result_get_ulonglong_idx(dbi_result Result, unsigned | unsigned int dbi_result_get_ulong_idx(dbi_result Result, unsigned int field | |||
short idx); | idx); | |||
long long dbi_result_get_longlong_idx(dbi_result Result, unsigned int field | ||||
idx); | ||||
unsigned long long dbi_result_get_ulonglong_idx(dbi_result Result, unsigned | ||||
int fieldidx); | ||||
float dbi_result_get_float_idx(dbi_result Result, unsigned short idx); | float dbi_result_get_float_idx(dbi_result Result, unsigned int fieldidx); | |||
double dbi_result_get_double_idx(dbi_result Result, unsigned short idx); | double dbi_result_get_double_idx(dbi_result Result, unsigned int fieldidx); | |||
const char *dbi_result_get_string_idx(dbi_result Result, unsigned short idx | const char *dbi_result_get_string_idx(dbi_result Result, unsigned int field | |||
); | idx); | |||
const unsigned char *dbi_result_get_binary_idx(dbi_result Result, unsigned | const unsigned char *dbi_result_get_binary_idx(dbi_result Result, unsigned | |||
short idx); | int fieldidx); | |||
char *dbi_result_get_string_copy_idx(dbi_result Result, unsigned short idx) | char *dbi_result_get_string_copy_idx(dbi_result Result, unsigned int fieldi | |||
; | dx); | |||
unsigned char *dbi_result_get_binary_copy_idx(dbi_result Result, unsigned s | unsigned char *dbi_result_get_binary_copy_idx(dbi_result Result, unsigned i | |||
hort idx); | nt fieldidx); | |||
time_t dbi_result_get_datetime_idx(dbi_result Result, unsigned short idx); | time_t dbi_result_get_datetime_idx(dbi_result Result, unsigned int fieldidx ); | |||
/* | /* | |||
int dbi_result_bind_char_idx(dbi_result Result, unsigned int idx, char *bin | int dbi_result_bind_char_idx(dbi_result Result, unsigned int fieldidx, char | |||
dto); | *bindto); | |||
int dbi_result_bind_uchar_idx(dbi_result Result, unsigned int idx, unsigned | int dbi_result_bind_uchar_idx(dbi_result Result, unsigned int fieldidx, uns | |||
char *bindto); | igned char *bindto); | |||
int dbi_result_bind_short_idx(dbi_result Result, unsigned int idx, short *b | int dbi_result_bind_short_idx(dbi_result Result, unsigned int fieldidx, sho | |||
indto); | rt *bindto); | |||
int dbi_result_bind_ushort_idx(dbi_result Result, unsigned int idx, unsigne | int dbi_result_bind_ushort_idx(dbi_result Result, unsigned int fieldidx, un | |||
d short *bindto); | signed short *bindto); | |||
int dbi_result_bind_long_idx(dbi_result Result, unsigned int idx, long *bin | int dbi_result_bind_long_idx(dbi_result Result, unsigned int fieldidx, long | |||
dto); | *bindto); | |||
int dbi_result_bind_ulong_idx(dbi_result Result, unsigned int idx, unsigned | int dbi_result_bind_ulong_idx(dbi_result Result, unsigned int fieldidx, uns | |||
long *bindto); | igned long *bindto); | |||
int dbi_result_bind_longlong_idx(dbi_result Result, unsigned int idx, long | int dbi_result_bind_longlong_idx(dbi_result Result, unsigned int fieldidx, | |||
long *bindto); | long long *bindto); | |||
int dbi_result_bind_ulonglong_idx(dbi_result Result, unsigned int idx, unsi | int dbi_result_bind_ulonglong_idx(dbi_result Result, unsigned int fieldidx, | |||
gned long long *bindto); | unsigned long long *bindto); | |||
int dbi_result_bind_float_idx(dbi_result Result, unsigned int idx, float *b | int dbi_result_bind_float_idx(dbi_result Result, unsigned int fieldidx, flo | |||
indto); | at *bindto); | |||
int dbi_result_bind_double_idx(dbi_result Result, unsigned int idx, double | int dbi_result_bind_double_idx(dbi_result Result, unsigned int fieldidx, do | |||
*bindto); | uble *bindto); | |||
int dbi_result_bind_string_idx(dbi_result Result, unsigned int idx, const c | int dbi_result_bind_string_idx(dbi_result Result, unsigned int fieldidx, co | |||
har **bindto); | nst char **bindto); | |||
int dbi_result_bind_binary_idx(dbi_result Result, unsigned int idx, const u | int dbi_result_bind_binary_idx(dbi_result Result, unsigned int fieldidx, co | |||
nsigned char **bindto); | nst unsigned char **bindto); | |||
int dbi_result_bind_string_copy_idx(dbi_result Result, unsigned int idx, ch | int dbi_result_bind_string_copy_idx(dbi_result Result, unsigned int fieldid | |||
ar **bindto); | x, char **bindto); | |||
int dbi_result_bind_binary_copy_idx(dbi_result Result, unsigned int idx, un | int dbi_result_bind_binary_copy_idx(dbi_result Result, unsigned int fieldid | |||
signed char **bindto); | x, unsigned char **bindto); | |||
int dbi_result_bind_datetime_idx(dbi_result Result, unsigned int idx, time_ t *bindto); | int dbi_result_bind_datetime_idx(dbi_result Result, unsigned int fieldidx, time_t *bindto); | |||
*/ | */ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif /* __cplusplus */ | #endif /* __cplusplus */ | |||
#endif /* __DBI_H__ */ | #endif /* __DBI_H__ */ | |||
End of changes. 24 change blocks. | ||||
94 lines changed or deleted | 160 lines changed or added | |||