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 A6D2F21D0D for ; Tue, 22 May 2018 17:29:45 -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 PcuAFyLgWAcc for ; Tue, 22 May 2018 17:29:45 -0400 (EDT) Received: from smtp49.i.mail.ru (smtp49.i.mail.ru [94.100.177.109]) (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 DC28021B9C for ; Tue, 22 May 2018 17:29:44 -0400 (EDT) Subject: [tarantool-patches] Re: [tarantool] 02/03: sql: remove SQL fields from Table and Column References: <152702355511.15825.15635253726569177151@localhost> <1527022913.906931598.31425120730523877@mxpdd15.i.mail.ru> From: Vladislav Shpilevoy Message-ID: <602a6eac-ffd0-c4b1-74a3-bcbab3d7bbf3@tarantool.org> Date: Wed, 23 May 2018 00:29:40 +0300 MIME-Version: 1.0 In-Reply-To: <1527022913.906931598.31425120730523877@mxpdd15.i.mail.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Kirill Shcherbatov , "tarantool-patches@freelists.org" Hello. Thanks for the patch! See 1 comment below. On 23/05/2018 00:12, Kirill Shcherbatov wrote: > This is an automated email from the git hooks/post-receive script. > > kshcherbatov pushed a commit to branch gh-3272-no-sql-checks > in repository tarantool. > > commit e5bc5697d6418f3ce2e69bb05cebb1e68e0e24a6 > Author: Kirill Shcherbatov > AuthorDate: Mon May 21 16:02:14 2018 +0300 > > sql: remove SQL fields from Table and Column > > 1. Removed zName, is_nullable, type from SQL Column. > 2. Removed zColumns, zName from SQL Table. > 3. Refactored Parser to use def_expression directly. > 4. Introduced sql_table_def_rebuild intended for collect > fragmented with sql_field_retrieve space_def into memory > located in one allocation. > > Part of #3272, #3218. > --- > src/box/field_def.h | 6 + > src/box/space_def.c | 36 ++--- > src/box/space_def.h | 20 +++ > src/box/sql.c | 120 ++++++++++++---- > src/box/sql.h | 32 +++++ > src/box/sql/alter.c | 54 +++++--- > src/box/sql/analyze.c | 16 ++- > src/box/sql/build.c | 360 ++++++++++++++++++++++++++---------------------- > src/box/sql/delete.c | 6 +- > src/box/sql/expr.c | 17 ++- > src/box/sql/fkey.c | 37 ++--- > src/box/sql/hash.c | 10 +- > src/box/sql/hash.h | 3 +- > src/box/sql/insert.c | 77 ++++++----- > src/box/sql/pragma.c | 66 +++++---- > src/box/sql/prepare.c | 43 +++--- > src/box/sql/resolve.c | 26 ++-- > src/box/sql/select.c | 200 ++++++++++++++++----------- > src/box/sql/sqliteInt.h | 56 +++++--- > src/box/sql/tokenize.c | 5 +- > src/box/sql/treeview.c | 2 +- > src/box/sql/trigger.c | 9 +- > src/box/sql/update.c | 36 ++--- > src/box/sql/util.c | 9 -- > src/box/sql/vdbe.c | 2 +- > src/box/sql/vdbeaux.c | 34 ----- > src/box/sql/where.c | 24 ++-- > src/box/sql/wherecode.c | 11 +- > src/box/sql/whereexpr.c | 6 +- > 29 files changed, 769 insertions(+), 554 deletions(-) > > diff --git a/src/box/sql.c b/src/box/sql.c > index c0bddd2..effceb2 100644 > --- a/src/box/sql.c > +++ b/src/box/sql.c > @@ -1691,3 +1701,63 @@ space_column_default_expr(uint32_t space_id, uint32_t fieldno) > > return space->def->fields[fieldno].default_value_expr; > } > + > +struct space_def * > +sql_ephemeral_space_def_new(Parse *parser, const char *name) > +{ > + struct space_def *def = NULL; > + struct region *region = &fiber()->gc; > + size_t name_len = name != NULL ? strlen(name) : 0; > + uint32_t dummy; > + size_t size = space_def_sizeof(name_len, NULL, 0, &dummy, &dummy, &dummy); > + def = (struct space_def *)region_alloc(region, size); > + if (def == NULL) { > + diag_set(OutOfMemory, sizeof(struct tuple_dictionary), 1. Wrong size. > + "region_alloc", "sql_ephemeral_space_def_new"); > + parser->rc = SQL_TARANTOOL_ERROR; > + parser->nErr++; > + return NULL; > + } > + > + memset(def, 0, size); > + memcpy(def->name, name, name_len); > + def->name[name_len] = '\0'; > + def->opts.temporary = true; > + return def; > +}