[tarantool-patches] [PATCH 3/6] sql: remove start token from sql_create_index args

  • From: Nikita Pettik <korablev@xxxxxxxxxxxxx>
  • To: tarantool-patches@xxxxxxxxxxxxx
  • Date: Wed, 9 Jan 2019 14:13:17 +0200

It is not used anymore and can be removed.

Part of #3097
---
 src/box/sql/build.c     | 10 ++++------
 src/box/sql/parse.y     |  9 +++++----
 src/box/sql/sqliteInt.h |  5 ++---
 3 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index 963b16626..9d31cb736 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -727,7 +727,7 @@ sqlite3AddPrimaryKey(Parse * pParse,        /* Parsing 
context */
                                                             &token, 0));
                if (list == NULL)
                        goto primary_key_exit;
-               sql_create_index(pParse, 0, 0, list, 0, SORT_ORDER_ASC,
+               sql_create_index(pParse, 0, 0, list, SORT_ORDER_ASC,
                                 false, SQL_INDEX_TYPE_CONSTRAINT_PK);
                if (db->mallocFailed)
                        goto primary_key_exit;
@@ -736,7 +736,7 @@ sqlite3AddPrimaryKey(Parse * pParse,        /* Parsing 
context */
                                "INTEGER PRIMARY KEY or INT PRIMARY KEY");
                goto primary_key_exit;
        } else {
-               sql_create_index(pParse, 0, 0, pList, 0, sortOrder, false,
+               sql_create_index(pParse, 0, 0, pList, sortOrder, false,
                                 SQL_INDEX_TYPE_CONSTRAINT_PK);
                pList = 0;
                if (pParse->nErr > 0)
@@ -2227,8 +2227,8 @@ constraint_is_named(const char *name)
 void
 sql_create_index(struct Parse *parse, struct Token *token,
                 struct SrcList *tbl_name, struct ExprList *col_list,
-                MAYBE_UNUSED struct Token *start, enum sort_order sort_order,
-                bool if_not_exist, enum sql_index_type idx_type) {
+                enum sort_order sort_order, bool if_not_exist,
+                enum sql_index_type idx_type) {
        /* The index to be created. */
        struct index *index = NULL;
        /* Name of the index. */
@@ -2269,7 +2269,6 @@ sql_create_index(struct Parse *parse, struct Token *token,
                if (parse->pNewTable == NULL)
                        goto exit_create_index;
                assert(token == NULL);
-               assert(start == NULL);
                space = parse->pNewTable->space;
                def = parse->pNewTable->def;
        }
@@ -2524,7 +2523,6 @@ sql_create_index(struct Parse *parse, struct Token *token,
                                  P4_SPACEPTR);
                sqlite3VdbeChangeP5(vdbe, OPFLAG_SEEKEQ);
 
-               assert(start != NULL);
                int index_id = getNewIid(parse, def->id, cursor);
                sqlite3VdbeAddOp1(vdbe, OP_Close, cursor);
                vdbe_emit_create_index(parse, def, index->def,
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 874a67a9b..0b1cef597 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -262,7 +262,7 @@ ccons ::= NULL onconf(R).        {
 ccons ::= NOT NULL onconf(R).    {sql_column_add_nullable_action(pParse, R);}
 ccons ::= PRIMARY KEY sortorder(Z) autoinc(I).
                                  {sqlite3AddPrimaryKey(pParse,0,I,Z);}
-ccons ::= UNIQUE.                {sql_create_index(pParse,0,0,0,0,
+ccons ::= UNIQUE.                {sql_create_index(pParse,0,0,0,
                                                    SORT_ORDER_ASC, false,
                                                    
SQL_INDEX_TYPE_CONSTRAINT_UNIQUE);}
 ccons ::= CHECK LP expr(X) RP.   {sql_add_check_constraint(pParse,&X);}
@@ -313,7 +313,7 @@ tconsname ::= .                      
{pParse->constraint->name.n = 0;}
 tcons ::= PRIMARY KEY LP sortlist(X) autoinc(I) RP.
                                  {sqlite3AddPrimaryKey(pParse,X,I,0);}
 tcons ::= UNIQUE LP sortlist(X) RP.
-                                 {sql_create_index(pParse,0,0,X,0,
+                                 {sql_create_index(pParse,0,0,X,
                                                    SORT_ORDER_ASC,false,
                                                    
SQL_INDEX_TYPE_CONSTRAINT_UNIQUE);}
 tcons ::= CHECK LP expr(E) RP onconf.
@@ -1207,9 +1207,10 @@ paren_exprlist(A) ::= LP exprlist(X) RP.  {A = X;}
 
 ///////////////////////////// The CREATE INDEX command ///////////////////////
 //
-cmd ::= createkw(S) uniqueflag(U) INDEX ifnotexists(NE) nm(X)
+cmd ::= createkw uniqueflag(U) INDEX ifnotexists(NE) nm(X)
         ON nm(Y) LP sortlist(Z) RP. {
-  sql_create_index(pParse, &X, sqlite3SrcListAppend(pParse->db,0,&Y), Z, &S,
+
+  sql_create_index(pParse, &X, sqlite3SrcListAppend(pParse->db,0,&Y), Z,
                    SORT_ORDER_ASC, NE, U);
 }
 
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index 51a5d01b5..67243ca01 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -3510,7 +3510,6 @@ void sqlite3IdListDelete(sqlite3 *, IdList *);
  * @param token Index name. May be NULL.
  * @param tbl_name Table to index. Use pParse->pNewTable ifNULL.
  * @param col_list A list of columns to be indexed.
- * @param start The CREATE token that begins this statement.
  * @param sort_order Sort order of primary key when pList==NULL.
  * @param if_not_exist Omit error if index already exists.
  * @param idx_type The index type.
@@ -3518,8 +3517,8 @@ void sqlite3IdListDelete(sqlite3 *, IdList *);
 void
 sql_create_index(struct Parse *parse, struct Token *token,
                 struct SrcList *tbl_name, struct ExprList *col_list,
-                struct Token *start, enum sort_order sort_order,
-                bool if_not_exist, enum sql_index_type idx_type);
+                enum sort_order sort_order, bool if_not_exist,
+                enum sql_index_type idx_type);
 
 /**
  * This routine will drop an existing named index.  This routine
-- 
2.15.1


Other related posts:

  • » [tarantool-patches] [PATCH 3/6] sql: remove start token from sql_create_index args - Nikita Pettik