]> granicus.if.org Git - apache/commitdiff
CodeWarrior workaround for lua_dbd
authorDaniel Gruno <humbedooh@apache.org>
Thu, 10 Jan 2013 09:47:30 +0000 (09:47 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Thu, 10 Jan 2013 09:47:30 +0000 (09:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1431236 13f79535-47bb-0310-9956-ffa450edef68

modules/lua/lua_dbd.c
modules/lua/lua_dbd.h

index 4be9c4710be00231ae61cf74f0f91de3ef610d83..61ccac5a9b4635f8293c191dad21bbdbebca56d9 100644 (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 
index 98cf914a842cd449eb37351fe7471298f6ad3732..4c647cc3a5e96a6322c4b26774903eeed14d370a 100644 (file)
@@ -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_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_ */