Apache HTTPD
lua_dbd.c
Go to the documentation of this file.
1
19#include "mod_lua.h"
20#include "lua_dbd.h"
21
25
26
27
28
30{
32 luaL_checkudata(L, index, "Apache2.Request");
33 r = lua_unboxpointer(L, index);
34 return r;
35}
36
38{
40 lua_rawgeti(L, 1, 0);
42 return (lua_db_handle *) lua_topointer(L, -1);
43}
44
52
53
54/*
55 =============================================================================
56 db:close(): Closes an open database connection.
57 =============================================================================
58 */
60{
61 /*~~~~~~~~~~~~~~~~~~~~*/
62 lua_db_handle *db;
63 apr_status_t rc = 0;
64 /*~~~~~~~~~~~~~~~~~~~~*/
65
66 db = lua_get_db_handle(L);
67 if (db && db->alive) {
68 if (db->type == LUA_DBTYPE_APR_DBD) {
69 rc = apr_dbd_close(db->driver, db->handle);
70 if (db->pool) apr_pool_destroy(db->pool);
71 }
72 else {
75 if (db->dbdhandle) lua_ap_dbd_close(db->server, db->dbdhandle);
76 }
77
78 db->driver = NULL;
79 db->handle = NULL;
80 db->alive = 0;
81 db->pool = NULL;
82 }
83
84 lua_settop(L, 0);
86 return 1;
87}
88
89/*
90 =============================================================================
91 db:__gc(): Garbage collecting function.
92 =============================================================================
93 */
95{
96 /*~~~~~~~~~~~~~~~~*/
97 lua_db_handle *db;
98 /*~~~~~~~~~~~~~~~~~~~~*/
99
100 db = lua_touserdata(L, 1);
101 if (db && db->alive) {
102 if (db->type == LUA_DBTYPE_APR_DBD) {
103 apr_dbd_close(db->driver, db->handle);
104 if (db->pool) apr_pool_destroy(db->pool);
105 }
106 else {
108 if (lua_ap_dbd_close != NULL)
109 if (db->dbdhandle) lua_ap_dbd_close(db->server, db->dbdhandle);
110 }
111 db->driver = NULL;
112 db->handle = NULL;
113 db->alive = 0;
114 db->pool = NULL;
115 }
116 lua_settop(L, 0);
117 return 0;
118}
119
120/*
121 =============================================================================
122 db:active(): Returns true if the connection to the db is still active.
123 =============================================================================
124 */
126{
127 /*~~~~~~~~~~~~~~~~~~~~*/
128 lua_db_handle *db = 0;
129 apr_status_t rc = 0;
130 /*~~~~~~~~~~~~~~~~~~~~*/
131
132 db = lua_get_db_handle(L);
133 if (db && db->alive) {
134 rc = apr_dbd_check_conn(db->driver, db->pool, db->handle);
135 if (rc == APR_SUCCESS) {
136 lua_pushboolean(L, 1);
137 return 1;
138 }
139 }
140
141 lua_pushboolean(L, 0);
142 return 1;
143}
144
145/*
146 =============================================================================
147 db:query(statement): Executes the given database query and returns the
148 number of rows affected. If an error is encountered, returns nil as the
149 first parameter and the error message as the second.
150 =============================================================================
151 */
153{
154 /*~~~~~~~~~~~~~~~~~~~~~~~*/
155 lua_db_handle *db = 0;
156 apr_status_t rc = 0;
157 int x = 0;
158 const char *statement;
159 /*~~~~~~~~~~~~~~~~~~~~~~~*/
161 statement = lua_tostring(L, 3);
162 db = lua_get_db_handle(L);
163 if (db && db->alive)
164 rc = apr_dbd_query(db->driver, db->handle, &x, statement);
165 else {
166 rc = 0;
167 x = -1;
168 }
169
170 if (rc == APR_SUCCESS)
171 lua_pushnumber(L, x);
172 else {
173
174 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
175 const char *err = apr_dbd_error(db->driver, db->handle, rc);
176 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
177
178 lua_pushnil(L);
179 if (err) {
181 return 2;
182 }
183 }
184
185 return 1;
186}
187
188/*
189 =============================================================================
190 db:escape(string): Escapes a string for safe use in the given database type.
191 =============================================================================
192 */
194{
195 /*~~~~~~~~~~~~~~~~~~~~~*/
196 lua_db_handle *db = 0;
197 const char *statement;
198 const char *escaped = 0;
199 request_rec *r;
200 /*~~~~~~~~~~~~~~~~~~~~~*/
201
203 if (r) {
205 statement = lua_tostring(L, 3);
206 db = lua_get_db_handle(L);
207 if (db && db->alive) {
210 db->handle);
211 if (escaped) {
213 return 1;
214 }
215 }
216 else {
217 lua_pushnil(L);
218 }
219 return (1);
220 }
221
222 return 0;
223}
224
225/*
226 =============================================================================
227 resultset(N): Fetches one or more rows from a result set.
228 =============================================================================
229 */
231{
232 int row_no,x,alpha = 0;
233 const char *entry, *rowname;
234 apr_dbd_row_t *row = 0;
236
237 row_no = luaL_optinteger(L, 2, 0);
238 if (lua_isboolean(L, 3)) {
239 alpha = lua_toboolean(L, 3);
240 }
241 lua_settop(L,0);
242
243 /* Fetch all rows at once? */
244
245 if (row_no == 0) {
246 row_no = 1;
247 lua_newtable(L);
248 while (apr_dbd_get_row(res->driver, res->pool, res->results,
249 &row, -1) != -1)
250 {
252 lua_newtable(L);
253 for (x = 0; x < res->cols; x++) {
254 entry = apr_dbd_get_entry(res->driver, row, x);
255 if (entry) {
256 if (alpha == 1) {
257 rowname = apr_dbd_get_name(res->driver,
258 res->results, x);
259 lua_pushstring(L, rowname ? rowname : "(oob)");
260 }
261 else {
262 lua_pushinteger(L, x + 1);
263 }
264 lua_pushstring(L, entry);
265 lua_rawset(L, -3);
266 }
267 }
268 lua_rawset(L, -3);
269 row_no++;
270 }
271 return 1;
272 }
273
274 /* Just fetch a single row */
275 if (apr_dbd_get_row(res->driver, res->pool, res->results,
276 &row, row_no) != -1)
277 {
278
279 lua_newtable(L);
280 for (x = 0; x < res->cols; x++) {
281 entry = apr_dbd_get_entry(res->driver, row, x);
282 if (entry) {
283 if (alpha == 1) {
284 rowname = apr_dbd_get_name(res->driver,
285 res->results, x);
286 lua_pushstring(L, rowname ? rowname : "(oob)");
287 }
288 else {
289 lua_pushinteger(L, x + 1);
290 }
291 lua_pushstring(L, entry);
292 lua_rawset(L, -3);
293 }
294 }
295 return 1;
296 }
297 return 0;
298}
299
300
301/*
302 =============================================================================
303 db:select(statement): Queries the database for the given statement and
304 returns the rows/columns found as a table. If an error is encountered,
305 returns nil as the first parameter and the error message as the second.
306 =============================================================================
307 */
309{
310 /*~~~~~~~~~~~~~~~~~~~~~~~*/
311 lua_db_handle *db = 0;
312 apr_status_t rc = 0;
313 const char *statement;
314 request_rec *r;
315 /*~~~~~~~~~~~~~~~~~~~~~~~*/
317 if (r) {
319 statement = lua_tostring(L, 3);
320 db = lua_get_db_handle(L);
321 if (db && db->alive) {
322
323 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
324 int cols;
325 apr_dbd_results_t *results = 0;
327 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
328
329 rc = apr_dbd_select(db->driver, db->pool, db->handle,
330 &results, statement, 0);
331 if (rc == APR_SUCCESS) {
332
333 cols = apr_dbd_num_cols(db->driver, results);
334
335 if (cols > 0) {
336 lua_newtable(L);
338 resultset->cols = cols;
339 resultset->driver = db->driver;
340 resultset->pool = db->pool;
341 resultset->rows = apr_dbd_num_tuples(db->driver, results);
342 resultset->results = results;
343 luaL_newmetatable(L, "lua_apr.dbselect");
344 lua_pushliteral(L, "__call");
346 lua_rawset(L, -3);
347 lua_setmetatable(L, -3);
348 lua_rawseti(L, -2, 0);
349 return 1;
350 }
351 return 0;
352 }
353 else {
354
355 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
356 const char *err = apr_dbd_error(db->driver, db->handle, rc);
357 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
358
359 lua_pushnil(L);
360 if (err) {
362 return 2;
363 }
364 }
365 }
366
367 lua_pushboolean(L, 0);
368 return 1;
369 }
370
371 return 0;
372}
373
374
375
376/*
377 =============================================================================
378 statement:select(var1, var2, var3...): Injects variables into a prepared
379 statement and returns the number of rows matching the query.
380 =============================================================================
381 */
383{
384 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
386 apr_status_t rc = 0;
387 const char **vars;
388 int x, have;
389 /*~~~~~~~~~~~~~~~~~~~~~~~*/
390
391 /* Fetch the prepared statement and the vars passed */
393 lua_rawgeti(L, 1, 0);
396
397 /* Check if we got enough variables passed on to us.
398 * This, of course, only works for prepared statements made through lua. */
399 have = lua_gettop(L) - 2;
400 if (st->variables != -1 && have < st->variables ) {
401 lua_pushboolean(L, 0);
403 "Error in executing prepared statement: Expected %d arguments, got %d.",
404 st->variables, have);
405 return 2;
406 }
407 vars = apr_pcalloc(st->db->pool, have*sizeof(char *));
408 for (x = 0; x < have; x++) {
409 vars[x] = lua_tostring(L, x + 2);
410 }
411
412 /* Fire off the query */
413 if (st->db && st->db->alive) {
414
415 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
416 int cols;
417 apr_dbd_results_t *results = 0;
418 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
419
420 rc = apr_dbd_pselect(st->db->driver, st->db->pool, st->db->handle,
421 &results, st->statement, 0, have, vars);
422 if (rc == APR_SUCCESS) {
423
424 /*~~~~~~~~~~~~~~~~~~~~~*/
426 /*~~~~~~~~~~~~~~~~~~~~~*/
427
428 cols = apr_dbd_num_cols(st->db->driver, results);
429 lua_newtable(L);
431 resultset->cols = cols;
432 resultset->driver = st->db->driver;
433 resultset->pool = st->db->pool;
434 resultset->rows = apr_dbd_num_tuples(st->db->driver, results);
435 resultset->results = results;
436 luaL_newmetatable(L, "lua_apr.dbselect");
437 lua_pushliteral(L, "__call");
439 lua_rawset(L, -3);
440 lua_setmetatable(L, -3);
441 lua_rawseti(L, -2, 0);
442 return 1;
443
444 }
445 else {
446
447 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
448 const char *err = apr_dbd_error(st->db->driver, st->db->handle, rc);
449 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
450
451 lua_pushnil(L);
452 if (err) {
454 return 2;
455 }
456 return 1;
457 }
458 }
459
460 lua_pushboolean(L, 0);
462 "Database connection seems to be closed, please reacquire it.");
463 return (2);
464}
465
466
467/*
468 =============================================================================
469 statement:query(var1, var2, var3...): Injects variables into a prepared
470 statement and returns the number of rows affected.
471 =============================================================================
472 */
474{
475 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
477 apr_status_t rc = 0;
478 const char **vars;
479 int x, have;
480 /*~~~~~~~~~~~~~~~~~~~~~~~*/
481
482 /* Fetch the prepared statement and the vars passed */
484 lua_rawgeti(L, 1, 0);
487
488 /* Check if we got enough variables passed on to us.
489 * This, of course, only works for prepared statements made through lua. */
490 have = lua_gettop(L) - 2;
491 if (st->variables != -1 && have < st->variables ) {
492 lua_pushboolean(L, 0);
494 "Error in executing prepared statement: Expected %d arguments, got %d.",
495 st->variables, have);
496 return 2;
497 }
498 vars = apr_pcalloc(st->db->pool, have*sizeof(char *));
499 for (x = 0; x < have; x++) {
500 vars[x] = lua_tostring(L, x + 2);
501 }
502
503 /* Fire off the query */
504 if (st->db && st->db->alive) {
505
506 /*~~~~~~~~~~~~~~*/
507 int affected = 0;
508 /*~~~~~~~~~~~~~~*/
509
510 rc = apr_dbd_pquery(st->db->driver, st->db->pool, st->db->handle,
511 &affected, st->statement, have, vars);
512 if (rc == APR_SUCCESS) {
514 return 1;
515 }
516 else {
517
518 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
519 const char *err = apr_dbd_error(st->db->driver, st->db->handle, rc);
520 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
521
522 lua_pushnil(L);
523 if (err) {
525 return 2;
526 }
527 return 1;
528 }
529 }
530
531 lua_pushboolean(L, 0);
533 "Database connection seems to be closed, please reacquire it.");
534 return (2);
535}
536
537/*
538 =============================================================================
539 db:prepare(statement): Prepares a statement for later query/select.
540 Returns a table with a :query and :select function, same as the db funcs.
541 =============================================================================
542 */
544{
545 /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/
546 lua_db_handle *db = 0;
547 apr_status_t rc = 0;
548 const char *statement, *at;
549 request_rec *r;
551 int need = 0;
552 /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/
553
555 if (r) {
558 statement = lua_tostring(L, 3);
559
560 /* Count number of variables in statement */
561 at = ap_strchr_c(statement,'%');
562 while (at != NULL) {
563 if (at[1] == '%') {
564 at++;
565 }
566 else {
567 need++;
568 }
569 at = ap_strchr_c(at+1,'%');
570 }
571
572
573 db = lua_get_db_handle(L);
575 NULL, &pstatement);
576 if (rc != APR_SUCCESS) {
577 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
578 const char *err = apr_dbd_error(db->driver, db->handle, rc);
579 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
580
581 lua_pushnil(L);
582 if (err) {
584 return 2;
585 }
586 return 1;
587 }
588
589 /* Push the prepared statement table */
590 lua_newtable(L);
592 st->statement = pstatement;
593 st->variables = need;
594 st->db = db;
595
596 lua_pushliteral(L, "select");
598 lua_rawset(L, -4);
599 lua_pushliteral(L, "query");
601 lua_rawset(L, -4);
602 lua_rawseti(L, -2, 0);
603 return 1;
604 }
605 return 0;
606}
607
608
609
610/*
611 =============================================================================
612 db:prepared(statement): Fetches a prepared statement made through
613 DBDPrepareSQL.
614 =============================================================================
615 */
617{
618 /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/
619 lua_db_handle *db = 0;
620 const char *tag;
621 request_rec *r;
623 /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/
624
626 if (r) {
628 db = lua_get_db_handle(L);
630 tag = lua_tostring(L, 3);
631
632 /* Look for the statement */
635
636 if (pstatement == NULL) {
637 lua_pushnil(L);
639 "Could not find any prepared statement called %s!", tag);
640 return 2;
641 }
642
643
644 /* Push the prepared statement table */
645 lua_newtable(L);
647 st->statement = pstatement;
648 st->variables = -1; /* we don't know :( */
649 st->db = db;
650 lua_pushliteral(L, "select");
652 lua_rawset(L, -4);
653 lua_pushliteral(L, "query");
655 lua_rawset(L, -4);
656 lua_rawseti(L, -2, 0);
657 return 1;
658 }
659 return 0;
660}
661
662
663
664/* lua_push_db_handle: Creates a database table object with database functions
665 and a userdata at index 0, which will call lua_dbgc when garbage collected.
666 */
669{
670 lua_db_handle* db;
671 lua_newtable(L);
672 db = lua_newuserdata(L, sizeof(lua_db_handle));
673 db->alive = 1;
674 db->pool = pool;
675 db->type = type;
676 db->dbdhandle = 0;
677 db->server = r->server;
678 luaL_newmetatable(L, "lua_apr.dbacquire");
679 lua_pushliteral(L, "__gc");
681 lua_rawset(L, -3);
682 lua_setmetatable(L, -2);
683 lua_rawseti(L, -2, 0);
684
685 lua_pushliteral(L, "escape");
687 lua_rawset(L, -3);
688
689 lua_pushliteral(L, "close");
691 lua_rawset(L, -3);
692
693 lua_pushliteral(L, "select");
695 lua_rawset(L, -3);
696
697 lua_pushliteral(L, "query");
699 lua_rawset(L, -3);
700
701 lua_pushliteral(L, "active");
703 lua_rawset(L, -3);
704
705 lua_pushliteral(L, "prepare");
707 lua_rawset(L, -3);
708
709 lua_pushliteral(L, "prepared");
711 lua_rawset(L, -3);
712 return db;
713}
714
715/*
716 =============================================================================
717 dbacquire(dbType, dbString): Opens a new connection to a database of type
718 _dbType_ and with the connection parameters _dbString_. If successful,
719 returns a table with functions for using the database handle. If an error
720 occurs, returns nil as the first parameter and the error message as the
721 second. See the APR_DBD for a list of database types and connection strings
722 supported.
723 =============================================================================
724 */
726{
727 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
728 const char *type;
729 const char *arguments;
730 const char *error = 0;
731 request_rec *r;
732 lua_db_handle *db = 0;
733 apr_status_t rc = 0;
734 ap_dbd_t *dbdhandle = NULL;
736 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
737
739 if (r) {
740 type = luaL_optstring(L, 2, "mod_dbd"); /* Defaults to mod_dbd */
741
742 if (!strcmp(type, "mod_dbd")) {
743
744 lua_settop(L, 0);
746 if (lua_ap_dbd_open)
747 dbdhandle = (ap_dbd_t *) lua_ap_dbd_open(
748 r->server->process->pool, r->server);
749
750 if (dbdhandle) {
751 db = lua_push_db_handle(L, r, LUA_DBTYPE_MOD_DBD, dbdhandle->pool);
752 db->driver = dbdhandle->driver;
753 db->handle = dbdhandle->handle;
754 db->dbdhandle = dbdhandle;
755 return 1;
756 }
757 else {
758 lua_pushnil(L);
759 if ( lua_ap_dbd_open == NULL )
761 "mod_dbd doesn't seem to have been loaded.");
762 else
764 L,
765 "Could not acquire connection from mod_dbd. If your database is running, this may indicate a permission problem.");
766 return 2;
767 }
768 }
769 else {
771 if (rc != APR_SUCCESS) {
772 lua_pushnil(L);
773 lua_pushliteral(L, "Could not allocate memory for database!");
774 return 2;
775 }
776 apr_pool_tag(pool, "lua_dbd_pool");
778 dbdhandle = apr_pcalloc(pool, sizeof(ap_dbd_t));
779 rc = apr_dbd_get_driver(pool, type, &dbdhandle->driver);
780 if (rc == APR_SUCCESS) {
782 arguments = lua_tostring(L, 3);
783 lua_settop(L, 0);
784
785 if (*arguments) {
786 rc = apr_dbd_open_ex(dbdhandle->driver, pool,
787 arguments, &dbdhandle->handle, &error);
788 if (rc == APR_SUCCESS) {
790 db->driver = dbdhandle->driver;
791 db->handle = dbdhandle->handle;
792 db->dbdhandle = dbdhandle;
793 return 1;
794 }
795 else {
796 lua_pushnil(L);
797 if (error) {
799 return 2;
800 }
801
802 return 1;
803 }
804 }
805
806 lua_pushnil(L);
808 "No database connection string was specified.");
810 return (2);
811 }
812 else {
813 lua_pushnil(L);
816 "driver for %s not available", type);
817 }
818 else if (APR_STATUS_IS_EDSOOPEN(rc)) {
820 "can't find driver for %s", type);
821 }
822 else if (APR_STATUS_IS_ESYMNOTFOUND(rc)) {
824 "driver for %s is invalid or corrupted",
825 type);
826 }
827 else {
829 "mod_lua not compatible with APR in get_driver");
830 }
833 return 3;
834 }
835 }
836
837 lua_pushnil(L);
838 return 1;
839 }
840
841 return 0;
842}
843
#define APLOG_USE_MODULE(foo)
request_rec * r
#define APR_STATUS_IS_ENOTIMPL(s)
Definition apr_errno.h:615
#define APR_STATUS_IS_EDSOOPEN(s)
Definition apr_errno.h:403
#define APR_STATUS_IS_ESYMNOTFOUND(s)
Definition apr_errno.h:424
apr_pool_t const char apr_dbd_t const char ** error
Definition apr_dbd.h:143
struct apr_dbd_prepared_t apr_dbd_prepared_t
Definition apr_dbd.h:87
apr_pool_t apr_dbd_t apr_dbd_results_t ** res
Definition apr_dbd.h:287
apr_dbd_t int const char * statement
Definition apr_dbd.h:272
struct apr_dbd_results_t apr_dbd_results_t
Definition apr_dbd.h:85
apr_pool_t apr_dbd_results_t apr_dbd_row_t ** row
Definition apr_dbd.h:320
struct apr_dbd_row_t apr_dbd_row_t
Definition apr_dbd.h:86
#define APR_RETRIEVE_OPTIONAL_FN(name)
#define APR_OPTIONAL_FN_TYPE(name)
apr_redis_t * rc
Definition apr_redis.h:173
ap_dbd_t * ap_dbd_open(apr_pool_t *pool, server_rec *s)
Definition mod_dbd.c:793
void ap_dbd_close(server_rec *s, ap_dbd_t *rec)
Definition mod_dbd.c:755
#define ap_strchr_c(s, c)
Definition httpd.h:2353
apr_size_t size
const char int apr_pool_t * pool
Definition apr_cstr.h:84
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
int type
#define APR_HASH_KEY_STRING
Definition apr_hash.h:47
#define apr_pool_create(newpool, parent)
Definition apr_pools.h:322
#define apr_pcalloc(p, size)
Definition apr_pools.h:465
apr_int32_t apr_int32_t apr_int32_t err
static lua_db_result_set * lua_get_result_set(lua_State *L)
Definition lua_dbd.c:45
int lua_db_select(lua_State *L)
Definition lua_dbd.c:308
int lua_db_active(lua_State *L)
Definition lua_dbd.c:125
int lua_db_prepared(lua_State *L)
Definition lua_dbd.c:616
static apr_OFN_ap_dbd_close_t * lua_ap_dbd_close
Definition lua_dbd.c:23
int lua_db_prepared_select(lua_State *L)
Definition lua_dbd.c:382
static lua_db_handle * lua_get_db_handle(lua_State *L)
Definition lua_dbd.c:37
int lua_db_query(lua_State *L)
Definition lua_dbd.c:152
int lua_db_get_row(lua_State *L)
Definition lua_dbd.c:230
int lua_db_escape(lua_State *L)
Definition lua_dbd.c:193
int lua_db_acquire(lua_State *L)
Definition lua_dbd.c:725
int lua_db_prepared_query(lua_State *L)
Definition lua_dbd.c:473
int lua_db_close(lua_State *L)
Definition lua_dbd.c:59
static request_rec * ap_lua_check_request_rec(lua_State *L, int index)
Definition lua_dbd.c:29
static lua_db_handle * lua_push_db_handle(lua_State *L, request_rec *r, int type, apr_pool_t *pool)
Definition lua_dbd.c:667
int lua_db_prepare(lua_State *L)
Definition lua_dbd.c:543
int lua_db_gc(lua_State *L)
Definition lua_dbd.c:94
static apr_OFN_ap_dbd_open_t * lua_ap_dbd_open
Definition lua_dbd.c:24
#define LUA_DBTYPE_MOD_DBD
Definition lua_dbd.h:27
#define LUA_DBTYPE_APR_DBD
Definition lua_dbd.h:26
return NULL
Definition mod_so.c:359
apr_pool_t * pool
Definition mod_dbd.h:80
const apr_dbd_driver_t * driver
Definition mod_dbd.h:78
apr_hash_t * prepared
Definition mod_dbd.h:79
apr_dbd_t * handle
Definition mod_dbd.h:77
server_rec * server
Definition lua_dbd.h:36
apr_pool_t * pool
Definition lua_dbd.h:33
const apr_dbd_driver_t * driver
Definition lua_dbd.h:31
ap_dbd_t * dbdhandle
Definition lua_dbd.h:35
apr_dbd_t * handle
Definition lua_dbd.h:30
apr_pool_t * pool
Definition httpd.h:831
A structure that represents the current request.
Definition httpd.h:845
apr_pool_t * pool
Definition httpd.h:847
server_rec * server
Definition httpd.h:851
process_rec * process
Definition httpd.h:1324