From: imeevma@tarantool.org
To: korablev@tarantool.org, tsafin@tarantool.org,
tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v4 1/5] sql: set field_type in mem_set_*() functions
Date: Mon, 13 Jul 2020 08:32:59 +0300 [thread overview]
Message-ID: <511253f302641d67f2de57b0fe2f0e2c7d1a11a6.1594618005.git.imeevma@gmail.com> (raw)
In-Reply-To: <cover.1594618005.git.imeevma@gmail.com>
After this patch, the mem_set _*() functions will set the mem field type
along with its MEM type flag.
---
src/box/sql/vdbemem.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c
index 2e0d0bc3b..8e9ebf7ab 100644
--- a/src/box/sql/vdbemem.c
+++ b/src/box/sql/vdbemem.c
@@ -829,6 +829,7 @@ mem_set_bool(struct Mem *mem, bool value)
sqlVdbeMemSetNull(mem);
mem->u.b = value;
mem->flags = MEM_Bool;
+ mem->field_type = FIELD_TYPE_BOOLEAN;
}
void
@@ -839,6 +840,7 @@ mem_set_i64(struct Mem *mem, int64_t value)
mem->u.i = value;
int flag = value < 0 ? MEM_Int : MEM_UInt;
MemSetTypeFlag(mem, flag);
+ mem->field_type = FIELD_TYPE_INTEGER;
}
void
@@ -848,6 +850,7 @@ mem_set_u64(struct Mem *mem, uint64_t value)
sqlVdbeMemSetNull(mem);
mem->u.u = value;
MemSetTypeFlag(mem, MEM_UInt);
+ mem->field_type = FIELD_TYPE_UNSIGNED;
}
void
@@ -863,6 +866,7 @@ mem_set_int(struct Mem *mem, int64_t value, bool is_neg)
mem->u.u = value;
MemSetTypeFlag(mem, MEM_UInt);
}
+ mem->field_type = FIELD_TYPE_INTEGER;
}
void
@@ -873,6 +877,7 @@ mem_set_double(struct Mem *mem, double value)
return;
mem->u.r = value;
MemSetTypeFlag(mem, MEM_Real);
+ mem->field_type = FIELD_TYPE_DOUBLE;
}
/*
@@ -1068,6 +1073,11 @@ sqlVdbeMemSetStr(Mem * pMem, /* Memory cell to set to string value */
pMem->n = nByte;
pMem->flags = flags;
+ assert((pMem->flags & (MEM_Str | MEM_Blob)) != 0);
+ if ((pMem->flags & MEM_Str) != 0)
+ pMem->field_type = FIELD_TYPE_STRING;
+ else
+ pMem->field_type = FIELD_TYPE_VARBINARY;
if (nByte > iLimit) {
diag_set(ClientError, ER_SQL_EXECUTE, "string or binary string"\
--
2.25.1
next prev parent reply other threads:[~2020-07-13 5:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-13 5:32 [Tarantool-patches] [PATCH v4 0/5] Change implicit cast for assignment imeevma
2020-07-13 5:32 ` imeevma [this message]
2020-07-13 10:36 ` [Tarantool-patches] [PATCH v4 1/5] sql: set field_type in mem_set_*() functions Nikita Pettik
2020-07-13 5:33 ` [Tarantool-patches] [PATCH v4 2/5] sql: move diag setting to sql_func_by_signature() imeevma
2020-07-13 10:58 ` Nikita Pettik
2020-07-13 5:33 ` [Tarantool-patches] [PATCH v4 3/5] sql: check number of arguments in sql_func_by_signature() imeevma
2020-07-13 12:21 ` Nikita Pettik
2020-07-13 5:33 ` [Tarantool-patches] [PATCH v4 4/5] sql: change implicit cast for assignment imeevma
2020-07-13 14:42 ` Nikita Pettik
2020-07-13 5:33 ` [Tarantool-patches] [PATCH v4 5/5] sql: properly check arguments of functions imeevma
2020-07-13 14:56 ` Nikita Pettik
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=511253f302641d67f2de57b0fe2f0e2c7d1a11a6.1594618005.git.imeevma@gmail.com \
--to=imeevma@tarantool.org \
--cc=korablev@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--cc=tsafin@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v4 1/5] sql: set field_type in mem_set_*() functions' \
/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