38 #define DBI_CAP_NONE 0
39 #define DBI_CAP_TIME_ZONE_SUPPORT (1 << 0)
40 #define DBI_CAP_CHARSET_SUPPORT (1 << 1)
41 #define DBI_CAP_TRANSACTION_MANAGEMENT (1 << 2)
42 #define DBI_CAP_STORED_PROCEDURES (1 << 3)
43 #define DBI_CAP_LOB_SUPPORT (1 << 4)
44 #define DBI_CAP_BIND_BY_VALUE (1 << 5)
45 #define DBI_CAP_BIND_BY_PLACEHOLDER (1 << 6)
46 #define DBI_CAP_HAS_EXECRAW (1 << 7)
47 #define DBI_CAP_HAS_STATEMENT (1 << 8)
48 #define DBI_CAP_HAS_SELECT_ROW (1 << 9)
49 #define DBI_CAP_HAS_NUMBER_SUPPORT (1 << 10)
50 #define DBI_CAP_HAS_OPTION_SUPPORT (1 << 11)
51 #define DBI_CAP_SERVER_TIME_ZONE (1 << 12)
52 #define DBI_CAP_AUTORECONNECT (1 << 13)
53 #define DBI_CAP_EVENTS (1 << 14)
54 #define DBI_CAP_HAS_DESCRIBE (1 << 15)
55 #define DBI_CAP_HAS_ARRAY_BIND (1 << 16)
56 #define DBI_CAP_HAS_RESULTSET_OUTPUT (1 << 17)
57 #define DBI_CAP_OPTION_PASSTHRU (1 << 18)
59 #define BN_PLACEHOLDER 0
62 #define DBI_DEFAULT_STR_LEN 512
65 #define QDBI_METHOD_OPEN 1
66 #define QDBI_METHOD_CLOSE 2
67 #define QDBI_METHOD_SELECT 3
68 #define QDBI_METHOD_SELECT_ROWS 4
69 #define QDBI_METHOD_EXEC 5
70 #define QDBI_METHOD_COMMIT 6
71 #define QDBI_METHOD_ROLLBACK 7
72 #define QDBI_METHOD_BEGIN_TRANSACTION 8
73 #define QDBI_METHOD_GET_SERVER_VERSION 9
74 #define QDBI_METHOD_GET_CLIENT_VERSION 10
75 #define QDBI_METHOD_EXECRAW 11
76 #define QDBI_METHOD_STMT_PREPARE 12
77 #define QDBI_METHOD_STMT_PREPARE_RAW 13
78 #define QDBI_METHOD_STMT_BIND 14
79 #define QDBI_METHOD_STMT_BIND_PLACEHOLDERS 15
80 #define QDBI_METHOD_STMT_BIND_VALUES 16
81 #define QDBI_METHOD_STMT_EXEC 17
82 #define QDBI_METHOD_STMT_FETCH_ROW 18
83 #define QDBI_METHOD_STMT_FETCH_ROWS 19
84 #define QDBI_METHOD_STMT_FETCH_COLUMNS 20
85 #define QDBI_METHOD_STMT_NEXT 21
86 #define QDBI_METHOD_STMT_CLOSE 22
87 #define QDBI_METHOD_STMT_AFFECTED_ROWS 23
88 #define QDBI_METHOD_STMT_GET_OUTPUT 24
89 #define QDBI_METHOD_STMT_GET_OUTPUT_ROWS 25
90 #define QDBI_METHOD_STMT_DEFINE 26
91 #define QDBI_METHOD_SELECT_ROW 27
92 #define QDBI_METHOD_OPT_SET 28
93 #define QDBI_METHOD_OPT_GET 29
94 #define QDBI_METHOD_STMT_DESCRIBE 30
95 #define QDBI_METHOD_DESCRIBE 31
96 #define QDBI_METHOD_STMT_FREE 32
97 #define QDBI_METHOD_STMT_EXEC_DESCRIBE 33
99 #define QDBI_VALID_CODES 33
108 #define QDBI_EVENT_WARNING 1
282 #define DBI_OPT_NUMBER_OPT "optimal-numbers"
284 #define DBI_OPT_NUMBER_STRING "string-numbers"
286 #define DBI_OPT_NUMBER_NUMERIC "numeric-numbers"
288 #define DBI_OPT_TIMEZONE "timezone"
294 friend hashdecl qore_dbi_mlist_private;
297 hashdecl qore_dbi_mlist_private* priv;
331 DLLEXPORT
void add(
int code, q_dbi_stmt_fetch_row_t method);
333 DLLEXPORT
void add(
int code, q_dbi_stmt_fetch_columns_t method);
335 DLLEXPORT
void add(
int code, q_dbi_stmt_fetch_rows_t method);
337 DLLEXPORT
void add(
int code, q_dbi_stmt_next_t method);
340 DLLEXPORT
void add(
int code, q_dbi_option_set_t method);
342 DLLEXPORT
void add(
int code, q_dbi_option_get_t method);
345 DLLEXPORT
void registerOption(
const char* name,
const char* desc,
const QoreTypeInfo* type = 0);
355 friend hashdecl qore_dbi_private;
359 hashdecl qore_dbi_private* priv;
385 DLLLOCAL
DBIDriver(
struct qore_dbi_private* p);
389 hashdecl qore_dbi_dlist_private;
399 hashdecl qore_dbi_dlist_private *priv;
401 DLLLOCAL
DBIDriver* find_intern(
const char* name)
const;
int(* q_dbi_rollback_t)(Datasource *ds, ExceptionSink *xsink)
signature for the DBI "rollback" method - must be defined in each DBI driver
Definition: DBI.h:200
QoreValue(* q_dbi_get_client_version_t)(const Datasource *ds, ExceptionSink *xsink)
signature for the "get_client_version" method
Definition: DBI.h:224
DLLEXPORT void DBI_concat_numeric(QoreString *str, QoreValue v)
concatenates a numeric value to the QoreString from the value
QoreHashNode *(* q_dbi_select_row_t)(Datasource *ds, const QoreString *str, const QoreListNode *args, ExceptionSink *xsink)
signature for the DBI "selectRow" method - must be defined in each DBI driver
Definition: DBI.h:165
DLLEXPORT QoreHashNode * parseDatasource(const char *ds, ExceptionSink *xsink)
parses a datasource string and returns a hash of the component parts
QoreValue(* q_dbi_exec_t)(Datasource *ds, const QoreString *str, const QoreListNode *args, ExceptionSink *xsink)
signature for the DBI "execSQL" method - must be defined in each DBI driver
Definition: DBI.h:175
int(* q_dbi_stmt_exec_t)(SQLStatement *stmt, ExceptionSink *xsink)
execute statement
Definition: DBI.h:244
int(* q_dbi_stmt_prepare_raw_t)(SQLStatement *stmt, const QoreString &str, ExceptionSink *xsink)
prepare statement with no bind parsing
Definition: DBI.h:234
QoreValue(* q_dbi_select_t)(Datasource *ds, const QoreString *str, const QoreListNode *args, ExceptionSink *xsink)
signature for the DBI "select" method - must be defined in each DBI driver
Definition: DBI.h:144
QoreValue(* q_dbi_select_rows_t)(Datasource *ds, const QoreString *str, const QoreListNode *args, ExceptionSink *xsink)
signature for the DBI "selectRows" method - must be defined in each DBI driver
Definition: DBI.h:154
int(* q_dbi_begin_transaction_t)(Datasource *ds, ExceptionSink *xsink)
signature for the DBI "begin_transaction" method, should only be defined for drivers needing this to ...
Definition: DBI.h:208
DLLEXPORT DBIDriverList DBI
list of DBI drivers currently reigsted by the Qore library
int(* q_dbi_stmt_bind_t)(SQLStatement *stmt, const QoreListNode &l, ExceptionSink *xsink)
bind input values and optionally describe output parameters
Definition: DBI.h:239
int(* q_dbi_commit_t)(Datasource *ds, ExceptionSink *xsink)
signature for the DBI "commit" method - must be defined in each DBI driver
Definition: DBI.h:192
int(* q_dbi_open_t)(Datasource *ds, ExceptionSink *xsink)
signature for the DBI "open" method - must be defined in each DBI driver
Definition: DBI.h:127
int(* q_dbi_close_t)(Datasource *ds)
signature for the DBI "close" method - must be defined in each DBI driver
Definition: DBI.h:134
QoreValue(* q_dbi_get_server_version_t)(Datasource *ds, ExceptionSink *xsink)
signature for the "get_server_version" method
Definition: DBI.h:216
int(* q_dbi_stmt_affected_rows_t)(SQLStatement *stmt, ExceptionSink *xsink)
get number of affected rows
Definition: DBI.h:249
QoreValue(* q_dbi_execraw_t)(Datasource *ds, const QoreString *str, ExceptionSink *xsink)
signature for the DBI "execRawSQL" method - must be defined in each DBI driver
Definition: DBI.h:184
DLLEXPORT int DBI_concat_string(QoreString *str, QoreValue v, ExceptionSink *xsink)
concatenates a string value to the QoreString from the value
int(* q_dbi_stmt_prepare_t)(SQLStatement *stmt, const QoreString &str, const QoreListNode *args, ExceptionSink *xsink)
prepare statement and process placeholder specifications and bind parameters
Definition: DBI.h:229
this class provides the internal link to the database driver for Qore's DBI layer
Definition: DBI.h:354
DLLEXPORT const char * getName() const
this is the only public exported function available in this class
DLLEXPORT QoreHashNode * getOptionHash() const
returns the valid options for this driver with descriptions
DLLEXPORT bool hasStatementAPI() const
returns true if the driver supports the statement API
this class is used to register and find DBI drivers loaded in qore
Definition: DBI.h:396
DLLEXPORT DBIDriver * find(const char *name) const
finds a driver, will try to load the driver using the ModuleManager if no such driver is already pres...
DLLEXPORT DBIDriver * registerDriver(const char *name, const qore_dbi_method_list &methods, int caps)
registers a new DBI driver
the base class for accessing databases in Qore through a Qore DBI driver
Definition: Datasource.h:55
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
This is the hash or associative list container type in Qore, dynamically allocated only,...
Definition: QoreHashNode.h:50
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
contains constants, classes, and subnamespaces in QoreProgram objects
Definition: QoreNamespace.h:65
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
This is the public class for DBI drivers supporting Qore's new prepared statement API.
Definition: SQLStatement.h:38
this is the data structure Qore DBI drivers will use to pass the supported DBI methods
Definition: DBI.h:293
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275