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 D7B262E186 for ; Sat, 25 May 2019 12:18:47 -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 qKI01KhthMES for ; Sat, 25 May 2019 12:18:47 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 942002E183 for ; Sat, 25 May 2019 12:18:47 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: [tarantool-patches] Re: [PATCH v1 11/21] sql: remove SQL_SCHEMA errcode From: "n.pettik" In-Reply-To: Date: Sat, 25 May 2019 19:18:45 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <1B71E3C3-D8A4-4A21-899C-9B17A463993B@tarantool.org> References: 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: tarantool-patches@freelists.org Cc: Imeev Mergen > diff --git a/src/box/sql/prepare.c b/src/box/sql/prepare.c > index 2083d27..61081fb 100644 > --- a/src/box/sql/prepare.c > +++ b/src/box/sql/prepare.c > @@ -190,56 +190,15 @@ sqlLockAndPrepare(sql * db, /* = Database handle. */ > sql_stmt ** ppStmt, /* OUT: A pointer to the = prepared statement */ > const char **pzTail) /* OUT: End of parsed = string */ > { > - int rc; Why not completely replace with sqlPrepare? > - > *ppStmt =3D 0; > assert(zSql !=3D NULL && db !=3D NULL); > - rc =3D sqlPrepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, > - pzTail); > - if (rc =3D=3D SQL_SCHEMA) { > - sql_finalize(*ppStmt); > - rc =3D sqlPrepare(db, zSql, nBytes, saveSqlFlag, pOld, = ppStmt, > - pzTail); > - } > - assert(rc =3D=3D 0 || *ppStmt =3D=3D 0); > - return rc; > -} > - > -/* > - * Rerun the compilation of a statement after a schema change. > - */ > -int > -sqlReprepare(Vdbe * p) > -{ > - int rc; > - sql_stmt *pNew; > - const char *zSql; > - sql *db; > - > - zSql =3D sql_sql((sql_stmt *) p); > - assert(zSql !=3D 0); /* Reprepare only called for = prepare_v2() statements */ > - db =3D sqlVdbeDb(p); > - rc =3D sqlLockAndPrepare(db, zSql, -1, 0, p, &pNew, 0); > - if (rc) { > - if (rc =3D=3D SQL_NOMEM) { > - sqlOomFault(db); > - } > - assert(pNew =3D=3D 0); > - return rc; > - } else { > - assert(pNew !=3D 0); > - } > - sqlVdbeSwap((Vdbe *) pNew, p); > - sqlTransferBindings(pNew, (sql_stmt *) p); > - sqlVdbeResetStepResult((Vdbe *) pNew); > - sqlVdbeFinalize((Vdbe *) pNew); > - return 0; > + return sqlPrepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, = pzTail); > } This routine may turn out to be useful when we add working prepared statements.