From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id F0B1724BBB for ; Wed, 16 May 2018 08:33:14 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0HLQ8Vkf0bkc for ; Wed, 16 May 2018 08:33:14 -0400 (EDT) Received: from smtp3.mail.ru (smtp3.mail.ru [94.100.179.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 4466E24BB4 for ; Wed, 16 May 2018 08:33:14 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v6 3/4] sql: space_def* instead of Table* in Expr References: <6702e8ecd47238730a4ba27e87fe7bf082a874c6.1526403792.git.kshcherbatov@tarantool.org> From: Vladislav Shpilevoy Message-ID: <3d8ffe27-4d38-3d8d-eb08-d40adfc27783@tarantool.org> Date: Wed, 16 May 2018 15:33:10 +0300 MIME-Version: 1.0 In-Reply-To: <6702e8ecd47238730a4ba27e87fe7bf082a874c6.1526403792.git.kshcherbatov@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: Kirill Shcherbatov , tarantool-patches@freelists.org Hello. See below 3 minor comments. On 15/05/2018 20:03, Kirill Shcherbatov wrote: > This patch allows to remove Checks from SQL to > server as sqlite3ResolveSelfReference requires > Expr structure pointer. > > Part of #3272. > --- > src/box/field_def.c | 1 + > src/box/field_def.h | 14 +++++ > src/box/sql.c | 20 +++--- > src/box/sql/alter.c | 2 +- > src/box/sql/analyze.c | 2 +- > src/box/sql/build.c | 100 +++++++++++------------------- > src/box/sql/delete.c | 4 +- > src/box/sql/expr.c | 158 ++++++++++++++++++++++++++---------------------- > src/box/sql/fkey.c | 18 +++--- > src/box/sql/insert.c | 47 ++++++++------ > src/box/sql/pragma.c | 10 +-- > src/box/sql/resolve.c | 12 ++-- > src/box/sql/select.c | 26 +++++--- > src/box/sql/sqliteInt.h | 44 +++----------- > src/box/sql/update.c | 35 +++++------ > src/box/sql/vdbe.c | 26 ++++---- > src/box/sql/vdbeaux.c | 37 ------------ > src/box/sql/vdbemem.c | 18 +++--- > src/box/sql/where.c | 15 +++-- > src/box/sql/wherecode.c | 35 ++++++----- > src/box/sql/whereexpr.c | 6 +- > 21 files changed, 293 insertions(+), 337 deletions(-) > > diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c > index 119940c..9a8f045 100644 > --- a/src/box/sql/expr.c > +++ b/src/box/sql/expr.c > @@ -3519,45 +3526,48 > -/* > +/** > * Generate code to extract the value of the iCol-th column of a table. > + * @param v The VDBE under construction. > + * @param space_def Space definition. > + * @param iTabCur The PK cursor. > + * @param iCol Index of the column to extract. > + * @param regOut Extract the value into this register. 1. Lets move this comment to the header. > */ > void > -sqlite3ExprCodeGetColumnOfTable(Vdbe * v, /* The VDBE under construction */ > - Table * pTab, /* The table containing the value */ > - int iTabCur, /* The PK cursor */ > - int iCol, /* Index of the column to extract */ > - int regOut /* Extract the value into this register */ > - ) > +sqlite3ExprCodeGetColumnOfTable(Vdbe *v, struct space_def *space_def, > + int iTabCur, int iCol, int regOut) > { > sqlite3VdbeAddOp3(v, OP_Column, iTabCur, iCol, regOut); > if (iCol >= 0) { > - sqlite3ColumnDefault(v, pTab, iCol, regOut); > + sqlite3ColumnDefault(v, space_def, iCol, regOut); > } > } > > -/* > +/** > * Generate code that will extract the iColumn-th column from > * table pTab and store the column value in a register. > * > - * An effort is made to store the column value in register iReg. This > - * is not garanteeed for GetColumn() - the result can be stored in > - * any register. But the result is guaranteed to land in register iReg > - * for GetColumnToReg(). > + * An effort is made to store the column value in register iReg. > + * This is not garanteeed for GetColumn() - the result can be > + * stored in any register. But the result is guaranteed to land > + * in register iReg for GetColumnToReg(). > + * @param pParse Parsing and code generating context. > + * @param space_def Space definition. > + * @param iColumn Index of the table column. > + * @param iTable The cursor pointing to the table. > + * @param iReg Store results here. > + * @param p5 P5 value for OP_Column + FLAGS. > + * @return iReg value. 2. Same. > */ > int > -sqlite3ExprCodeGetColumn(Parse * pParse, /* Parsing and code generating context */ > - Table * pTab, /* Description of the table we are reading from */ > - int iColumn, /* Index of the table column */ > - int iTable, /* The cursor pointing to the table */ > - int iReg, /* Store results here */ > - u8 p5 /* P5 value for OP_Column + FLAGS */ > - ) > +sqlite3ExprCodeGetColumn(Parse *pParse, struct space_def *space_def, > + int iColumn, int iTable, int iReg, u8 p5) > { > Vdbe *v = pParse->pVdbe; > int i; > @@ -3572,7 +3582,7 @@ sqlite3ExprCodeGetColumn(Parse * pParse, /* Parsing and code generating context > } > } > assert(v != 0); > - sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg); > + sqlite3ExprCodeGetColumnOfTable(v, space_def, iTable, iColumn, iReg); > if (p5) { > sqlite3VdbeChangeP5(v, p5); > } else { > @@ -3581,16 +3591,22 @@ sqlite3ExprCodeGetColumn(Parse * pParse, /* Parsing and code generating context > return iReg; > } > > +/** > + * Generate code that will extract the iColumn-th column from > + * table pTab and store the column value in a register, copy the > + * result. > + * @param pParse Parsing and code generating context. > + * @param space_def Space definition. > + * @param iColumn Index of the table column. > + * @param iTable The cursor pointing to the table. > + * @param iReg Store results here. 3. Same.