Assorted minor changes to speed up loading the database schema. (CVS 2293)
FossilOrigin-Name: dfbd684a913022ad43ce59c3422d3d94f776d547
This commit is contained in:
parent
d5b6b38d6f
commit
c60e9b82db
22
manifest
22
manifest
@ -1,5 +1,5 @@
|
||||
C User-contributed\schagnes\sto\stclinstaller\sso\sthat\sit\ssupports\sDESTDIR.\s(CVS\s2292)
|
||||
D 2005-01-30T22:10:01
|
||||
C Assorted\sminor\schanges\sto\sspeed\sup\sloading\sthe\sdatabase\sschema.\s(CVS\s2293)
|
||||
D 2005-01-31T12:42:29
|
||||
F Makefile.in ffd81f5e926d40b457071b4de8d7c1fa18f39b5a
|
||||
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
|
||||
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
|
||||
@ -31,7 +31,7 @@ F src/attach.c f78f76bc6a8e5e487ca53636e21ccba2484a9a61
|
||||
F src/auth.c 18c5a0befe20f3a58a41e3ddd78f372faeeefe1f
|
||||
F src/btree.c e68ae12c8b12ef9d45d58d931c36c184055a3880
|
||||
F src/btree.h 74d19cf40ab49fd69abe9e4e12a6c321ad86c497
|
||||
F src/build.c e35b7f93c4761b7e757dcce908d336a9adf9b43d
|
||||
F src/build.c 3eae8b0ecad583ad10910f0e64c14605f01425bc
|
||||
F src/cursor.c de73c00aefc4747ad59b5105cf38bbff0667922e
|
||||
F src/date.c f3d1f5cd1503dabf426a198f3ebef5afbc122a7f
|
||||
F src/delete.c 4b94395b52a8f7785acd71135c2ce54f3f5550b3
|
||||
@ -42,7 +42,7 @@ F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
|
||||
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
|
||||
F src/insert.c 6ab596846d52bd63d6227f9128a29e4f5b2cf524
|
||||
F src/legacy.c d58ea507bce885298a2c8c3cbb0f4bff5d47830b
|
||||
F src/main.c 612531a2e6fba994274732acae76d7d19b9f90fd
|
||||
F src/main.c f08a57ab88b4175cf7594caf03974c5a8bc63904
|
||||
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
|
||||
F src/os.h ae44064dc118b20d39450cb331409a775e8bb1c6
|
||||
F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73
|
||||
@ -58,7 +58,7 @@ F src/parse.y 959948ee97434a7bab3aa04094cd5be6b7501e8d
|
||||
F src/pragma.c c893f03104e94e0921861bd2d3dbd80c47515f7b
|
||||
F src/printf.c 3d20b21cfecadacecac3fb7274e746cb81d3d357
|
||||
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
|
||||
F src/select.c 4382c7787651e0546d875e38f7fbe646f89bf7ab
|
||||
F src/select.c fee51a0d40f1b56d1157f49f9f0fe7fc5af38769
|
||||
F src/shell.c 1f0da77ef0520afd6df71f4781076021874310f3
|
||||
F src/sqlite.h.in 7d7c28344e2bd770491b56ed9169be20859c707d
|
||||
F src/sqliteInt.h d5052f5a9badbde9e746e40522e8ab823b1670d5
|
||||
@ -69,7 +69,7 @@ F src/test2.c bbc2ecc58ceeab12d1e40970f831b1017524e40d
|
||||
F src/test3.c 683e1e3819152ffd35da2f201e507228921148d0
|
||||
F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
|
||||
F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5
|
||||
F src/tokenize.c 88bef43fe3e3c8865a7447f934296ac13238c4f6
|
||||
F src/tokenize.c bbeee5e30019261fe2d36330d2bf70d9d7c3eee9
|
||||
F src/trigger.c 038c8e128d4551cd016426cd11bbf5c478816481
|
||||
F src/update.c b6f4668c11059f86b71581187d09197fa28ec4be
|
||||
F src/utf.c bda5eb85039ef16f2d17004c1e18c96e1ab0a80c
|
||||
@ -216,7 +216,7 @@ F tool/lempar.c 1e61d2b6cb9d8affa264a13336bc0c088498caa4
|
||||
F tool/memleak.awk 4e7690a51bf3ed757e611273d43fe3f65b510133
|
||||
F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
|
||||
F tool/memleak3.tcl b8eb053190e95a55dc188896afb972e8108822d6
|
||||
F tool/mkkeywordhash.c a62da87d6f22e8864bd75ae5a54afc57b0bf17b0
|
||||
F tool/mkkeywordhash.c 18e45fb1c39ed3020b3bc2e133fc65e88c229eed
|
||||
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
|
||||
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
|
||||
F tool/report1.txt 9eae07f26a8fc53889b45fc833a66a33daa22816
|
||||
@ -272,7 +272,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc
|
||||
F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
|
||||
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
|
||||
F www/whentouse.tcl 3e522a06ad41992023c80ca29a048ae2331ca5bd
|
||||
P 9843c0dd795ceda3c260986f95b101a0cbc7cf64
|
||||
R 9f28a14b2620eeeb6b7389e87630926c
|
||||
U drh
|
||||
Z 6778e5fa551c19c41b95ae28108056bc
|
||||
P ab8dbcf563b9069ce2049877bba69e5057f5b727
|
||||
R c5bc61b4921e61737a0a37e77ce02d08
|
||||
U danielk1977
|
||||
Z c0ee69a19b4bc86e7c0eec9c4705d3d5
|
||||
|
@ -1 +1 @@
|
||||
ab8dbcf563b9069ce2049877bba69e5057f5b727
|
||||
dfbd684a913022ad43ce59c3422d3d94f776d547
|
33
src/build.c
33
src/build.c
@ -22,7 +22,7 @@
|
||||
** COMMIT
|
||||
** ROLLBACK
|
||||
**
|
||||
** $Id: build.c,v 1.301 2005/01/29 08:32:45 danielk1977 Exp $
|
||||
** $Id: build.c,v 1.302 2005/01/31 12:42:29 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@ -785,6 +785,19 @@ begin_table_error:
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** This macro is used to compare two strings in a case-insensitive manner.
|
||||
** It is slightly faster than calling sqlite3StrICmp() directly, but
|
||||
** produces larger code.
|
||||
**
|
||||
** WARNING: This macro is not compatible with the strcmp() family. It
|
||||
** returns true if the two strings are equal, otherwise false.
|
||||
*/
|
||||
#define STRICMP(x, y) (\
|
||||
sqlite3UpperToLower[*(unsigned char *)(x)]== \
|
||||
sqlite3UpperToLower[*(unsigned char *)(y)] \
|
||||
&& sqlite3StrICmp((x)+1,(y)+1)==0 )
|
||||
|
||||
/*
|
||||
** Add a new column to the table currently being constructed.
|
||||
**
|
||||
@ -802,7 +815,7 @@ void sqlite3AddColumn(Parse *pParse, Token *pName){
|
||||
z = sqlite3NameFromToken(pName);
|
||||
if( z==0 ) return;
|
||||
for(i=0; i<p->nCol; i++){
|
||||
if( sqlite3StrICmp(z, p->aCol[i].zName)==0 ){
|
||||
if( STRICMP(z, p->aCol[i].zName) ){
|
||||
sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
|
||||
sqliteFree(z);
|
||||
return;
|
||||
@ -854,19 +867,21 @@ void sqlite3AddColumnType(Parse *pParse, Token *pFirst, Token *pLast){
|
||||
Table *p;
|
||||
int i, j;
|
||||
int n;
|
||||
char *z, **pz;
|
||||
char *z;
|
||||
const unsigned char *zIn;
|
||||
|
||||
Column *pCol;
|
||||
if( (p = pParse->pNewTable)==0 ) return;
|
||||
i = p->nCol-1;
|
||||
if( i<0 ) return;
|
||||
pCol = &p->aCol[i];
|
||||
pz = &pCol->zType;
|
||||
n = pLast->n + (pLast->z - pFirst->z);
|
||||
zIn = pFirst->z;
|
||||
n = pLast->n + (pLast->z - zIn);
|
||||
assert( pCol->zType==0 );
|
||||
z = pCol->zType = sqlite3MPrintf("%.*s", n, pFirst->z);
|
||||
z = pCol->zType = sqliteMallocRaw(n+1);
|
||||
if( z==0 ) return;
|
||||
for(i=j=0; z[i]; i++){
|
||||
int c = z[i];
|
||||
for(i=j=0; i<n; i++){
|
||||
int c = zIn[i];
|
||||
if( isspace(c) ) continue;
|
||||
z[j++] = c;
|
||||
}
|
||||
@ -1203,7 +1218,7 @@ CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName, int nName){
|
||||
** Scan the column type name zType (length nType) and return the
|
||||
** associated affinity type.
|
||||
*/
|
||||
char sqlite3AffinityType(const char *zType, int nType){
|
||||
static char sqlite3AffinityType(const char *zType, int nType){
|
||||
int n, i;
|
||||
static const struct {
|
||||
const char *zSub; /* Keywords substring to search for */
|
||||
|
@ -14,7 +14,7 @@
|
||||
** other files are for internal use by SQLite and should not be
|
||||
** accessed by users of the library.
|
||||
**
|
||||
** $Id: main.c,v 1.276 2005/01/29 08:32:45 danielk1977 Exp $
|
||||
** $Id: main.c,v 1.277 2005/01/31 12:42:29 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -279,7 +279,7 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
|
||||
}else{
|
||||
char *zSql;
|
||||
zSql = sqlite3MPrintf(
|
||||
"SELECT name, rootpage, sql, %s FROM '%q'.%s",
|
||||
"SELECT name, rootpage, sql, '%s' FROM '%q'.%s",
|
||||
zDbNum, db->aDb[iDb].zName, zMasterName);
|
||||
sqlite3SafetyOff(db);
|
||||
rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0);
|
||||
|
@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle SELECT statements in SQLite.
|
||||
**
|
||||
** $Id: select.c,v 1.236 2005/01/30 11:11:44 danielk1977 Exp $
|
||||
** $Id: select.c,v 1.237 2005/01/31 12:42:29 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -918,10 +918,7 @@ Table *sqlite3ResultSetOfSelect(Parse *pParse, char *zTabName, Select *pSelect){
|
||||
sNC.pSrcList = pSelect->pSrc;
|
||||
zType = sqliteStrDup(columnType(&sNC, p));
|
||||
pCol->zType = zType;
|
||||
pCol->affinity = SQLITE_AFF_NUMERIC;
|
||||
if( zType ){
|
||||
pCol->affinity = sqlite3AffinityType(zType, strlen(zType));
|
||||
}
|
||||
pCol->affinity = sqlite3ExprAffinity(p);
|
||||
pCol->pColl = sqlite3ExprCollSeq(pParse, p);
|
||||
if( !pCol->pColl ){
|
||||
pCol->pColl = pParse->db->pDfltColl;
|
||||
|
@ -15,7 +15,7 @@
|
||||
** individual tokens and sends those tokens one-by-one over to the
|
||||
** parser for analysis.
|
||||
**
|
||||
** $Id: tokenize.c,v 1.99 2005/01/18 04:00:44 drh Exp $
|
||||
** $Id: tokenize.c,v 1.100 2005/01/31 12:42:29 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "os.h"
|
||||
@ -71,7 +71,7 @@ static const char isIdChar[] = {
|
||||
** Return the length of the token that begins at z[0].
|
||||
** Store the token type in *tokenType before returning.
|
||||
*/
|
||||
int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
||||
static int getToken(const unsigned char *z, int *tokenType){
|
||||
int i, c;
|
||||
switch( *z ){
|
||||
case ' ': case '\t': case '\n': case '\f': case '\r': {
|
||||
@ -309,13 +309,16 @@ int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
||||
break;
|
||||
}
|
||||
for(i=1; IdChar(z[i]); i++){}
|
||||
*tokenType = sqlite3KeywordCode((char*)z, i);
|
||||
*tokenType = keywordCode((char*)z, i);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
*tokenType = TK_ILLEGAL;
|
||||
return 1;
|
||||
}
|
||||
int sqlite3GetToken(const unsigned char *z, int *tokenType){
|
||||
return getToken(z, tokenType);
|
||||
}
|
||||
|
||||
/*
|
||||
** Run the parser on the given SQL string. The parser structure is
|
||||
@ -355,7 +358,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
|
||||
assert( i>=0 );
|
||||
pParse->sLastToken.z = &zSql[i];
|
||||
assert( pParse->sLastToken.dyn==0 );
|
||||
pParse->sLastToken.n = sqlite3GetToken((unsigned char*)&zSql[i],&tokenType);
|
||||
pParse->sLastToken.n = getToken((unsigned char*)&zSql[i],&tokenType);
|
||||
i += pParse->sLastToken.n;
|
||||
switch( tokenType ){
|
||||
case TK_SPACE:
|
||||
|
@ -409,7 +409,7 @@ int main(int argc, char **argv){
|
||||
}
|
||||
|
||||
/* Begin generating code */
|
||||
printf("int sqlite3KeywordCode(const char *z, int n){\n");
|
||||
printf("static int keywordCode(const char *z, int n){\n");
|
||||
|
||||
printf(" static const char zText[%d] =\n", nChar+1);
|
||||
for(i=j=0; i<NKEYWORD; i++){
|
||||
@ -499,6 +499,9 @@ int main(int argc, char **argv){
|
||||
printf(" }\n");
|
||||
printf(" return TK_ID;\n");
|
||||
printf("}\n");
|
||||
printf("int sqlite3KeywordCode(const char *z, int n){\n");
|
||||
printf(" return keywordCode(z, n);\n");
|
||||
printf("}\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user