From 425df0c78389d30561a7f025a1a3e3b2fbc5e413 Mon Sep 17 00:00:00 2001 From: Leon de Rooij Date: Thu, 27 Jan 2011 14:17:49 +0100 Subject: [PATCH] Added test_reactive to mod_lua freeswitch.Dbh --- src/mod/languages/mod_lua/freeswitch.i | 1 + src/mod/languages/mod_lua/freeswitch_lua.cpp | 10 ++ src/mod/languages/mod_lua/freeswitch_lua.h | 1 + src/mod/languages/mod_lua/mod_lua_wrap.cpp | 179 +++++++++++++++++++ 4 files changed, 191 insertions(+) diff --git a/src/mod/languages/mod_lua/freeswitch.i b/src/mod/languages/mod_lua/freeswitch.i index 9ccaf8ea9f..25faa5a5df 100644 --- a/src/mod/languages/mod_lua/freeswitch.i +++ b/src/mod/languages/mod_lua/freeswitch.i @@ -89,6 +89,7 @@ class Dbh { ~Dbh(); bool release(); bool connected(); + bool test_reactive(char *test_sql, char *drop_sql = NULL, char *reactive_sql = NULL); bool query(char *sql, SWIGLUA_FN lua_fun); int affected_rows(); }; diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index 01f708d66a..b388f2e491 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -350,6 +350,16 @@ bool Dbh::connected() return m_connected; } +bool Dbh::test_reactive(char *test_sql, char *drop_sql, char *reactive_sql) +{ + if (m_connected) { + if (switch_cache_db_test_reactive(dbh, test_sql, drop_sql, reactive_sql) == SWITCH_TRUE) { + return true; + } + } + return false; +} + int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv) { SWIGLUA_FN *lua_fun = (SWIGLUA_FN *)pArg; diff --git a/src/mod/languages/mod_lua/freeswitch_lua.h b/src/mod/languages/mod_lua/freeswitch_lua.h index 5f7966266c..6411d69697 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.h +++ b/src/mod/languages/mod_lua/freeswitch_lua.h @@ -62,6 +62,7 @@ namespace LUA { ~Dbh(); bool release(); bool connected(); + bool test_reactive(char *test_sql, char *drop_sql = NULL, char *reactive_sql = NULL); bool query(char *sql, SWIGLUA_FN lua_fun); int affected_rows(); }; diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index f10ed63fca..1d84a39fd5 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -7254,6 +7254,184 @@ fail: } +static int _wrap_Dbh_test_reactive__SWIG_0(lua_State* L) { + int SWIG_arg = -1; + LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + bool result; + + SWIG_check_num_args("test_reactive",4,4) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("test_reactive",1,"LUA::Dbh *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("test_reactive",2,"char *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("test_reactive",3,"char *"); + if(!lua_isstring(L,4)) SWIG_fail_arg("test_reactive",4,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ + SWIG_fail_ptr("Dbh_test_reactive",1,SWIGTYPE_p_LUA__Dbh); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); + arg4 = (char *)lua_tostring(L, 4); + result = (bool)(arg1)->test_reactive(arg2,arg3,arg4); + SWIG_arg=0; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_Dbh_test_reactive__SWIG_1(lua_State* L) { + int SWIG_arg = -1; + LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + bool result; + + SWIG_check_num_args("test_reactive",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("test_reactive",1,"LUA::Dbh *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("test_reactive",2,"char *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("test_reactive",3,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ + SWIG_fail_ptr("Dbh_test_reactive",1,SWIGTYPE_p_LUA__Dbh); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); + result = (bool)(arg1)->test_reactive(arg2,arg3); + SWIG_arg=0; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_Dbh_test_reactive__SWIG_2(lua_State* L) { + int SWIG_arg = -1; + LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; + char *arg2 = (char *) 0 ; + bool result; + + SWIG_check_num_args("test_reactive",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("test_reactive",1,"LUA::Dbh *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("test_reactive",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ + SWIG_fail_ptr("Dbh_test_reactive",1,SWIGTYPE_p_LUA__Dbh); + } + + arg2 = (char *)lua_tostring(L, 2); + result = (bool)(arg1)->test_reactive(arg2); + SWIG_arg=0; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_Dbh_test_reactive(lua_State* L) { + int argc; + int argv[5]={ + 1,2,3,4,5 + }; + + argc = lua_gettop(L); + if (argc == 2) { + int _v; + { + void *ptr; + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Dbh, 0)) { + _v = 0; + } else { + _v = 1; + } + } + if (_v) { + { + _v = lua_isstring(L,argv[1]); + } + if (_v) { + return _wrap_Dbh_test_reactive__SWIG_2(L); + } + } + } + if (argc == 3) { + int _v; + { + void *ptr; + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Dbh, 0)) { + _v = 0; + } else { + _v = 1; + } + } + if (_v) { + { + _v = lua_isstring(L,argv[1]); + } + if (_v) { + { + _v = lua_isstring(L,argv[2]); + } + if (_v) { + return _wrap_Dbh_test_reactive__SWIG_1(L); + } + } + } + } + if (argc == 4) { + int _v; + { + void *ptr; + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Dbh, 0)) { + _v = 0; + } else { + _v = 1; + } + } + if (_v) { + { + _v = lua_isstring(L,argv[1]); + } + if (_v) { + { + _v = lua_isstring(L,argv[2]); + } + if (_v) { + { + _v = lua_isstring(L,argv[3]); + } + if (_v) { + return _wrap_Dbh_test_reactive__SWIG_0(L); + } + } + } + } + } + + lua_pushstring(L,"No matching function for overloaded 'Dbh_test_reactive'"); + lua_error(L);return 0; +} + + static int _wrap_Dbh_query(lua_State* L) { int SWIG_arg = -1; LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; @@ -7328,6 +7506,7 @@ delete arg1; static swig_lua_method swig_LUA_Dbh_methods[] = { {"release", _wrap_Dbh_release}, {"connected", _wrap_Dbh_connected}, + {"test_reactive", _wrap_Dbh_test_reactive}, {"query", _wrap_Dbh_query}, {"affected_rows", _wrap_Dbh_affected_rows}, {0,0}