00001 /* Licensed to the Apache Software Foundation (ASF) under one or more 00002 * contributor license agreements. See the NOTICE file distributed with 00003 * this work for additional information regarding copyright ownership. 00004 * The ASF licenses this file to You under the Apache License, Version 2.0 00005 * (the "License"); you may not use this file except in compliance with 00006 * the License. You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /* Overview of what this is and does: 00018 * http://www.apache.org/~niq/dbd.html 00019 */ 00020 00021 #ifndef APR_DBD_H 00022 #define APR_DBD_H 00023 00024 #include "apu.h" 00025 #include "apr_pools.h" 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 /** 00032 * @file apr_dbd.h 00033 * @brief APR-UTIL DBD library 00034 */ 00035 /** 00036 * @defgroup APR_Util_DBD DBD routines 00037 * @ingroup APR_Util 00038 * @{ 00039 */ 00040 00041 /** 00042 * Mapping of C to SQL types, used for prepared statements. 00043 * @remarks 00044 * For apr_dbd_p[v]query/select functions, in and out parameters are always 00045 * const char * (i.e. regular nul terminated strings). LOB types are passed 00046 * with four (4) arguments: payload, length, table and column, all as const 00047 * char *, where table and column are reserved for future use by Oracle. 00048 * @remarks 00049 * For apr_dbd_p[v]bquery/select functions, in and out parameters are 00050 * described next to each enumeration constant and are generally native binary 00051 * types or some APR data type. LOB types are passed with four (4) arguments: 00052 * payload (char*), length (apr_size_t*), table (char*) and column (char*). 00053 * Table and column are reserved for future use by Oracle. 00054 */ 00055 typedef enum { 00056 APR_DBD_TYPE_NONE, 00057 APR_DBD_TYPE_TINY, /**< \%hhd : in, out: char* */ 00058 APR_DBD_TYPE_UTINY, /**< \%hhu : in, out: unsigned char* */ 00059 APR_DBD_TYPE_SHORT, /**< \%hd : in, out: short* */ 00060 APR_DBD_TYPE_USHORT, /**< \%hu : in, out: unsigned short* */ 00061 APR_DBD_TYPE_INT, /**< \%d : in, out: int* */ 00062 APR_DBD_TYPE_UINT, /**< \%u : in, out: unsigned int* */ 00063 APR_DBD_TYPE_LONG, /**< \%ld : in, out: long* */ 00064 APR_DBD_TYPE_ULONG, /**< \%lu : in, out: unsigned long* */ 00065 APR_DBD_TYPE_LONGLONG, /**< \%lld : in, out: apr_int64_t* */ 00066 APR_DBD_TYPE_ULONGLONG, /**< \%llu : in, out: apr_uint64_t* */ 00067 APR_DBD_TYPE_FLOAT, /**< \%f : in, out: float* */ 00068 APR_DBD_TYPE_DOUBLE, /**< \%lf : in, out: double* */ 00069 APR_DBD_TYPE_STRING, /**< \%s : in: char*, out: char** */ 00070 APR_DBD_TYPE_TEXT, /**< \%pDt : in: char*, out: char** */ 00071 APR_DBD_TYPE_TIME, /**< \%pDi : in: char*, out: char** */ 00072 APR_DBD_TYPE_DATE, /**< \%pDd : in: char*, out: char** */ 00073 APR_DBD_TYPE_DATETIME, /**< \%pDa : in: char*, out: char** */ 00074 APR_DBD_TYPE_TIMESTAMP, /**< \%pDs : in: char*, out: char** */ 00075 APR_DBD_TYPE_ZTIMESTAMP, /**< \%pDz : in: char*, out: char** */ 00076 APR_DBD_TYPE_BLOB, /**< \%pDb : in: char* apr_size_t* char* char*, out: apr_bucket_brigade* */ 00077 APR_DBD_TYPE_CLOB, /**< \%pDc : in: char* apr_size_t* char* char*, out: apr_bucket_brigade* */ 00078 APR_DBD_TYPE_NULL /**< \%pDn : in: void*, out: void** */ 00079 } apr_dbd_type_e; 00080 00081 /* These are opaque structs. Instantiation is up to each backend */ 00082 typedef struct apr_dbd_driver_t apr_dbd_driver_t; 00083 typedef struct apr_dbd_t apr_dbd_t; 00084 typedef struct apr_dbd_transaction_t apr_dbd_transaction_t; 00085 typedef struct apr_dbd_results_t apr_dbd_results_t; 00086 typedef struct apr_dbd_row_t apr_dbd_row_t; 00087 typedef struct apr_dbd_prepared_t apr_dbd_prepared_t; 00088 00089 /** apr_dbd_init: perform once-only initialisation. Call once only. 00090 * 00091 * @param pool - pool to register any shutdown cleanups, etc 00092 */ 00093 APU_DECLARE(apr_status_t) apr_dbd_init(apr_pool_t *pool); 00094 00095 /** apr_dbd_get_driver: get the driver struct for a name 00096 * 00097 * @param pool - (process) pool to register cleanup 00098 * @param name - driver name 00099 * @param driver - pointer to driver struct. 00100 * @return APR_SUCCESS for success 00101 * @return APR_ENOTIMPL for no driver (when DSO not enabled) 00102 * @return APR_EDSOOPEN if DSO driver file can't be opened 00103 * @return APR_ESYMNOTFOUND if the driver file doesn't contain a driver 00104 */ 00105 APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name, 00106 const apr_dbd_driver_t **driver); 00107 00108 /** apr_dbd_open_ex: open a connection to a backend 00109 * 00110 * @param pool - working pool 00111 * @param params - arguments to driver (implementation-dependent) 00112 * @param handle - pointer to handle to return 00113 * @param driver - driver struct. 00114 * @param error - descriptive error. 00115 * @return APR_SUCCESS for success 00116 * @return APR_EGENERAL if driver exists but connection failed 00117 * @remarks PostgreSQL: the params is passed directly to the PQconnectdb() 00118 * function (check PostgreSQL documentation for more details on the syntax). 00119 * @remarks SQLite2: the params is split on a colon, with the first part used 00120 * as the filename and second part converted to an integer and used as file 00121 * mode. 00122 * @remarks SQLite3: the params is passed directly to the sqlite3_open() 00123 * function as a filename to be opened (check SQLite3 documentation for more 00124 * details). 00125 * @remarks Oracle: the params can have "user", "pass", "dbname" and "server" 00126 * keys, each followed by an equal sign and a value. Such key/value pairs can 00127 * be delimited by space, CR, LF, tab, semicolon, vertical bar or comma. 00128 * @remarks MySQL: the params can have "host", "port", "user", "pass", 00129 * "dbname", "sock", "flags" "fldsz", "group" and "reconnect" keys, each 00130 * followed by an equal sign and a value. Such key/value pairs can be 00131 * delimited by space, CR, LF, tab, semicolon, vertical bar or comma. For 00132 * now, "flags" can only recognise CLIENT_FOUND_ROWS (check MySQL manual for 00133 * details). The value associated with "fldsz" determines maximum amount of 00134 * memory (in bytes) for each of the fields in the result set of prepared 00135 * statements. By default, this value is 1 MB. The value associated with 00136 * "group" determines which group from configuration file to use (see 00137 * MYSQL_READ_DEFAULT_GROUP option of mysql_options() in MySQL manual). 00138 * Reconnect is set to 1 by default (i.e. true). 00139 * @remarks FreeTDS: the params can have "username", "password", "appname", 00140 * "dbname", "host", "charset", "lang" and "server" keys, each followed by an 00141 * equal sign and a value. 00142 */ 00143 APU_DECLARE(apr_status_t) apr_dbd_open_ex(const apr_dbd_driver_t *driver, 00144 apr_pool_t *pool, const char *params, 00145 apr_dbd_t **handle, 00146 const char **error); 00147 00148 /** apr_dbd_open: open a connection to a backend 00149 * 00150 * @param pool - working pool 00151 * @param params - arguments to driver (implementation-dependent) 00152 * @param handle - pointer to handle to return 00153 * @param driver - driver struct. 00154 * @return APR_SUCCESS for success 00155 * @return APR_EGENERAL if driver exists but connection failed 00156 * @see apr_dbd_open_ex 00157 */ 00158 APU_DECLARE(apr_status_t) apr_dbd_open(const apr_dbd_driver_t *driver, 00159 apr_pool_t *pool, const char *params, 00160 apr_dbd_t **handle); 00161 00162 /** apr_dbd_close: close a connection to a backend 00163 * 00164 * @param handle - handle to close 00165 * @param driver - driver struct. 00166 * @return APR_SUCCESS for success or error status 00167 */ 00168 APU_DECLARE(apr_status_t) apr_dbd_close(const apr_dbd_driver_t *driver, 00169 apr_dbd_t *handle); 00170 00171 /* apr-function-shaped versions of things */ 00172 00173 /** apr_dbd_name: get the name of the driver 00174 * 00175 * @param driver - the driver 00176 * @return - name 00177 */ 00178 APU_DECLARE(const char*) apr_dbd_name(const apr_dbd_driver_t *driver); 00179 00180 /** apr_dbd_native_handle: get native database handle of the underlying db 00181 * 00182 * @param driver - the driver 00183 * @param handle - apr_dbd handle 00184 * @return - native handle 00185 */ 00186 APU_DECLARE(void*) apr_dbd_native_handle(const apr_dbd_driver_t *driver, 00187 apr_dbd_t *handle); 00188 00189 /** check_conn: check status of a database connection 00190 * 00191 * @param driver - the driver 00192 * @param pool - working pool 00193 * @param handle - the connection to check 00194 * @return APR_SUCCESS or error 00195 */ 00196 APU_DECLARE(int) apr_dbd_check_conn(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00197 apr_dbd_t *handle); 00198 00199 /** apr_dbd_set_dbname: select database name. May be a no-op if not supported. 00200 * 00201 * @param driver - the driver 00202 * @param pool - working pool 00203 * @param handle - the connection 00204 * @param name - the database to select 00205 * @return 0 for success or error code 00206 */ 00207 APU_DECLARE(int) apr_dbd_set_dbname(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00208 apr_dbd_t *handle, const char *name); 00209 00210 /** apr_dbd_transaction_start: start a transaction. May be a no-op. 00211 * 00212 * @param driver - the driver 00213 * @param pool - a pool to use for error messages (if any). 00214 * @param handle - the db connection 00215 * @param trans - ptr to a transaction. May be null on entry 00216 * @return 0 for success or error code 00217 * @remarks Note that transaction modes, set by calling 00218 * apr_dbd_transaction_mode_set(), will affect all query/select calls within 00219 * a transaction. By default, any error in query/select during a transaction 00220 * will cause the transaction to inherit the error code and any further 00221 * query/select calls will fail immediately. Put transaction in "ignore 00222 * errors" mode to avoid that. Use "rollback" mode to do explicit rollback. 00223 */ 00224 APU_DECLARE(int) apr_dbd_transaction_start(const apr_dbd_driver_t *driver, 00225 apr_pool_t *pool, 00226 apr_dbd_t *handle, 00227 apr_dbd_transaction_t **trans); 00228 00229 /** apr_dbd_transaction_end: end a transaction 00230 * (commit on success, rollback on error). 00231 * May be a no-op. 00232 * 00233 * @param driver - the driver 00234 * @param handle - the db connection 00235 * @param trans - the transaction. 00236 * @return 0 for success or error code 00237 */ 00238 APU_DECLARE(int) apr_dbd_transaction_end(const apr_dbd_driver_t *driver, 00239 apr_pool_t *pool, 00240 apr_dbd_transaction_t *trans); 00241 00242 #define APR_DBD_TRANSACTION_COMMIT 0x00 /**< commit the transaction */ 00243 #define APR_DBD_TRANSACTION_ROLLBACK 0x01 /**< rollback the transaction */ 00244 #define APR_DBD_TRANSACTION_IGNORE_ERRORS 0x02 /**< ignore transaction errors */ 00245 00246 /** apr_dbd_transaction_mode_get: get the mode of transaction 00247 * 00248 * @param driver - the driver 00249 * @param trans - the transaction 00250 * @return mode of transaction 00251 */ 00252 APU_DECLARE(int) apr_dbd_transaction_mode_get(const apr_dbd_driver_t *driver, 00253 apr_dbd_transaction_t *trans); 00254 00255 /** apr_dbd_transaction_mode_set: set the mode of transaction 00256 * 00257 * @param driver - the driver 00258 * @param trans - the transaction 00259 * @param mode - new mode of the transaction 00260 * @return the mode of transaction in force after the call 00261 */ 00262 APU_DECLARE(int) apr_dbd_transaction_mode_set(const apr_dbd_driver_t *driver, 00263 apr_dbd_transaction_t *trans, 00264 int mode); 00265 00266 /** apr_dbd_query: execute an SQL query that doesn't return a result set 00267 * 00268 * @param driver - the driver 00269 * @param handle - the connection 00270 * @param nrows - number of rows affected. 00271 * @param statement - the SQL statement to execute 00272 * @return 0 for success or error code 00273 */ 00274 APU_DECLARE(int) apr_dbd_query(const apr_dbd_driver_t *driver, apr_dbd_t *handle, 00275 int *nrows, const char *statement); 00276 00277 /** apr_dbd_select: execute an SQL query that returns a result set 00278 * 00279 * @param driver - the driver 00280 * @param pool - pool to allocate the result set 00281 * @param handle - the connection 00282 * @param res - pointer to result set pointer. May point to NULL on entry 00283 * @param statement - the SQL statement to execute 00284 * @param random - 1 to support random access to results (seek any row); 00285 * 0 to support only looping through results in order 00286 * (async access - faster) 00287 * @return 0 for success or error code 00288 */ 00289 APU_DECLARE(int) apr_dbd_select(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00290 apr_dbd_t *handle, apr_dbd_results_t **res, 00291 const char *statement, int random); 00292 00293 /** apr_dbd_num_cols: get the number of columns in a results set 00294 * 00295 * @param driver - the driver 00296 * @param res - result set. 00297 * @return number of columns 00298 */ 00299 APU_DECLARE(int) apr_dbd_num_cols(const apr_dbd_driver_t *driver, 00300 apr_dbd_results_t *res); 00301 00302 /** apr_dbd_num_tuples: get the number of rows in a results set 00303 * of a synchronous select 00304 * 00305 * @param driver - the driver 00306 * @param res - result set. 00307 * @return number of rows, or -1 if the results are asynchronous 00308 */ 00309 APU_DECLARE(int) apr_dbd_num_tuples(const apr_dbd_driver_t *driver, 00310 apr_dbd_results_t *res); 00311 00312 /** apr_dbd_get_row: get a row from a result set 00313 * 00314 * @param driver - the driver 00315 * @param pool - pool to allocate the row 00316 * @param res - result set pointer 00317 * @param row - pointer to row pointer. May point to NULL on entry 00318 * @param rownum - row number (counting from 1), or -1 for "next row". 00319 * Ignored if random access is not supported. 00320 * @return 0 for success, -1 for rownum out of range or data finished 00321 */ 00322 APU_DECLARE(int) apr_dbd_get_row(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00323 apr_dbd_results_t *res, apr_dbd_row_t **row, 00324 int rownum); 00325 00326 /** apr_dbd_get_entry: get an entry from a row 00327 * 00328 * @param driver - the driver 00329 * @param row - row pointer 00330 * @param col - entry number 00331 * @return value from the row, or NULL if col is out of bounds. 00332 */ 00333 APU_DECLARE(const char*) apr_dbd_get_entry(const apr_dbd_driver_t *driver, 00334 apr_dbd_row_t *row, int col); 00335 00336 /** apr_dbd_get_name: get an entry name from a result set 00337 * 00338 * @param driver - the driver 00339 * @param res - result set pointer 00340 * @param col - entry number 00341 * @return name of the entry, or NULL if col is out of bounds. 00342 */ 00343 APU_DECLARE(const char*) apr_dbd_get_name(const apr_dbd_driver_t *driver, 00344 apr_dbd_results_t *res, int col); 00345 00346 00347 /** apr_dbd_error: get current error message (if any) 00348 * 00349 * @param driver - the driver 00350 * @param handle - the connection 00351 * @param errnum - error code from operation that returned an error 00352 * @return the database current error message, or message for errnum 00353 * (implementation-dependent whether errnum is ignored) 00354 */ 00355 APU_DECLARE(const char*) apr_dbd_error(const apr_dbd_driver_t *driver, 00356 apr_dbd_t *handle, int errnum); 00357 00358 /** apr_dbd_escape: escape a string so it is safe for use in query/select 00359 * 00360 * @param driver - the driver 00361 * @param pool - pool to alloc the result from 00362 * @param string - the string to escape 00363 * @param handle - the connection 00364 * @return the escaped, safe string 00365 */ 00366 APU_DECLARE(const char*) apr_dbd_escape(const apr_dbd_driver_t *driver, 00367 apr_pool_t *pool, const char *string, 00368 apr_dbd_t *handle); 00369 00370 /** apr_dbd_prepare: prepare a statement 00371 * 00372 * @param driver - the driver 00373 * @param pool - pool to alloc the result from 00374 * @param handle - the connection 00375 * @param query - the SQL query 00376 * @param label - A label for the prepared statement. 00377 * use NULL for temporary prepared statements 00378 * (eg within a Request in httpd) 00379 * @param statement - statement to prepare. May point to null on entry. 00380 * @return 0 for success or error code 00381 * @remarks To specify parameters of the prepared query, use \%s, \%d etc. 00382 * (see below for full list) in place of database specific parameter syntax 00383 * (e.g. for PostgreSQL, this would be $1, $2, for SQLite3 this would be ? 00384 * etc.). For instance: "SELECT name FROM customers WHERE name=%s" would be 00385 * a query that this function understands. 00386 * @remarks Here is the full list of format specifiers that this function 00387 * understands and what they map to in SQL: \%hhd (TINY INT), \%hhu (UNSIGNED 00388 * TINY INT), \%hd (SHORT), \%hu (UNSIGNED SHORT), \%d (INT), \%u (UNSIGNED 00389 * INT), \%ld (LONG), \%lu (UNSIGNED LONG), \%lld (LONG LONG), \%llu 00390 * (UNSIGNED LONG LONG), \%f (FLOAT, REAL), \%lf (DOUBLE PRECISION), \%s 00391 * (VARCHAR), \%pDt (TEXT), \%pDi (TIME), \%pDd (DATE), \%pDa (DATETIME), 00392 * \%pDs (TIMESTAMP), \%pDz (TIMESTAMP WITH TIME ZONE), \%pDb (BLOB), \%pDc 00393 * (CLOB) and \%pDn (NULL). Not all databases have support for all these 00394 * types, so the underlying driver will attempt the "best match" where 00395 * possible. A \% followed by any letter not in the above list will be 00396 * interpreted as VARCHAR (i.e. \%s). 00397 */ 00398 APU_DECLARE(int) apr_dbd_prepare(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00399 apr_dbd_t *handle, const char *query, 00400 const char *label, 00401 apr_dbd_prepared_t **statement); 00402 00403 00404 /** apr_dbd_pquery: query using a prepared statement + args 00405 * 00406 * @param driver - the driver 00407 * @param pool - working pool 00408 * @param handle - the connection 00409 * @param nrows - number of rows affected. 00410 * @param statement - the prepared statement to execute 00411 * @param nargs - ignored (for backward compatibility only) 00412 * @param args - args to prepared statement 00413 * @return 0 for success or error code 00414 */ 00415 APU_DECLARE(int) apr_dbd_pquery(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00416 apr_dbd_t *handle, int *nrows, 00417 apr_dbd_prepared_t *statement, int nargs, 00418 const char **args); 00419 00420 /** apr_dbd_pselect: select using a prepared statement + args 00421 * 00422 * @param driver - the driver 00423 * @param pool - working pool 00424 * @param handle - the connection 00425 * @param res - pointer to query results. May point to NULL on entry 00426 * @param statement - the prepared statement to execute 00427 * @param random - Whether to support random-access to results 00428 * @param nargs - ignored (for backward compatibility only) 00429 * @param args - args to prepared statement 00430 * @return 0 for success or error code 00431 */ 00432 APU_DECLARE(int) apr_dbd_pselect(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00433 apr_dbd_t *handle, apr_dbd_results_t **res, 00434 apr_dbd_prepared_t *statement, int random, 00435 int nargs, const char **args); 00436 00437 /** apr_dbd_pvquery: query using a prepared statement + args 00438 * 00439 * @param driver - the driver 00440 * @param pool - working pool 00441 * @param handle - the connection 00442 * @param nrows - number of rows affected. 00443 * @param statement - the prepared statement to execute 00444 * @param ... - varargs list 00445 * @return 0 for success or error code 00446 */ 00447 APU_DECLARE_NONSTD(int) apr_dbd_pvquery(const apr_dbd_driver_t *driver, 00448 apr_pool_t *pool, 00449 apr_dbd_t *handle, int *nrows, 00450 apr_dbd_prepared_t *statement, ...); 00451 00452 /** apr_dbd_pvselect: select using a prepared statement + args 00453 * 00454 * @param driver - the driver 00455 * @param pool - working pool 00456 * @param handle - the connection 00457 * @param res - pointer to query results. May point to NULL on entry 00458 * @param statement - the prepared statement to execute 00459 * @param random - Whether to support random-access to results 00460 * @param ... - varargs list 00461 * @return 0 for success or error code 00462 */ 00463 APU_DECLARE_NONSTD(int) apr_dbd_pvselect(const apr_dbd_driver_t *driver, 00464 apr_pool_t *pool, apr_dbd_t *handle, 00465 apr_dbd_results_t **res, 00466 apr_dbd_prepared_t *statement, 00467 int random, ...); 00468 00469 /** apr_dbd_pbquery: query using a prepared statement + binary args 00470 * 00471 * @param driver - the driver 00472 * @param pool - working pool 00473 * @param handle - the connection 00474 * @param nrows - number of rows affected. 00475 * @param statement - the prepared statement to execute 00476 * @param args - binary args to prepared statement 00477 * @return 0 for success or error code 00478 */ 00479 APU_DECLARE(int) apr_dbd_pbquery(const apr_dbd_driver_t *driver, 00480 apr_pool_t *pool, apr_dbd_t *handle, 00481 int *nrows, apr_dbd_prepared_t *statement, 00482 const void **args); 00483 00484 /** apr_dbd_pbselect: select using a prepared statement + binary args 00485 * 00486 * @param driver - the driver 00487 * @param pool - working pool 00488 * @param handle - the connection 00489 * @param res - pointer to query results. May point to NULL on entry 00490 * @param statement - the prepared statement to execute 00491 * @param random - Whether to support random-access to results 00492 * @param args - binary args to prepared statement 00493 * @return 0 for success or error code 00494 */ 00495 APU_DECLARE(int) apr_dbd_pbselect(const apr_dbd_driver_t *driver, 00496 apr_pool_t *pool, 00497 apr_dbd_t *handle, apr_dbd_results_t **res, 00498 apr_dbd_prepared_t *statement, int random, 00499 const void **args); 00500 00501 /** apr_dbd_pvbquery: query using a prepared statement + binary args 00502 * 00503 * @param driver - the driver 00504 * @param pool - working pool 00505 * @param handle - the connection 00506 * @param nrows - number of rows affected. 00507 * @param statement - the prepared statement to execute 00508 * @param ... - varargs list of binary args 00509 * @return 0 for success or error code 00510 */ 00511 APU_DECLARE_NONSTD(int) apr_dbd_pvbquery(const apr_dbd_driver_t *driver, 00512 apr_pool_t *pool, 00513 apr_dbd_t *handle, int *nrows, 00514 apr_dbd_prepared_t *statement, ...); 00515 00516 /** apr_dbd_pvbselect: select using a prepared statement + binary args 00517 * 00518 * @param driver - the driver 00519 * @param pool - working pool 00520 * @param handle - the connection 00521 * @param res - pointer to query results. May point to NULL on entry 00522 * @param statement - the prepared statement to execute 00523 * @param random - Whether to support random-access to results 00524 * @param ... - varargs list of binary args 00525 * @return 0 for success or error code 00526 */ 00527 APU_DECLARE_NONSTD(int) apr_dbd_pvbselect(const apr_dbd_driver_t *driver, 00528 apr_pool_t *pool, apr_dbd_t *handle, 00529 apr_dbd_results_t **res, 00530 apr_dbd_prepared_t *statement, 00531 int random, ...); 00532 00533 /** apr_dbd_datum_get: get a binary entry from a row 00534 * 00535 * @param driver - the driver 00536 * @param row - row pointer 00537 * @param col - entry number 00538 * @param type - type of data to get 00539 * @param data - pointer to data, allocated by the caller 00540 * @return APR_SUCCESS on success, APR_ENOENT if data is NULL or APR_EGENERAL 00541 */ 00542 APU_DECLARE(apr_status_t) apr_dbd_datum_get(const apr_dbd_driver_t *driver, 00543 apr_dbd_row_t *row, int col, 00544 apr_dbd_type_e type, void *data); 00545 00546 /** @} */ 00547 00548 #ifdef __cplusplus 00549 } 00550 #endif 00551 00552 #endif