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:
@@ -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 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)
|
static request_rec *ap_lua_check_request_rec(lua_State *L, int index)
|
||||||
{
|
{
|
||||||
request_rec *r;
|
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_db_handle* db;
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
luaL_register(L, NULL, lua_db_methods);
|
|
||||||
db = lua_newuserdata(L, sizeof(lua_db_handle));
|
db = lua_newuserdata(L, sizeof(lua_db_handle));
|
||||||
db->alive = 1;
|
db->alive = 1;
|
||||||
db->pool = pool;
|
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_rawset(L, -3);
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
lua_rawseti(L, -2, 0);
|
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;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
dbacquire(dbType, dbString): Opens a new connection to a database of type
|
dbacquire(dbType, dbString): Opens a new connection to a database of type
|
||||||
|
@@ -61,16 +61,5 @@ AP_LUA_DECLARE(int) lua_db_prepare(lua_State* L);
|
|||||||
AP_LUA_DECLARE(int) lua_db_prepared(lua_State* L);
|
AP_LUA_DECLARE(int) lua_db_prepared(lua_State* L);
|
||||||
AP_LUA_DECLARE(int) lua_db_acquire(lua_State* L);
|
AP_LUA_DECLARE(int) lua_db_acquire(lua_State* L);
|
||||||
|
|
||||||
static const luaL_reg lua_db_methods[] =
|
|
||||||
{
|
|
||||||
{ "escape", lua_db_escape },
|
|
||||||
{ "close", lua_db_close },
|
|
||||||
{ "select", lua_db_select },
|
|
||||||
{ "query", lua_db_query },
|
|
||||||
{ "active", lua_db_active },
|
|
||||||
{ "prepare", lua_db_prepare },
|
|
||||||
{ "prepared", lua_db_prepared },
|
|
||||||
{ 0, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* !_LUA_DBD_H_ */
|
#endif /* !_LUA_DBD_H_ */
|
||||||
|
Reference in New Issue
Block a user