From: Roman Khabibov <roman.habibov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: korablev@tarantool.org
Subject: [tarantool-patches] [PATCH 1/2] sql: add sqlite3 msgpack result function
Date: Sun, 27 Jan 2019 03:28:10 +0300 [thread overview]
Message-ID: <367affe7a5ed5f1acd195c900e25aa85249bcf0e.1548547565.git.roman.habibov@tarantool.org> (raw)
In-Reply-To: <cover.1548547565.git.roman.habibov@tarantool.org>
In-Reply-To: <cover.1548547565.git.roman.habibov@tarantool.org>
Add function like sqlite3_result_blob that sets subtype of out parameter as
SQL_SUBTYPE_MSGPACK. It allows to encode msg pack fields.
Needed for #3372
---
src/box/sql/sqliteInt.h | 3 +++
src/box/sql/vdbeapi.c | 13 +++++++++++++
2 files changed, 16 insertions(+)
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index 7e16edc9a..9b4db93d3 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -465,6 +465,9 @@ sqlite3_value_numeric_type(sqlite3_value *);
sqlite3 *
sqlite3_context_db_handle(sqlite3_context *);
+void
+sqlite3_result_msgpack(sqlite3_context *, const void *,
+ int, void (*)(void *));
void
sqlite3_result_blob(sqlite3_context *, const void *,
diff --git a/src/box/sql/vdbeapi.c b/src/box/sql/vdbeapi.c
index 9e57af051..ed7b67e3b 100644
--- a/src/box/sql/vdbeapi.c
+++ b/src/box/sql/vdbeapi.c
@@ -360,6 +360,19 @@ invokeValueDestructor(const void *p, /* Value to destroy */
return SQLITE_TOOBIG;
}
+void
+sqlite3_result_msgpack(sqlite3_context * pCtx,
+ const void *z, int n, void (*xDel) (void *)
+ )
+{
+ assert(n >= 0);
+ if (sqlite3VdbeMemSetStr(pCtx->pOut, z, n,0, xDel) == SQLITE_TOOBIG) {
+ sqlite3_result_error_toobig(pCtx);
+ }
+ pCtx->pOut->flags|= MEM_Subtype;
+ pCtx->pOut->subtype = SQL_SUBTYPE_MSGPACK;
+}
+
void
sqlite3_result_blob(sqlite3_context * pCtx,
const void *z, int n, void (*xDel) (void *)
--
2.17.1
next prev parent reply other threads:[~2019-01-27 0:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-27 0:28 [tarantool-patches] [PATCH 0/2] sql: store statistics in statN as an array of integers Roman Khabibov
2019-01-27 0:28 ` Roman Khabibov [this message]
2019-02-11 23:53 ` [tarantool-patches] Re: [PATCH 1/2] sql: add sqlite3 msgpack result function n.pettik
2019-01-27 0:28 ` [tarantool-patches] [PATCH 2/2] sql: store statistics in statN as an array of integers Roman Khabibov
2019-02-11 23:53 ` [tarantool-patches] " n.pettik
2019-03-01 10:33 ` [tarantool-patches] Re: [PATCH] " Roman Khabibov
2019-03-05 17:54 ` n.pettik
2019-03-12 1:10 ` Roman Khabibov
2019-03-22 15:16 ` n.pettik
2019-02-11 23:53 ` [tarantool-patches] Re: [PATCH 0/2] " n.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=367affe7a5ed5f1acd195c900e25aa85249bcf0e.1548547565.git.roman.habibov@tarantool.org \
--to=roman.habibov@tarantool.org \
--cc=korablev@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH 1/2] sql: add sqlite3 msgpack result function' \
/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