From 36ffb292983b11702a90be48d9054ffbbd87dcd8 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Mon, 13 Jun 2016 12:25:22 +0300 Subject: [PATCH] FS-9256: mod_v8: Add DB.Finalize() in order to close statements. --- src/mod/languages/mod_v8/include/fscoredb.hpp | 1 + src/mod/languages/mod_v8/src/fscoredb.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/mod/languages/mod_v8/include/fscoredb.hpp b/src/mod/languages/mod_v8/include/fscoredb.hpp index 5ac0a052b5..e15e308f1d 100644 --- a/src/mod/languages/mod_v8/include/fscoredb.hpp +++ b/src/mod/languages/mod_v8/include/fscoredb.hpp @@ -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); }; diff --git a/src/mod/languages/mod_v8/src/fscoredb.cpp b/src/mod/languages/mod_v8/src/fscoredb.cpp index a846eb8bbf..9bcb00c38f 100644 --- a/src/mod/languages/mod_v8/src/fscoredb.cpp +++ b/src/mod/languages/mod_v8/src/fscoredb.cpp @@ -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} };