Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] Re: [tarantool] 02/03: sql: remove SQL fields from Table and Column
       [not found] ` <1527022913.906931598.31425120730523877@mxpdd15.i.mail.ru>
@ 2018-05-22 21:29   ` Vladislav Shpilevoy
  0 siblings, 0 replies; only message in thread
From: Vladislav Shpilevoy @ 2018-05-22 21:29 UTC (permalink / raw)
  To: Kirill Shcherbatov, tarantool-patches

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 <kshcherbatov@tarantool.org>
> 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;
> +}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-22 21:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <152702355511.15825.15635253726569177151@localhost>
     [not found] ` <1527022913.906931598.31425120730523877@mxpdd15.i.mail.ru>
2018-05-22 21:29   ` [tarantool-patches] Re: [tarantool] 02/03: sql: remove SQL fields from Table and Column Vladislav Shpilevoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox