From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org,
Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] [PATCH v7 1/7] sql: remove parser construct, destruct to sql.h
Date: Wed, 23 May 2018 17:05:28 +0300 [thread overview]
Message-ID: <e9e6e26320b2190dfdd6ae2f9213de7d719b52d9.1527084287.git.kshcherbatov@tarantool.org> (raw)
In-Reply-To: <cover.1527084286.git.kshcherbatov@tarantool.org>
In-Reply-To: <cover.1527084286.git.kshcherbatov@tarantool.org>
Moved sql_parser_construct and sql_parser_destruct to sql.h to
use them not only in DDL.
Removed SELECTTRACE_ENABLED macro with conditional fields from
struct Parse to prevent different object sizes across the project.
Part of #3272.
---
src/box/sql.h | 17 +++++++++++++++++
src/box/sql/prepare.c | 9 +++++++++
src/box/sql/sqliteInt.h | 25 -------------------------
3 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/src/box/sql.h b/src/box/sql.h
index 3c26492..ff8ab6f 100644
--- a/src/box/sql.h
+++ b/src/box/sql.h
@@ -175,6 +175,23 @@ sql_ephemeral_space_def_new(struct Parse *parser, const char *name);
int
sql_table_def_rebuild(struct sqlite3 *db, struct Table *table);
+/**
+ * Initialize a new parser object.
+ * A number of service allocations are performed on the region, which is also
+ * cleared in the destroy function.
+ * @param parser object to initialize.
+ * @param db SQLite object.
+ */
+void
+sql_parser_create(struct Parse *parser, struct sqlite3 *db);
+
+/**
+ * Release the parser object resources.
+ * @param parser object to release.
+ */
+void
+sql_parser_destroy(struct Parse *parser);
+
#if defined(__cplusplus)
} /* extern "C" { */
#endif
diff --git a/src/box/sql/prepare.c b/src/box/sql/prepare.c
index 8dc433f..8d94642 100644
--- a/src/box/sql/prepare.c
+++ b/src/box/sql/prepare.c
@@ -433,6 +433,15 @@ sqlite3_prepare_v2(sqlite3 * db, /* Database handle. */
}
void
+sql_parser_create(struct Parse *parser, sqlite3 *db)
+{
+ memset(parser, 0, sizeof(struct Parse));
+ parser->db = db;
+ struct region *region = &fiber()->gc;
+ parser->region_initial_size = region_used(region);
+}
+
+void
sql_parser_destroy(Parse *parser)
{
assert(parser != NULL);
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index 99c9fea..a7ef80f 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -2911,10 +2911,8 @@ struct Parse {
Token constraintName; /* Name of the constraint currently being parsed */
int regRoot; /* Register holding root page number for new objects */
int nMaxArg; /* Max args passed to user function by sub-program */
-#ifdef SELECTTRACE_ENABLED
int nSelect; /* Number of SELECT statements seen */
int nSelectIndent; /* How far to indent SELECTTRACE() output */
-#endif
Parse *pToplevel; /* Parse structure for main program (or NULL) */
Table *pTriggerTab; /* Table triggers are being coded for */
u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
@@ -4554,27 +4552,4 @@ extern int sqlite3InitDatabase(sqlite3 * db);
enum on_conflict_action
table_column_nullable_action(struct Table *tab, uint32_t column);
-/**
- * Initialize a new parser object.
- * A number of service allocations are performed on the region, which is also
- * cleared in the destroy function.
- * @param parser object to initialize.
- * @param db SQLite object.
- */
-static inline void
-sql_parser_create(struct Parse *parser, sqlite3 *db)
-{
- memset(parser, 0, sizeof(struct Parse));
- parser->db = db;
- struct region *region = &fiber()->gc;
- parser->region_initial_size = region_used(region);
-}
-
-/**
- * Release the parser object resources.
- * @param parser object to release.
- */
-void
-sql_parser_destroy(struct Parse *parser);
-
#endif /* SQLITEINT_H */
--
2.7.4
next prev parent reply other threads:[~2018-05-23 14:05 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 14:05 [tarantool-patches] [PATCH v7 0/7] sql: remove Checks to server Kirill Shcherbatov
2018-05-23 14:05 ` Kirill Shcherbatov [this message]
2018-05-23 17:46 ` [tarantool-patches] Re: [PATCH v7 1/7] sql: remove parser construct, destruct to sql.h Konstantin Osipov
2018-05-24 19:26 ` Vladislav Shpilevoy
2018-05-25 12:05 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 2/7] box: introduce OPT_ARRAY opt_type to decode arrays Kirill Shcherbatov
2018-05-23 17:53 ` [tarantool-patches] " Konstantin Osipov
2018-05-24 7:32 ` Kirill Shcherbatov
2018-05-24 19:26 ` Vladislav Shpilevoy
2018-05-25 11:54 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 3/7] sql: introduce expr_len for sql_expr_compile Kirill Shcherbatov
2018-05-24 19:26 ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-25 11:54 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 4/7] sql: rename sql_expr_free to sql_expr_delete Kirill Shcherbatov
2018-05-23 18:00 ` [tarantool-patches] " Konstantin Osipov
2018-05-24 19:26 ` Vladislav Shpilevoy
2018-05-25 11:54 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 5/7] sql: change sqlite3AddCheckConstraint signature Kirill Shcherbatov
2018-05-23 18:01 ` [tarantool-patches] " Konstantin Osipov
2018-05-24 19:26 ` Vladislav Shpilevoy
2018-05-25 11:53 ` Kirill Shcherbatov
2018-05-29 11:51 ` n.pettik
2018-05-30 8:32 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 6/7] sql: export funcs defined on Expr, ExprList to sql.h Kirill Shcherbatov
2018-05-23 18:15 ` [tarantool-patches] " Konstantin Osipov
2018-05-24 7:33 ` Kirill Shcherbatov
2018-05-24 19:26 ` Vladislav Shpilevoy
2018-05-25 11:53 ` Kirill Shcherbatov
2018-05-28 11:19 ` Vladislav Shpilevoy
2018-05-28 14:59 ` Kirill Shcherbatov
2018-05-23 14:05 ` [tarantool-patches] [PATCH v7 7/7] sql: remove Checks to server Kirill Shcherbatov
2018-05-24 19:26 ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-25 11:53 ` Kirill Shcherbatov
2018-05-28 11:19 ` Vladislav Shpilevoy
2018-05-28 14:59 ` Kirill Shcherbatov
2018-05-28 18:50 ` Vladislav Shpilevoy
2018-05-29 11:49 ` n.pettik
2018-05-30 8:32 ` Kirill Shcherbatov
2018-05-30 10:42 ` n.pettik
2018-05-25 12:04 ` [tarantool-patches] Re: [PATCH v7 0/7] " Kirill Shcherbatov
2018-05-28 11:19 ` Vladislav Shpilevoy
2018-05-30 11:03 ` n.pettik
2018-05-31 17:44 ` Kirill Yukhin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e9e6e26320b2190dfdd6ae2f9213de7d719b52d9.1527084287.git.kshcherbatov@tarantool.org \
--to=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [tarantool-patches] [PATCH v7 1/7] sql: remove parser construct, destruct to sql.h' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox