FS-9256: mod_v8: Add DB.Finalize() in order to close statements.

This commit is contained in:
Andrey Volk 2016-06-13 12:25:22 +03:00
parent b3130028a1
commit 36ffb29298
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}
};