Merge pull request #883 in FS/freeswitch from ~LORNI/freeswitch:feature/FS-9256-add-db.finalize-in-order-to-close to master

* commit '36ffb292983b11702a90be48d9054ffbbd87dcd8':
  FS-9256: mod_v8: Add DB.Finalize() in order to close statements.
This commit is contained in:
Mike Jerris 2016-08-16 14:00:31 -05:00
commit f8bcc9d126
2 changed files with 10 additions and 0 deletions

View File

@ -72,6 +72,7 @@ public:
JS_COREDB_FUNCTION_DEF(Prepare);
JS_COREDB_FUNCTION_DEF(BindText);
JS_COREDB_FUNCTION_DEF(BindInt);
JS_COREDB_FUNCTION_DEF(Finalize);
JS_COREDB_GET_PROPERTY_DEF(GetProperty);
};

View File

@ -232,6 +232,14 @@ JS_COREDB_FUNCTION_IMPL(Step)
StepEx(info, SWITCH_CORE_DB_DONE);
}
JS_COREDB_FUNCTION_IMPL(Finalize)
{
if (_stmt) {
switch_core_db_finalize(_stmt);
_stmt = NULL;
}
}
JS_COREDB_FUNCTION_IMPL(Fetch)
{
HandleScope handle_scope(info.GetIsolate());
@ -415,6 +423,7 @@ static const js_function_t db_methods[] = {
{"prepare", FSCoreDB::Prepare},
{"bindText", FSCoreDB::BindText},
{"bindInt", FSCoreDB::BindInt},
{"finalize", FSCoreDB::Finalize},
{0}
};