1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

Minor code and comment cleanup. (CVS 2165)

FossilOrigin-Name: d012628a78edaa8d3cb438a7dcc3770b2eb8588b
This commit is contained in:
drh
2004-12-14 03:34:34 +00:00
parent 6a8903c3fc
commit 23bf66d6af
5 changed files with 48 additions and 47 deletions

View File

@@ -1,5 +1,5 @@
C Factor\sthe\stest\sfor\szName==NULL\sout\sof\sthe\sloop.\s\sTicket\s#1032.\s(CVS\s2164) C Minor\scode\sand\scomment\scleanup.\s(CVS\s2165)
D 2004-12-10T18:00:04 D 2004-12-14T03:34:34
F Makefile.in da09f379b80c8cd78d78abaa0f32ca90a124e884 F Makefile.in da09f379b80c8cd78d78abaa0f32ca90a124e884
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
@@ -31,10 +31,10 @@ F src/attach.c e49d09dad9f5f9fb10b4b0c1be5a70ae4c45e689
F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea
F src/btree.c fa113d624d38bcb36700a0244b47f39d57d34efb F src/btree.c fa113d624d38bcb36700a0244b47f39d57d34efb
F src/btree.h 861e40b759a195ba63819740e484390012cf81ab F src/btree.h 861e40b759a195ba63819740e484390012cf81ab
F src/build.c 306e49e1f6f19741a40c1bbc23140027aa4f8cc9 F src/build.c af1296e8a21a406b4f4c4f1e1365e075071219f3
F src/cursor.c f883813759742068890b1f699335872bfa8fdf41 F src/cursor.c f883813759742068890b1f699335872bfa8fdf41
F src/date.c 65536e7ea04fdde6e0551264fca15966966e171f F src/date.c 65536e7ea04fdde6e0551264fca15966966e171f
F src/delete.c 4a70ac0bd0159fe38efdaf2cb44723256b0f7b37 F src/delete.c 6debe7893fa09bb5b386df0f26165f13132423e6
F src/expr.c d61efc526449a7a4c725325a3001a614cbcc3bed F src/expr.c d61efc526449a7a4c725325a3001a614cbcc3bed
F src/func.c b668e5ad043176049454c95a6a780367a0e8f6bb F src/func.c b668e5ad043176049454c95a6a780367a0e8f6bb
F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5 F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
@@ -82,7 +82,7 @@ F src/vdbeInt.h 0f74561e629af86172de7cdf0ecaea014c51696c
F src/vdbeapi.c 0cf3bdc1072616bedc8eec7fc22e3f5a169d33fd F src/vdbeapi.c 0cf3bdc1072616bedc8eec7fc22e3f5a169d33fd
F src/vdbeaux.c a7c4c90786e2633b38f2d89f3dc49aed747454e4 F src/vdbeaux.c a7c4c90786e2633b38f2d89f3dc49aed747454e4
F src/vdbemem.c 5876c8abf4374fef671f4fd8dc333ef3fc95a2f0 F src/vdbemem.c 5876c8abf4374fef671f4fd8dc333ef3fc95a2f0
F src/where.c f9d3b6f2243a0eb9065fa4c465fe0831a64b7db7 F src/where.c 35ea898e6414864afb819d3fde30f11179dbede0
F tclinstaller.tcl 36478c3bbfc5b93ceac42d94e3c736937b808432 F tclinstaller.tcl 36478c3bbfc5b93ceac42d94e3c736937b808432
F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c
F test/alter.test 95c57a4f461fa81293e0dccef7f83889aadb169a F test/alter.test 95c57a4f461fa81293e0dccef7f83889aadb169a
@@ -263,7 +263,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c
P 9eefabc92d3924bcaa2ae0f425fe5635824c64ec P 7f38f67c7b427ea46db2e95fdfadc1aae064c704
R d06a575b50fd36d04bb524dfbec46ef9 R 0372084bee24d5ee507746e9b7def4a4
U drh U drh
Z 2c0e72f9278bb2cb505aa806dd33e721 Z 08a84bfe20c08dc8299c4719dba55eae

View File

@@ -1 +1 @@
7f38f67c7b427ea46db2e95fdfadc1aae064c704 d012628a78edaa8d3cb438a7dcc3770b2eb8588b

View File

