Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: vdavydov.dev@gmail.com
Subject: [PATCH 2/4] Revert "box: store sql text and length in sql_request"
Date: Tue, 11 Dec 2018 00:40:39 +0300	[thread overview]
Message-ID: <13e5e88c89884ff4e444e4f27ab87fa45317927b.1544477760.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1544477760.git.v.shpilevoy@tarantool.org>
In-Reply-To: <cover.1544477760.git.v.shpilevoy@tarantool.org>

This reverts commit bc9e41e9b5d06e70330964d94abbab2fabf3ced1.

This is one step forward to make sql_request store raw
MessagePack.

Part of #3828
---
 src/box/execute.c | 6 +++---
 src/box/execute.h | 2 --
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/box/execute.c b/src/box/execute.c
index 894625c71..3c4898216 100644
--- a/src/box/execute.c
+++ b/src/box/execute.c
@@ -283,8 +283,7 @@ error:
 			if (sql_bind_list_decode(request, value, region) != 0)
 				return -1;
 		} else {
-			request->sql_text =
-				mp_decode_str(&value, &request->sql_text_len);
+			request->sql_text = value;
 		}
 	}
 	if (request->sql_text == NULL) {
@@ -600,7 +599,8 @@ sql_prepare_and_execute(const struct sql_request *request,
 			struct sql_response *response, struct region *region)
 {
 	const char *sql = request->sql_text;
-	uint32_t len = request->sql_text_len;
+	uint32_t len;
+	sql = mp_decode_str(&sql, &len);
 	struct sqlite3_stmt *stmt;
 	sqlite3 *db = sql_get();
 	if (db == NULL) {
diff --git a/src/box/execute.h b/src/box/execute.h
index fa7820b0b..266566260 100644
--- a/src/box/execute.h
+++ b/src/box/execute.h
@@ -57,8 +57,6 @@ struct xrow_header;
 struct sql_request {
 	/** SQL statement text. */
 	const char *sql_text;
-	/** Length of the SQL statement text. */
-	uint32_t sql_text_len;
 	/** Array of parameters. */
 	struct sql_bind *bind;
 	/** Length of the @bind. */
-- 
2.17.2 (Apple Git-113)

  parent reply	other threads:[~2018-12-10 21:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 21:40 [PATCH 0/4] Fix sql_bind leak Vladislav Shpilevoy
2018-12-10 21:40 ` [PATCH 1/4] sql: remove sync from sql_request/response Vladislav Shpilevoy
2018-12-10 21:40 ` Vladislav Shpilevoy [this message]
2018-12-10 21:40 ` [PATCH 3/4] sql: decode bind parameters in TX thread Vladislav Shpilevoy
2018-12-10 21:40 ` [PATCH 4/4] sql: move sql_request and xrow_decode_sql to xrow lib Vladislav Shpilevoy
2018-12-18 12:02 ` [PATCH 0/4] Fix sql_bind leak Vladimir Davydov

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=13e5e88c89884ff4e444e4f27ab87fa45317927b.1544477760.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH 2/4] Revert "box: store sql text and length in sql_request"' \
    /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