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" and "group" keys, each followed by an 00130 * equal sign and a value. Such key/value pairs can be delimited by space, 00131 * CR, LF, tab, semicolon, vertical bar or comma. For now, "flags" can only 00132 * recognise CLIENT_FOUND_ROWS (check MySQL manual for details). The value 00133 * associated with "fldsz" determines maximum amount of memory (in bytes) for 00134 * each of the fields in the result set of prepared statements. By default, 00135 * this value is 1 MB. The value associated with "group" determines which 00136 * group from configuration file to use (see MYSQL_READ_DEFAULT_GROUP option 00137 * of mysql_options() in MySQL manual). 00138 * @remarks FreeTDS: the params can have "username", "password", "appname", 00139 * "dbname", "host", "charset", "lang" and "server" keys, each followed by an 00140 * equal sign and a value. 00141 */ 00142 APU_DECLARE(apr_status_t) apr_dbd_open_ex(const apr_dbd_driver_t *driver, 00143 apr_pool_t *pool, const char *params, 00144 apr_dbd_t **handle, 00145 const char **error); 00146 00147 /** apr_dbd_open: open a connection to a backend 00148 * 00149 * @param pool - working pool 00150 * @param params - arguments to driver (implementation-dependent) 00151 * @param handle - pointer to handle to return 00152 * @param driver - driver struct. 00153 * @return APR_SUCCESS for success 00154 * @return APR_EGENERAL if driver exists but connection failed 00155 * @see apr_dbd_open_ex 00156 */ 00157 APU_DECLARE(apr_status_t) apr_dbd_open(const apr_dbd_driver_t *driver, 00158 apr_pool_t *pool, const char *params, 00159 apr_dbd_t **handle); 00160 00161 /** apr_dbd_close: close a connection to a backend 00162 * 00163 * @param handle - handle to close 00164 * @param driver - driver struct. 00165 * @return APR_SUCCESS for success or error status 00166 */ 00167 APU_DECLARE(apr_status_t) apr_dbd_close(const apr_dbd_driver_t *driver, 00168 apr_dbd_t *handle); 00169 00170 /* apr-function-shaped versions of things */ 00171 00172 /** apr_dbd_name: get the name of the driver 00173 * 00174 * @param driver - the driver 00175 * @return - name 00176 */ 00177 APU_DECLARE(const char*) apr_dbd_name(const apr_dbd_driver_t *driver); 00178 00179 /** apr_dbd_native_handle: get native database handle of the underlying db 00180 * 00181 * @param driver - the driver 00182 * @param handle - apr_dbd handle 00183 * @return - native handle 00184 */ 00185 APU_DECLARE(void*) apr_dbd_native_handle(const apr_dbd_driver_t *driver, 00186 apr_dbd_t *handle); 00187 00188 /** check_conn: check status of a database connection 00189 * 00190 * @param driver - the driver 00191 * @param pool - working pool 00192 * @param handle - the connection to check 00193 * @return APR_SUCCESS or error 00194 */ 00195 APU_DECLARE(int) apr_dbd_check_conn(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00196 apr_dbd_t *handle); 00197 00198 /** apr_dbd_set_dbname: select database name. May be a no-op if not supported. 00199 * 00200 * @param driver - the driver 00201 * @param pool - working pool 00202 * @param handle - the connection 00203 * @param name - the database to select 00204 * @return 0 for success or error code 00205 */ 00206 APU_DECLARE(int) apr_dbd_set_dbname(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00207 apr_dbd_t *handle, const char *name); 00208 00209 /** apr_dbd_transaction_start: start a transaction. May be a no-op. 00210 * 00211 * @param driver - the driver 00212 * @param pool - a pool to use for error messages (if any). 00213 * @param handle - the db connection 00214 * @param trans - ptr to a transaction. May be null on entry 00215 * @return 0 for success or error code 00216 * @remarks Note that transaction modes, set by calling 00217 * apr_dbd_transaction_mode_set(), will affect all query/select calls within 00218 * a transaction. By default, any error in query/select during a transaction 00219 * will cause the transaction to inherit the error code and any further 00220 * query/select calls will fail immediately. Put transaction in "ignore 00221 * errors" mode to avoid that. Use "rollback" mode to do explicit rollback. 00222 */ 00223 APU_DECLARE(int) apr_dbd_transaction_start(const apr_dbd_driver_t *driver, 00224 apr_pool_t *pool, 00225 apr_dbd_t *handle, 00226 apr_dbd_transaction_t **trans); 00227 00228 /** apr_dbd_transaction_end: end a transaction 00229 * (commit on success, rollback on error). 00230 * May be a no-op. 00231 * 00232 * @param driver - the driver 00233 * @param handle - the db connection 00234 * @param trans - the transaction. 00235 * @return 0 for success or error code 00236 */ 00237 APU_DECLARE(int) apr_dbd_transaction_end(const apr_dbd_driver_t *driver, 00238 apr_pool_t *pool, 00239 apr_dbd_transaction_t *trans); 00240 00241 #define APR_DBD_TRANSACTION_COMMIT 0x00 /**< commit the transaction */ 00242 #define APR_DBD_TRANSACTION_ROLLBACK 0x01 /**< rollback the transaction */ 00243 #define APR_DBD_TRANSACTION_IGNORE_ERRORS 0x02 /**< ignore transaction errors */ 00244 00245 /** apr_dbd_transaction_mode_get: get the mode of transaction 00246 * 00247 * @param driver - the driver 00248 * @param trans - the transaction 00249 * @return mode of transaction 00250 */ 00251 APU_DECLARE(int) apr_dbd_transaction_mode_get(const apr_dbd_driver_t *driver, 00252 apr_dbd_transaction_t *trans); 00253 00254 /** apr_dbd_transaction_mode_set: set the mode of transaction 00255 * 00256 * @param driver - the driver 00257 * @param trans - the transaction 00258 * @param mode - new mode of the transaction 00259 * @return the mode of transaction in force after the call 00260 */ 00261 APU_DECLARE(int) apr_dbd_transaction_mode_set(const apr_dbd_driver_t *driver, 00262 apr_dbd_transaction_t *trans, 00263 int mode); 00264 00265 /** apr_dbd_query: execute an SQL query that doesn't return a result set 00266 * 00267 * @param driver - the driver 00268 * @param handle - the connection 00269 * @param nrows - number of rows affected. 00270 * @param statement - the SQL statement to execute 00271 * @return 0 for success or error code 00272 */ 00273 APU_DECLARE(int) apr_dbd_query(const apr_dbd_driver_t *driver, apr_dbd_t *handle, 00274 int *nrows, const char *statement); 00275 00276 /** apr_dbd_select: execute an SQL query that returns a result set 00277 * 00278 * @param driver - the driver 00279 * @param pool - pool to allocate the result set 00280 * @param handle - the connection 00281 * @param res - pointer to result set pointer. May point to NULL on entry 00282 * @param statement - the SQL statement to execute 00283 * @param random - 1 to support random access to results (seek any row); 00284 * 0 to support only looping through results in order 00285 * (async access - faster) 00286 * @return 0 for success or error code 00287 */ 00288 APU_DECLARE(int) apr_dbd_select(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00289 apr_dbd_t *handle, apr_dbd_results_t **res, 00290 const char *statement, int random); 00291 00292 /** apr_dbd_num_cols: get the number of columns in a results set 00293 * 00294 * @param driver - the driver 00295 * @param res - result set. 00296 * @return number of columns 00297 */ 00298 APU_DECLARE(int) apr_dbd_num_cols(const apr_dbd_driver_t *driver, 00299 apr_dbd_results_t *res); 00300 00301 /** apr_dbd_num_tuples: get the number of rows in a results set 00302 * of a synchronous select 00303 * 00304 * @param driver - the driver 00305 * @param res - result set. 00306 * @return number of rows, or -1 if the results are asynchronous 00307 */ 00308 APU_DECLARE(int) apr_dbd_num_tuples(const apr_dbd_driver_t *driver, 00309 apr_dbd_results_t *res); 00310 00311 /** apr_dbd_get_row: get a row from a result set 00312 * 00313 * @param driver - the driver 00314 * @param pool - pool to allocate the row 00315 * @param res - result set pointer 00316 * @param row - pointer to row pointer. May point to NULL on entry 00317 * @param rownum - row number (counting from 1), or -1 for "next row". 00318 * Ignored if random access is not supported. 00319 * @return 0 for success, -1 for rownum out of range or data finished 00320 */ 00321 APU_DECLARE(int) apr_dbd_get_row(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00322 apr_dbd_results_t *res, apr_dbd_row_t **row, 00323 int rownum); 00324 00325 /** apr_dbd_get_entry: get an entry from a row 00326 * 00327 * @param driver - the driver 00328 * @param row - row pointer 00329 * @param col - entry number 00330 * @return value from the row, or NULL if col is out of bounds. 00331 */ 00332 APU_DECLARE(const char*) apr_dbd_get_entry(const apr_dbd_driver_t *driver, 00333 apr_dbd_row_t *row, int col); 00334 00335 /** apr_dbd_get_name: get an entry name from a result set 00336 * 00337 * @param driver - the driver 00338 * @param res - result set pointer 00339 * @param col - entry number 00340 * @return name of the entry, or NULL if col is out of bounds. 00341 */ 00342 APU_DECLARE(const char*) apr_dbd_get_name(const apr_dbd_driver_t *driver, 00343 apr_dbd_results_t *res, int col); 00344 00345 00346 /** apr_dbd_error: get current error message (if any) 00347 * 00348 * @param driver - the driver 00349 * @param handle - the connection 00350 * @param errnum - error code from operation that returned an error 00351 * @return the database current error message, or message for errnum 00352 * (implementation-dependent whether errnum is ignored) 00353 */ 00354 APU_DECLARE(const char*) apr_dbd_error(const apr_dbd_driver_t *driver, 00355 apr_dbd_t *handle, int errnum); 00356 00357 /** apr_dbd_escape: escape a string so it is safe for use in query/select 00358 * 00359 * @param driver - the driver 00360 * @param pool - pool to alloc the result from 00361 * @param string - the string to escape 00362 * @param handle - the connection 00363 * @return the escaped, safe string 00364 */ 00365 APU_DECLARE(const char*) apr_dbd_escape(const apr_dbd_driver_t *driver, 00366 apr_pool_t *pool, const char *string, 00367 apr_dbd_t *handle); 00368 00369 /** apr_dbd_prepare: prepare a statement 00370 * 00371 * @param driver - the driver 00372 * @param pool - pool to alloc the result from 00373 * @param handle - the connection 00374 * @param query - the SQL query 00375 * @param label - A label for the prepared statement. 00376 * use NULL for temporary prepared statements 00377 * (eg within a Request in httpd) 00378 * @param statement - statement to prepare. May point to null on entry. 00379 * @return 0 for success or error code 00380 * @remarks To specify parameters of the prepared query, use \%s, \%d etc. 00381 * (see below for full list) in place of database specific parameter syntax 00382 * (e.g. for PostgreSQL, this would be $1, $2, for SQLite3 this would be ? 00383 * etc.). For instance: "SELECT name FROM customers WHERE name=%s" would be 00384 * a query that this function understands. 00385 * @remarks Here is the full list of format specifiers that this function 00386 * understands and what they map to in SQL: \%hhd (TINY INT), \%hhu (UNSIGNED 00387 * TINY INT), \%hd (SHORT), \%hu (UNSIGNED SHORT), \%d (INT), \%u (UNSIGNED 00388 * INT), \%ld (LONG), \%lu (UNSIGNED LONG), \%lld (LONG LONG), \%llu 00389 * (UNSIGNED LONG LONG), \%f (FLOAT, REAL), \%lf (DOUBLE PRECISION), \%s 00390 * (VARCHAR), \%pDt (TEXT), \%pDi (TIME), \%pDd (DATE), \%pDa (DATETIME), 00391 * \%pDs (TIMESTAMP), \%pDz (TIMESTAMP WITH TIME ZONE), \%pDb (BLOB), \%pDc 00392 * (CLOB) and \%pDn (NULL). Not all databases have support for all these 00393 * types, so the underlying driver will attempt the "best match" where 00394 * possible. A \% followed by any letter not in the above list will be 00395 * interpreted as VARCHAR (i.e. \%s). 00396 */ 00397 APU_DECLARE(int) apr_dbd_prepare(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00398 apr_dbd_t *handle, const char *query, 00399 const char *label, 00400 apr_dbd_prepared_t **statement); 00401 00402 00403 /** apr_dbd_pquery: query using a prepared statement + args 00404 * 00405 * @param driver - the driver 00406 * @param pool - working pool 00407 * @param handle - the connection 00408 * @param nrows - number of rows affected. 00409 * @param statement - the prepared statement to execute 00410 * @param nargs - ignored (for backward compatibility only) 00411 * @param args - args to prepared statement 00412 * @return 0 for success or error code 00413 */ 00414 APU_DECLARE(int) apr_dbd_pquery(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00415 apr_dbd_t *handle, int *nrows, 00416 apr_dbd_prepared_t *statement, int nargs, 00417 const char **args); 00418 00419 /** apr_dbd_pselect: select using a prepared statement + args 00420 * 00421 * @param driver - the driver 00422 * @param pool - working pool 00423 * @param handle - the connection 00424 * @param res - pointer to query results. May point to NULL on entry 00425 * @param statement - the prepared statement to execute 00426 * @param random - Whether to support random-access to results 00427 * @param nargs - ignored (for backward compatibility only) 00428 * @param args - args to prepared statement 00429 * @return 0 for success or error code 00430 */ 00431 APU_DECLARE(int) apr_dbd_pselect(const apr_dbd_driver_t *driver, apr_pool_t *pool, 00432 apr_dbd_t *handle, apr_dbd_results_t **res, 00433 apr_dbd_prepared_t *statement, int random, 00434 int nargs, const char **args); 00435 00436 /** apr_dbd_pvquery: query using a prepared statement + args 00437 * 00438 * @param driver - the driver 00439 * @param pool - working pool 00440 * @param handle - the connection 00441 * @param nrows - number of rows affected. 00442 * @param statement - the prepared statement to execute 00443 * @param ... - varargs list 00444 * @return 0 for success or error code 00445 */ 00446 APU_DECLARE_NONSTD(int) apr_dbd_pvquery(const apr_dbd_driver_t *driver, 00447 apr_pool_t *pool, 00448 apr_dbd_t *handle, int *nrows, 00449 apr_dbd_prepared_t *statement, ...); 00450 00451 /** apr_dbd_pvselect: select using a prepared statement + args 00452 * 00453 * @param driver - the driver 00454 * @param pool - working pool 00455 * @param handle - the connection 00456 * @param res - pointer to query results. May point to NULL on entry 00457 * @param statement - the prepared statement to execute 00458 * @param random - Whether to support random-access to results 00459 * @param ... - varargs list 00460 * @return 0 for success or error code 00461 */ 00462 APU_DECLARE_NONSTD(int) apr_dbd_pvselect(const apr_dbd_driver_t *driver, 00463 apr_pool_t *pool, apr_dbd_t *handle, 00464 apr_dbd_results_t **res, 00465 apr_dbd_prepared_t *statement, 00466 int random, ...); 00467 00468 /** apr_dbd_pbquery: query using a prepared statement + binary args 00469 * 00470 * @param driver - the driver 00471 * @param pool - working pool 00472 * @param handle - the connection 00473 * @param nrows - number of rows affected. 00474 * @param statement - the prepared statement to execute 00475 * @param args - binary args to prepared statement 00476 * @return 0 for success or error code 00477 */ 00478 APU_DECLARE(int) apr_dbd_pbquery(const apr_dbd_driver_t *driver, 00479 apr_pool_t *pool, apr_dbd_t *handle, 00480 int *nrows, apr_dbd_prepared_t *statement, 00481 const void **args); 00482 00483 /** apr_dbd_pbselect: select using a prepared statement + binary args 00484 * 00485 * @param driver - the driver 00486 * @param pool - working pool 00487 * @param handle - the connection 00488 * @param res - pointer to query results. May point to NULL on entry 00489 * @param statement - the prepared statement to execute 00490 * @param random - Whether to support random-access to results 00491 * @param args - binary args to prepared statement 00492 * @return 0 for success or error code 00493 */ 00494 APU_DECLARE(int) apr_dbd_pbselect(const apr_dbd_driver_t *driver, 00495 apr_pool_t *pool, 00496 apr_dbd_t *handle, apr_dbd_results_t **res, 00497 apr_dbd_prepared_t *statement, int random, 00498 const void **args); 00499 00500 /** apr_dbd_pvbquery: query using a prepared statement + binary args 00501 * 00502 * @param driver - the driver 00503 * @param pool - working pool 00504 * @param handle - the connection 00505 * @param nrows - number of rows affected. 00506 * @param statement - the prepared statement to execute 00507 * @param ... - varargs list of binary args 00508 * @return 0 for success or error code 00509 */ 00510 APU_DECLARE_NONSTD(int) apr_dbd_pvbquery(const apr_dbd_driver_t *driver, 00511 apr_pool_t *pool, 00512 apr_dbd_t *handle, int *nrows, 00513 apr_dbd_prepared_t *statement, ...); 00514 00515 /** apr_dbd_pvbselect: select using a prepared statement + binary args 00516 * 00517 * @param driver - the driver 00518 * @param pool - working pool 00519 * @param handle - the connection 00520 * @param res - pointer to query results. May point to NULL on entry 00521 * @param statement - the prepared statement to execute 00522 * @param random - Whether to support random-access to results 00523 * @param ... - varargs list of binary args 00524 * @return 0 for success or error code 00525 */ 00526 APU_DECLARE_NONSTD(int) apr_dbd_pvbselect(const apr_dbd_driver_t *driver, 00527 apr_pool_t *pool, apr_dbd_t *handle, 00528 apr_dbd_results_t **res, 00529 apr_dbd_prepared_t *statement, 00530 int random, ...); 00531 00532 /** apr_dbd_datum_get: get a binary entry from a row 00533 * 00534 * @param driver - the driver 00535 * @param row - row pointer 00536 * @param col - entry number 00537 * @param type - type of data to get 00538 * @param data - pointer to data, allocated by the caller 00539 * @return APR_SUCCESS on success, APR_ENOENT if data is NULL or APR_EGENERAL 00540 */ 00541 APU_DECLARE(apr_status_t) apr_dbd_datum_get(const apr_dbd_driver_t *driver, 00542 apr_dbd_row_t *row, int col, 00543 apr_dbd_type_e type, void *data); 00544 00545 /** @} */ 00546 00547 #ifdef __cplusplus 00548 } 00549 #endif 00550 00551 #endif