]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Added test_reactive to mod_lua freeswitch.Dbh
authorLeon de Rooij <leon@toyos.nl>
Thu, 27 Jan 2011 13:17:49 +0000 (14:17 +0100)
committerLeon de Rooij <leon@toyos.nl>
Thu, 27 Jan 2011 13:17:49 +0000 (14:17 +0100)
src/mod/languages/mod_lua/freeswitch.i
src/mod/languages/mod_lua/freeswitch_lua.cpp
src/mod/languages/mod_lua/freeswitch_lua.h
src/mod/languages/mod_lua/mod_lua_wrap.cpp

index 9ccaf8ea9f959913edc19d36e17cd9cfc85e658d..25faa5a5dfef4bc8cfbeb8526fa8e9adf5cdc9a1 100644 (file)
@@ -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();
 };
index 01f708d66a88c2aae844a80126d11c195596d072..b388f2e491d13c37a466a8b62c034417b99caed3 100644 (file)
@@ -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;
index 5f7966266cb5f08f9bd0780c2b98517acc066d4a..6411d696977cfd5535767788ebf69b235b645896 100644 (file)
@@ -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();
   };
index f10ed63fca473c18f2d0d04e916833a64decf1df..1d84a39fd59432680c60775d765177f734231924 100644 (file)
@@ -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}