You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by hu...@apache.org on 2013/01/10 10:47:30 UTC

svn commit: r1431236 - in /httpd/httpd/trunk/modules/lua: lua_dbd.c lua_dbd.h

Author: humbedooh
Date: Thu Jan 10 09:47:30 2013
New Revision: 1431236

URL: http://svn.apache.org/viewvc?rev=1431236&view=rev
Log:
CodeWarrior workaround for lua_dbd

Modified:
    httpd/httpd/trunk/modules/lua/lua_dbd.c
    httpd/httpd/trunk/modules/lua/lua_dbd.h

Modified: httpd/httpd/trunk/modules/lua/lua_dbd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_dbd.c?rev=1431236&r1=1431235&r2=1431236&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_dbd.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_dbd.c Thu Jan 10 09:47:30 2013
@@ -24,6 +24,8 @@ static APR_OPTIONAL_FN_TYPE(ap_dbd_close
 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_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_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 

Modified: httpd/httpd/trunk/modules/lua/lua_dbd.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_dbd.h?rev=1431236&r1=1431235&r2=1431236&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_dbd.h (original)
+++ httpd/httpd/trunk/modules/lua/lua_dbd.h Thu Jan 10 09:47:30 2013
@@ -61,16 +61,5 @@ AP_LUA_DECLARE(int) lua_db_prepare(lua_S
 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_ */