lua_dbd.c revision 015abdecb07fcacc69ac02c4c2519f7977889101
47feede6777f217fb2e2dff71635da04898e0077nd * Licensed to the Apache Software Foundation (ASF) under one or more
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * contributor license agreements. See the NOTICE file distributed with
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * this work for additional information regarding copyright ownership.
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd * The ASF licenses this file to You under the Apache License, Version 2.0
47feede6777f217fb2e2dff71635da04898e0077nd * (the "License"); you may not use this file except in compliance with
47feede6777f217fb2e2dff71635da04898e0077nd * the License. You may obtain a copy of the License at
47feede6777f217fb2e2dff71635da04898e0077nd * Unless required by applicable law or agreed to in writing, software
47feede6777f217fb2e2dff71635da04898e0077nd * distributed under the License is distributed on an "AS IS" BASIS,
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2e545ce2450a9953665f701bb05350f0d3f26275nd * See the License for the specific language governing permissions and
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * limitations under the License.
47feede6777f217fb2e2dff71635da04898e0077ndstatic APR_OPTIONAL_FN_TYPE(ap_dbd_close) *lua_ap_dbd_close = NULL;
47feede6777f217fb2e2dff71635da04898e0077ndstatic APR_OPTIONAL_FN_TYPE(ap_dbd_open) *lua_ap_dbd_open = NULL;
b43f840409794ed298e8634f6284741f193b6c4ftakashistatic request_rec *ap_lua_check_request_rec(lua_State *L, int index)
707c2713ba8f1aa11c1f22f69d3ec73522054b9fcovenerstatic lua_db_result_set *lua_get_result_set(lua_State *L)
b43f840409794ed298e8634f6284741f193b6c4ftakashi =============================================================================
b43f840409794ed298e8634f6284741f193b6c4ftakashi db:close(): Closes an open database connection.
47feede6777f217fb2e2dff71635da04898e0077nd =============================================================================
b43f840409794ed298e8634f6284741f193b6c4ftakashi /*~~~~~~~~~~~~~~~~~~~~*/
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh /*~~~~~~~~~~~~~~~~~~~~*/
707c2713ba8f1aa11c1f22f69d3ec73522054b9fcovener lua_ap_dbd_close = APR_RETRIEVE_OPTIONAL_FN(ap_dbd_close);
b43f840409794ed298e8634f6284741f193b6c4ftakashi if (db->dbdhandle) lua_ap_dbd_close(db->server, db->dbdhandle);
b43f840409794ed298e8634f6284741f193b6c4ftakashi =============================================================================
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar db:__gc(): Garbage collecting function.
b43f840409794ed298e8634f6284741f193b6c4ftakashi =============================================================================
b43f840409794ed298e8634f6284741f193b6c4ftakashi /*~~~~~~~~~~~~~~~~*/
b43f840409794ed298e8634f6284741f193b6c4ftakashi /*~~~~~~~~~~~~~~~~~~~~*/
b43f840409794ed298e8634f6284741f193b6c4ftakashi lua_ap_dbd_close = APR_RETRIEVE_OPTIONAL_FN(ap_dbd_close);
b43f840409794ed298e8634f6284741f193b6c4ftakashi if (db->dbdhandle) lua_ap_dbd_close(db->server, db->dbdhandle);
47feede6777f217fb2e2dff71635da04898e0077nd =============================================================================
b43f840409794ed298e8634f6284741f193b6c4ftakashi db:active(): Returns true if the connection to the db is still active.
727872d18412fc021f03969b8641810d8896820bhumbedooh =============================================================================
0d0ba3a410038e179b695446bb149cce6264e0abnd /*~~~~~~~~~~~~~~~~~~~~*/
0d0ba3a410038e179b695446bb149cce6264e0abnd /*~~~~~~~~~~~~~~~~~~~~*/
0d0ba3a410038e179b695446bb149cce6264e0abnd rc = apr_dbd_check_conn(db->driver, db->pool, db->handle);
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd =============================================================================
47feede6777f217fb2e2dff71635da04898e0077nd db:query(statement): Executes the given database query and returns the
const char *statement;
rc = 0;
lua_pushnumber(L, x);
lua_pushnil(L);
if (err) {
const char *statement;
const char *escaped = 0;
request_rec *r;
if (escaped) {
lua_pushnil(L);
int row_no,x;
const char *entry;
lua_settop(L,0);
if (row_no == 0) {
lua_newtable(L);
lua_newtable(L);
if (entry) {
row_no++;
lua_newtable(L);
if (entry) {
const char *statement;
request_rec *r;
int cols;
if (cols > 0) {
lua_newtable(L);
lua_pushnil(L);
if (err) {
lua_pushboolean(L, 0);
const char **vars;
int x, have;
lua_pushboolean(L, 0);
for (x = 0; x < have; x++) {
int cols;
lua_newtable(L);
lua_pushnil(L);
if (err) {
lua_pushboolean(L, 0);
const char **vars;
int x, have;
lua_pushboolean(L, 0);
for (x = 0; x < have; x++) {
int affected = 0;
lua_pushnil(L);
if (err) {
lua_pushboolean(L, 0);
request_rec *r;
int need = 0;
at++;
need++;
lua_pushnil(L);
if (err) {
lua_newtable(L);
const char *tag;
request_rec *r;
lua_pushnil(L);
lua_newtable(L);
lua_newtable(L);
return db;
const char *type;
const char *arguments;
const char *error = 0;
request_rec *r;
lua_settop(L, 0);
if (lua_ap_dbd_open)
if (dbdhandle) {
lua_pushnil(L);
"Could not acquire connection from mod_dbd. If your database is running, this may indicate a permission problem.");
lua_pushnil(L);
lua_settop(L, 0);
lua_pushnil(L);
if (error) {
lua_pushnil(L);
lua_pushnil(L);
type);
lua_pushnil(L);