From: Konstantin Osipov <kostja@tarantool.org> To: Nikita Pettik <korablev@tarantool.org> Cc: tarantool-patches@freelists.org, v.shpilevoy@tarantool.org, alexander.turenko@tarantool.org Subject: [tarantool-patches] Re: [PATCH 0/8] rfc: introduce dry-run execution of SQL queries Date: Wed, 28 Aug 2019 12:31:26 +0300 [thread overview] Message-ID: <20190828093126.GB19848@atlas> (raw) In-Reply-To: <cover.1566907519.git.korablev@tarantool.org> * Nikita Pettik <korablev@tarantool.org> [19/08/27 16:34]: > To execute query in dry-run mode locally separate method of box has been added: > box.dry_run("sql_string"). Current implementation does not modify box.execute() > making it accept third optional argument (except for array of bindings) - this > is to be discussed. If you have to use a separate method, call it "prepare", and return a prepare handle. The handle may simply contain SQL text as prepared state, + metadata. Let's not invent a new API, dry run is an implementation detail. > Other open (or dubious) questions. > > 1. How to handle DML queries. Meanwhile getting meta-information of DDL queries > is likely to be useless, calculating number of affected rows in case of DML > query can be sensible. On the other hand, it can turn out to be quite > non-trivial task. In its current state, box.dry_run("DML_Query") always > returns 0 as row count. IMHO it can be done but as a follow-up The point of dry-run in particular is to find out on the driver side whether the query returns a result set or not. So please handle them. > 2. Should dry_run() except for parsing also bind variables? I guess no, since > it results in byte-code (i.e. prepared statement) modification. On the other > hand, it allows setting correct type for bindings (see sql_bind_type()). By > default, all binding parameters have boolean type. No, dry-run is an alias to 'prepare', which doesn't return a prepare handle only because we decided to use SQL text as a prepared statement identifier, and hide an explicit prepared statement handle from the client. The prepared statement cache will be managed transparently by the server when it is added, for two reasons: - to not force this complication on the client - to be able to use prepared statements with statements which were not explicitly prepared. An important detail: for this reason, dry run should also return the number of parameter markers, their type and count. > 3. Interface for local call. In current implementation I've added box.dry_run() > in addition to traditional box.execute() method. Instead, we can make > box.execute() accept third argument as it is handled in net.box. Replied. I will look at the patch separately. -- Konstantin Osipov, Moscow, Russia
next prev parent reply other threads:[~2019-08-28 9:31 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-27 13:34 [tarantool-patches] " Nikita Pettik 2019-08-27 13:34 ` [tarantool-patches] [PATCH 1/8] port: increase padding of struct port Nikita Pettik 2019-08-28 9:33 ` [tarantool-patches] " Konstantin Osipov 2019-08-29 20:46 ` Vladislav Shpilevoy 2019-08-27 13:34 ` [tarantool-patches] [PATCH 2/8] port: move struct port_sql to box/port.h Nikita Pettik 2019-08-28 9:33 ` [tarantool-patches] " Konstantin Osipov 2019-08-29 20:46 ` Vladislav Shpilevoy 2019-08-27 13:34 ` [tarantool-patches] [PATCH 3/8] sql: remove sql_prepare_v2() Nikita Pettik 2019-08-28 9:33 ` [tarantool-patches] " Konstantin Osipov 2019-08-29 20:46 ` Vladislav Shpilevoy 2019-08-27 13:34 ` [tarantool-patches] [PATCH 4/8] sql: refactor sql_prepare() and sqlPrepare() Nikita Pettik 2019-08-28 9:35 ` [tarantool-patches] " Konstantin Osipov 2019-08-29 20:46 ` Vladislav Shpilevoy 2019-08-27 13:34 ` [tarantool-patches] [PATCH 5/8] sql: move sql_prepare() declaration to box/execute.h Nikita Pettik 2019-08-28 9:35 ` [tarantool-patches] " Konstantin Osipov 2019-08-27 13:34 ` [tarantool-patches] [PATCH 6/8] refactoring: use sql_prepare() and sql_execute() in tx_process_sql() Nikita Pettik 2019-08-28 9:37 ` [tarantool-patches] " Konstantin Osipov 2019-08-29 20:46 ` Vladislav Shpilevoy 2019-08-27 13:34 ` [tarantool-patches] [PATCH 7/8] netbox: allow passing options to :execute() Nikita Pettik 2019-08-28 9:38 ` [tarantool-patches] " Konstantin Osipov 2019-08-29 20:46 ` Vladislav Shpilevoy 2019-08-27 13:34 ` [tarantool-patches] [PATCH 8/8] sql: introduce dry-run execution Nikita Pettik 2019-08-28 9:39 ` [tarantool-patches] " Konstantin Osipov 2019-08-29 20:46 ` Vladislav Shpilevoy 2019-08-28 9:31 ` Konstantin Osipov [this message] 2019-08-29 20:46 ` [tarantool-patches] Re: [PATCH 0/8] rfc: introduce dry-run execution of SQL queries Vladislav Shpilevoy
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=20190828093126.GB19848@atlas \ --to=kostja@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='[tarantool-patches] Re: [PATCH 0/8] rfc: introduce dry-run execution of SQL queries' \ /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