1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-07 04:02:58 +03:00

CodeWarrior workaround for lua_dbd

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1431236 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Gruno
2013-01-10 09:47:30 +00:00
parent fdce7c3307
commit e582addb58
2 changed files with 31 additions and 12 deletions

View File

@@ -24,6 +24,8 @@ static APR_OPTIONAL_FN_TYPE(ap_dbd_close) *lua_ap_dbd_close = NULL;
static APR_OPTIONAL_FN_TYPE(ap_dbd_open) *lua_ap_dbd_open = NULL;
static request_rec *ap_lua_check_request_rec(lua_State *L, int index)
{
request_rec *r;
@@ -649,7 +651,6 @@ static lua_db_handle* lua_push_db_handle(lua_State *L, request_rec* r, int type,
{
lua_db_handle* db;
lua_newtable(L);
luaL_register(L, NULL, lua_db_methods);
db = lua_newuserdata(L, sizeof(lua_db_handle));
db->alive = 1;
db->pool = pool;
@@ -662,8 +663,37 @@ static lua_db_handle* lua_push_db_handle(lua_State *L, request_rec* r, int type,
lua_rawset(L, -3);
lua_setmetatable(L, -2);
lua_rawseti(L, -2, 0);
lua_pushliteral(L, "escape");
lua_pushcfunction(L, lua_db_escape);
lua_rawset(L, -3);
lua_pushliteral(L, "close");
lua_pushcfunction(L, lua_db_close);
lua_rawset(L, -3);
lua_pushliteral(L, "select");
lua_pushcfunction(L, lua_db_select);
lua_rawset(L, -3);
lua_pushliteral(L, "query");
lua_pushcfunction(L, lua_db_query);
lua_rawset(L, -3);
lua_pushliteral(L, "active");
lua_pushcfunction(L, lua_db_active);
lua_rawset(L, -3);
lua_pushliteral(L, "prepare");
lua_pushcfunction(L, lua_db_prepare);
lua_rawset(L, -3);
lua_pushliteral(L, "prepared");
lua_pushcfunction(L, lua_db_prepared);
lua_rawset(L, -3);
return db;
}
/*
=============================================================================
dbacquire(dbType, dbString): Opens a new connection to a database of type