From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@freelists.org, Nikita Pettik <korablev@tarantool.org> Subject: [tarantool-patches] Re: [PATCH 2/8] sql: use field type instead of affinity for type_def Date: Sat, 29 Dec 2018 20:42:34 +0300 [thread overview] Message-ID: <b2e21fa8-cdf6-2b2f-4c1e-7617c2ba66b8@tarantool.org> (raw) In-Reply-To: <ecb93e536df9617dd6c80dda06c453087726429b.1545987214.git.korablev@tarantool.org> Thanks for the patch! See 1 comment below. On 28/12/2018 12:34, Nikita Pettik wrote: > Also, this allows to delay affinity assignment to field def until > encoding of table format. > > Part of #3698 > --- > src/box/sql.c | 4 +++- > src/box/sql/build.c | 23 +++++++++++++++++++++-- > src/box/sql/parse.y | 26 +++++++++++++------------- > src/box/sql/sqliteInt.h | 5 ++++- > test/sql/types.result | 4 ++-- > 5 files changed, 43 insertions(+), 19 deletions(-) > > diff --git a/src/box/sql/build.c b/src/box/sql/build.c > index 49b90b5d0..beaafe1bc 100644 > --- a/src/box/sql/build.c > +++ b/src/box/sql/build.c > @@ -501,6 +501,26 @@ sql_affinity_to_field_type(enum affinity_type affinity) > } > } > > +enum affinity_type > +sql_field_type_to_affinity(enum field_type field_type) If I were you, I would moved this function to field_def.c/.h, but taking into account that it is a temporary crutch anyway, it is up to you. > +{ > + switch (field_type) { > + case FIELD_TYPE_INTEGER: > + case FIELD_TYPE_UNSIGNED: > + return AFFINITY_INTEGER; > + case FIELD_TYPE_NUMBER: > + return AFFINITY_REAL; > + case FIELD_TYPE_STRING: > + return AFFINITY_TEXT; > + case FIELD_TYPE_SCALAR: > + return AFFINITY_BLOB; > + case FIELD_TYPE_ANY: > + return AFFINITY_UNDEFINED; > + default: > + unreachable(); > + } > +} > + > /* > * Add a new column to the table currently being constructed. > *
next prev parent reply other threads:[~2018-12-29 17:42 UTC|newest] Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-12-28 9:34 [tarantool-patches] [PATCH 0/8] Eliminate affinity from source code Nikita Pettik 2018-12-28 9:34 ` [tarantool-patches] [PATCH 1/8] sql: remove SQLITE_ENABLE_UPDATE_DELETE_LIMIT define Nikita Pettik 2018-12-29 17:42 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 14:25 ` n.pettik 2018-12-28 9:34 ` [tarantool-patches] [PATCH 2/8] sql: use field type instead of affinity for type_def Nikita Pettik 2018-12-29 17:42 ` Vladislav Shpilevoy [this message] 2019-01-16 14:26 ` [tarantool-patches] " n.pettik 2018-12-28 9:34 ` [tarantool-patches] [PATCH 3/8] sql: remove numeric affinity Nikita Pettik 2018-12-29 9:01 ` [tarantool-patches] " Konstantin Osipov 2018-12-29 17:42 ` Vladislav Shpilevoy 2019-01-09 8:26 ` Konstantin Osipov 2019-01-16 14:26 ` n.pettik 2019-01-22 15:41 ` Vladislav Shpilevoy 2019-01-28 16:39 ` n.pettik 2019-01-30 13:04 ` Vladislav Shpilevoy 2019-02-01 16:39 ` n.pettik 2019-01-09 8:20 ` Konstantin Osipov 2018-12-28 9:34 ` [tarantool-patches] [PATCH 4/8] sql: replace affinity with field type for func Nikita Pettik 2018-12-28 9:34 ` [tarantool-patches] [PATCH 5/8] sql: replace field type with affinity for VDBE runtime Nikita Pettik 2018-12-29 17:42 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 14:26 ` n.pettik 2019-01-22 15:41 ` Vladislav Shpilevoy 2019-01-28 16:39 ` n.pettik 2019-01-30 13:04 ` Vladislav Shpilevoy 2019-02-01 16:39 ` n.pettik 2019-02-05 15:08 ` Vladislav Shpilevoy 2019-02-05 17:46 ` n.pettik 2018-12-28 9:34 ` [tarantool-patches] [PATCH 6/8] sql: replace affinity with field type in struct Expr Nikita Pettik 2018-12-29 17:42 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 14:26 ` n.pettik 2019-01-22 15:41 ` Vladislav Shpilevoy 2019-01-28 16:39 ` n.pettik 2019-01-30 13:04 ` Vladislav Shpilevoy 2019-02-01 16:39 ` n.pettik 2019-02-05 15:08 ` Vladislav Shpilevoy 2019-02-05 17:46 ` n.pettik 2018-12-28 9:34 ` [tarantool-patches] [PATCH 7/8] sql: clean-up affinity from SQL source code Nikita Pettik 2018-12-29 17:42 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-16 14:26 ` n.pettik 2019-01-22 15:41 ` Vladislav Shpilevoy 2019-01-28 16:40 ` n.pettik 2019-01-30 13:04 ` Vladislav Shpilevoy 2019-02-01 16:39 ` n.pettik 2019-02-05 15:08 ` Vladislav Shpilevoy 2019-02-05 17:46 ` n.pettik 2018-12-28 9:34 ` [tarantool-patches] [PATCH 8/8] Remove affinity from field definition Nikita Pettik 2019-02-05 19:41 ` [tarantool-patches] Re: [PATCH 0/8] Eliminate affinity from source code Vladislav Shpilevoy 2019-02-08 13:37 ` 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=b2e21fa8-cdf6-2b2f-4c1e-7617c2ba66b8@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH 2/8] sql: use field type instead of affinity for type_def' \ /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