@@ -22,16 +22,14 @@
** COMMIT ** COMMIT
** ROLLBACK ** ROLLBACK
** **
** $Id: build.c,v 1.289 2004/12/07 12:29:18 drh Exp $ ** $Id: build.c,v 1.290 2004/12/14 03:34:34 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
/* /*
** This routine is called when a new SQL statement is beginning to ** This routine is called when a new SQL statement is beginning to
** be parsed. Check to see if the schema for the database needs ** be parsed. Initialize the pParse structure as needed.
** to be read from the SQLITE_MASTER and SQLITE_TEMP_MASTER tables.
** If it does, then read it.
*/ */
void sqlite3BeginParse(Parse *pParse, int explainFlag){ void sqlite3BeginParse(Parse *pParse, int explainFlag){
pParse->explain = explainFlag; pParse->explain = explainFlag;
@@ -85,7 +83,7 @@ void sqlite3FinishCoding(Parse *pParse){
** statement as its P3 argument. This does not change the functionality ** statement as its P3 argument. This does not change the functionality
** of the program. ** of the program.
** **
** This is used to implement sqlite3_trace() functionality. ** This is used to implement sqlite3_trace().
*/ */
sqlite3VdbeOp3(v, OP_Noop, 0, 0, pParse->zSql, pParse->zTail-pParse->zSql); sqlite3VdbeOp3(v, OP_Noop, 0, 0, pParse->zSql, pParse->zTail-pParse->zSql);
} }
@@ -518,7 +516,7 @@ void sqlite3OpenMasterTable(Vdbe *v, int iDb){
** index of the named database in db->aDb[], or -1 if the named db ** index of the named database in db->aDb[], or -1 if the named db
** does not exist. ** does not exist.
*/ */
int findDb(sqlite3 *db, Token *pName){ static int findDb(sqlite3 *db, Token *pName){
int i; /* Database number */ int i; /* Database number */
int n; /* Number of characters in the name */ int n; /* Number of characters in the name */
Db *pDb; /* A database whose name space is being searched */ Db *pDb; /* A database whose name space is being searched */
@@ -623,7 +621,7 @@ void sqlite3StartTable(
){ ){
Table *pTable; Table *pTable;
Index *pIdx; Index *pIdx;
char *zName; char *zName = 0; /* The name of the new table */
sqlite3 *db = pParse->db; sqlite3 *db = pParse->db;
Vdbe *v; Vdbe *v;
int iDb; /* Database number to create the table in */ int iDb; /* Database number to create the table in */
@@ -651,7 +649,6 @@ void sqlite3StartTable(
if( isTemp && iDb>1 ){ if( isTemp && iDb>1 ){
/* If creating a temp table, the name may not be qualified */ /* If creating a temp table, the name may not be qualified */
sqlite3ErrorMsg(pParse, "temporary table name must be unqualified"); sqlite3ErrorMsg(pParse, "temporary table name must be unqualified");
pParse->nErr++;
return; return;
} }
if( isTemp ) iDb = 1; if( isTemp ) iDb = 1;
@@ -660,8 +657,7 @@ void sqlite3StartTable(
zName = sqlite3NameFromToken(pName); zName = sqlite3NameFromToken(pName);
if( zName==0 ) return; if( zName==0 ) return;
if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
sqliteFree(zName); goto begin_table_error;
return;
} }
if( db->init.iDb==1 ) isTemp = 1; if( db->init.iDb==1 ) isTemp = 1;
#ifndef SQLITE_OMIT_AUTHORIZATION #ifndef SQLITE_OMIT_AUTHORIZATION
@@ -670,8 +666,7 @@ void sqlite3StartTable(
int code; int code;
char *zDb = db->aDb[iDb].zName; char *zDb = db->aDb[iDb].zName;
if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){ if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){
sqliteFree(zName); goto begin_table_error;
return;
} }
if( isView ){ if( isView ){
if( isTemp ){ if( isTemp ){
@@ -687,8 +682,7 @@ void sqlite3StartTable(
} }
} }
if( sqlite3AuthCheck(pParse, code, zName, 0, zDb) ){ if( sqlite3AuthCheck(pParse, code, zName, 0, zDb) ){
sqliteFree(zName); goto begin_table_error;
return;
} }
} }
#endif #endif
@@ -701,21 +695,18 @@ void sqlite3StartTable(
pTable = sqlite3FindTable(db, zName, db->aDb[iDb].zName); pTable = sqlite3FindTable(db, zName, db->aDb[iDb].zName);
if( pTable ){ if( pTable ){
sqlite3ErrorMsg(pParse, "table %T already exists", pName); sqlite3ErrorMsg(pParse, "table %T already exists", pName);
sqliteFree(zName); goto begin_table_error;
return;
} }
if( (pIdx = sqlite3FindIndex(db, zName, 0))!=0 && if( (pIdx = sqlite3FindIndex(db, zName, 0))!=0 &&
( iDb==0 || !db->init.busy) ){ ( iDb==0 || !db->init.busy) ){
sqlite3ErrorMsg(pParse, "there is already an index named %s", zName); sqlite3ErrorMsg(pParse, "there is already an index named %s", zName);
sqliteFree(zName); goto begin_table_error;
return;
} }
pTable = sqliteMalloc( sizeof(Table) ); pTable = sqliteMalloc( sizeof(Table) );
if( pTable==0 ){ if( pTable==0 ){
pParse->rc = SQLITE_NOMEM; pParse->rc = SQLITE_NOMEM;
pParse->nErr++; pParse->nErr++;
sqliteFree(zName); goto begin_table_error;
return;
} }
pTable->zName = zName; pTable->zName = zName;
pTable->nCol = 0; pTable->nCol = 0;
@@ -771,6 +762,14 @@ void sqlite3StartTable(
sqlite3VdbeAddOp(v, OP_PutIntKey, 0, 0); sqlite3VdbeAddOp(v, OP_PutIntKey, 0, 0);
sqlite3VdbeAddOp(v, OP_Close, 0, 0); sqlite3VdbeAddOp(v, OP_Close, 0, 0);
} }
/* Normal (non-error) return. */
return;
/* If an error occurs, we jump here */
begin_table_error:
sqliteFree(zName);
return;
} }
/* /*
@@ -898,9 +897,7 @@ void sqlite3AddDefaultValue(Parse *pParse, Expr *pExpr){
** error. ** error.
** **
** If the PRIMARY KEY is on a single column whose datatype is INTEGER, ** If the PRIMARY KEY is on a single column whose datatype is INTEGER,
** then we will try to use that column as the row id. (Exception: ** then we will try to use that column as the rowid. Set the Table.iPKey
** For backwards compatibility with older databases, do not do this
** if the file format version number is less than 1.) Set the Table.iPKey
** field of the table under construction to be the index of the ** field of the table under construction to be the index of the
** INTEGER PRIMARY KEY column. Table.iPKey is set to -1 if there is ** INTEGER PRIMARY KEY column. Table.iPKey is set to -1 if there is
** no INTEGER PRIMARY KEY. ** no INTEGER PRIMARY KEY.
@@ -2075,8 +2072,8 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
} }
/* /*
** Create a new index for an SQL table. pIndex is the name of the index ** Create a new index for an SQL table. pName1.pName2 is the name of the index
** and pTable is the name of the table that is to be indexed. Both will ** and pTblList is the name of the table that is to be indexed. Both will
** be NULL for a primary key or an index that is created to satisfy a ** be NULL for a primary key or an index that is created to satisfy a
** UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable ** UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable
** as the table to be indexed. pParse->pNewTable is a table that is ** as the table to be indexed. pParse->pNewTable is a table that is

View File

@@ -10,9 +10,9 @@
** **
************************************************************************* *************************************************************************
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle DELETE FROM statements. ** in order to generate code for DELETE FROM statements.
** **
** $Id: delete.c,v 1.92 2004/12/07 14:06:13 drh Exp $ ** $Id: delete.c,v 1.93 2004/12/14 03:34:34 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -66,7 +66,11 @@ void sqlite3OpenTableForReading(
/* /*
** Process a DELETE FROM statement. ** Generate code for a DELETE FROM statement.
**
** DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL;
** \________/ \________________/
** pTabList pWhere
*/ */
void sqlite3DeleteFrom( void sqlite3DeleteFrom(
Parse *pParse, /* The parser context */ Parse *pParse, /* The parser context */

View File

@@ -12,7 +12,7 @@
** This module contains C code that generates VDBE code used to process ** This module contains C code that generates VDBE code used to process
** the WHERE clause of SQL statements. ** the WHERE clause of SQL statements.
** **
** $Id: where.c,v 1.120 2004/11/23 01:47:31 drh Exp $ ** $Id: where.c,v 1.121 2004/12/14 03:34:34 drh Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -358,7 +358,7 @@ static int sortableByRowid(
** (2) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok' ** (2) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok'
** (3) SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok' ** (3) SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok'
** **
** The t2.z='ok' is disabled in the in (2) because it did not originate ** The t2.z='ok' is disabled in the in (2) because it originates
** in the ON clause. The term is disabled in (3) because it is not part ** in the ON clause. The term is disabled in (3) because it is not part
** of a LEFT OUTER JOIN. In (1), the term is not disabled. ** of a LEFT OUTER JOIN. In (1), the term is not disabled.
** **