Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 3/3] sql: implement point where for DELETE stmts
Date: Mon, 18 Jun 2018 17:00:18 +0300	[thread overview]
Message-ID: <ACCACE44-082D-4039-BD2F-14427FA9B299@tarantool.org> (raw)
In-Reply-To: <dcbf08ec-9358-e4a4-303a-b609a5f5e154@tarantool.org>


> On 18 Jun 2018, at 15:40, Vladislav Shpilevoy <v.shpilevoy@tarantool.org> wrote:
> 
> Thanks for the fixes! See 2 comments below.
> 
>>> 2. As I proposed in the review, why can not we use stack struct Table here?
>>> Just declare it at the beginning of the function and here save its pointer.
>> Well, OK it is possible:
>> +++ b/src/box/sql/delete.c
>> @@ -111,9 +111,12 @@ sql_table_delete_from(struct Parse *parse, struct SrcList *tab_list,
>>                  * wrapper around space_def to support interface.
>>                  */
>>                 space = space_by_id(space_id);
>> -               tab_list->a[0].pTab = sql_table_construct_from_space(space);
>> -               if (tab_list->a[0].pTab == NULL)
>> -                       goto delete_from_cleanup;
>> +               struct Table tmp_tab;
>> +               memset(&tmp_tab, 0, sizeof(tmp_tab));
>> +               tmp_tab.def = space->def;
>> +               /* Prevent from freeing memory in DeleteTable. */
>> +               tmp_tab.nTabRef = 2;
>> +               tab_list->a[0].pTab = &tmp_tab;
> 
> 1. Are you sure you can save the pointer to the stack value and then
> use it out of the declaration context?
> 
> Here tmp_tab is declared inside {} block, but pointer on it is
> used out the former.

Well,  I'm not so sure about that..

@@ -99,6 +99,7 @@ sql_table_delete_from(struct Parse *parse, struct SrcList *tab_list,
         */
        bool is_complex = false;
        const char *tab_name = tab_list->a->zName;
+       struct Table tmp_tab;
        if (sqlite3LocateTable(parse, LOCATE_NOERR, tab_name) == NULL) {
                space_id = box_space_id_by_name(tab_name,
                                                strlen(tab_name));
@@ -111,7 +112,6 @@ sql_table_delete_from(struct Parse *parse, struct SrcList *tab_list,
                 * wrapper around space_def to support interface.
                 */
                space = space_by_id(space_id);
-               struct Table tmp_tab;

>>> 5. Why WhereClause new method has prefix 'sql_where_', but WhereLoop method has prefix
>>> 'where_'? Lets make it 'where_clause_find_term' and 'where_loop_assign_terms’.
>> -sql_where_find_term(struct WhereClause *where_clause, int cursor, int column,
>> -                   Bitmask is_ready, u32 op, struct space_def *space_def,
>> -                   struct key_def *key_def)
>> +where_clase_find_term(struct WhereClause *where_clause, int cursor, int column,
> 
> 2. clase - clause. Else the patch can not be built.

Oops, I am sorry:

@@ -506,9 +506,9 @@ sqlite3WhereFindTerm(WhereClause * pWC,     /* The WHERE clause to be searched */
  * @retval New struct describing WHERE term.
  */
 static inline struct WhereTerm *
-where_clase_find_term(struct WhereClause *where_clause, int cursor, int column,
-               Bitmask is_ready, u32 op, struct space_def *space_def,
-               struct key_def *key_def)
+where_clause_find_term(struct WhereClause *where_clause, int cursor, int column,
+                      Bitmask is_ready, u32 op, struct space_def *space_def,
+                      struct key_def *key_def)

  reply	other threads:[~2018-06-18 14:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 15:16 [tarantool-patches] [PATCH 0/3] " Kirill Yukhin
2018-06-01 15:16 ` [tarantool-patches] [PATCH 1/3] sql: fetch primary index for affinity only Kirill Yukhin
2018-06-01 18:00   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-07 12:03     ` Kirill Yukhin
2018-06-07 15:01       ` Vladislav Shpilevoy
2018-06-08  8:25         ` Kirill Yukhin
2018-06-01 15:16 ` [tarantool-patches] [PATCH 2/3] sql: remove expressions from SQL indexes Kirill Yukhin
2018-06-01 18:00   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-01 15:16 ` [tarantool-patches] [PATCH 3/3] sql: implement point where for DELETE stmts Kirill Yukhin
2018-06-01 18:00   ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-18  2:11     ` n.pettik
2018-06-18 10:44       ` Vladislav Shpilevoy
2018-06-18 10:51         ` Vladislav Shpilevoy
2018-06-18 12:29         ` n.pettik
2018-06-18 12:40           ` Vladislav Shpilevoy
2018-06-18 14:00             ` n.pettik [this message]
2018-06-18 14:17               ` Vladislav Shpilevoy
2018-06-19  8:03                 ` Kirill Yukhin
2018-06-14 12:41 ` [tarantool-patches] Re: [PATCH 0/3] " 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=ACCACE44-082D-4039-BD2F-14427FA9B299@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH 3/3] sql: implement point where for DELETE stmts' \
    /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