From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 5CEFC28666 for ; Thu, 31 May 2018 07:22:58 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9xyMgDrbj0em for ; Thu, 31 May 2018 07:22:58 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 0DC48284FB for ; Thu, 31 May 2018 07:22:57 -0400 (EDT) From: Kirill Shcherbatov Subject: [tarantool-patches] [PATCH v1 1/4] box: move db->pShchema init to sql_init Date: Thu, 31 May 2018 14:22:50 +0300 Message-Id: <80e32b9cb08cd33972e4e223197ef1944e319ce5.1527765756.git.kshcherbatov@tarantool.org> In-Reply-To: References: In-Reply-To: References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Kirill Shcherbatov As we are going to call parser on box.cfg() to recreate triggers from SQL, we should initialize Schema as it used in sqlite3BeginTrigger. Part of #3273. --- src/box/sql.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/box/sql.c b/src/box/sql.c index 7379cb4..47d1739 100644 --- a/src/box/sql.c +++ b/src/box/sql.c @@ -77,11 +77,18 @@ sql_init() panic("failed to initialize SQL subsystem"); assert(db != NULL); + /* Initialize pSchema to use SQL parser. */ + db->pSchema = sqlite3SchemaCreate(db); + if (db->pSchema == NULL) { + sqlite3_close(db); + panic("failed to initialize SQL Schema subsystem"); + } } void sql_load_schema() { + assert(db->pSchema != NULL); int rc; struct session *user_session = current_session(); int commit_internal = !(user_session->sql_flags @@ -89,7 +96,6 @@ sql_load_schema() assert(db->init.busy == 0); db->init.busy = 1; - db->pSchema = sqlite3SchemaCreate(db); rc = sqlite3InitDatabase(db); if (rc != SQLITE_OK) { sqlite3SchemaClear(db); -- 2.7.4