From: danielk1977 Date: Tue, 1 Feb 2005 01:21:55 +0000 (+0000) Subject: Replace sqlite3AffinityType() with a slightly faster version. (CVS 2296) X-Git-Tag: version-3.6.10~3856 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3dff964bd7a3564b1c1a7a0ad4450db4df4929f;p=thirdparty%2Fsqlite.git Replace sqlite3AffinityType() with a slightly faster version. (CVS 2296) FossilOrigin-Name: abe9f5e81f1196f28eec628e898b2a994c4d659d --- diff --git a/manifest b/manifest index 446c6a0cbe..c69cad6a00 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Performance\stweaks\sfor\ssqlite3AffinityType.\s(CVS\s2295) -D 2005-01-31T23:45:56 +C Replace\ssqlite3AffinityType()\swith\sa\sslightly\sfaster\sversion.\s(CVS\s2296) +D 2005-02-01T01:21:55 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 c09954ebeef8d7464305b4b2ff53f7fe193d7ae3 +F src/build.c 7e50cb572eedf50b3f5f499bce7d5340d9b00b63 F src/cursor.c de73c00aefc4747ad59b5105cf38bbff0667922e F src/date.c f3d1f5cd1503dabf426a198f3ebef5afbc122a7f F src/delete.c 4b94395b52a8f7785acd71135c2ce54f3f5550b3 @@ -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 5c10ccd8e99cab7e9f8e733dfd1447c2df1d25c1 -R 8e51075895dcc7f3464e186f35d155df -U drh -Z 78ca355ac379f133da207d92588fd08c +P 32b926154aaae9264359fa1e9a7189afd08b0bb7 +R 8e50ba8963e4eb03424af74a3c54cd49 +U danielk1977 +Z e5d48140c00b6d3b721213654c5201c0 diff --git a/manifest.uuid b/manifest.uuid index e39e924b16..46329c6886 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -32b926154aaae9264359fa1e9a7189afd08b0bb7 \ No newline at end of file +abe9f5e81f1196f28eec628e898b2a994c4d659d \ No newline at end of file diff --git a/src/build.c b/src/build.c index a4ca604288..2f8290cb82 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.304 2005/01/31 23:45:56 drh Exp $ +** $Id: build.c,v 1.305 2005/02/01 01:21:55 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -857,37 +857,46 @@ void sqlite3AddNotNull(Parse *pParse, int onError){ /* ** Scan the column type name zType (length nType) and return the ** associated affinity type. +** +** This routine does a case-independent search of zType for the +** substrings in the following table. If one of the substrings is +** found, the corresponding affinity is returned. If zType contains +** more than one of the substrings, entries toward the top of +** the table take priority. For example, if zType is 'BLOBINT', +** SQLITE_AFF_INTEGER is returned. +** +** Substring | Affinity +** -------------------------------- +** 'INT' | SQLITE_AFF_INTEGER +** 'CHAR' | SQLITE_AFF_TEXT +** 'CLOB' | SQLITE_AFF_TEXT +** 'TEXT' | SQLITE_AFF_TEXT +** 'BLOB' | SQLITE_AFF_NONE +** +** If none of the substrings in the above table are found, +** SQLITE_AFF_NUMERIC is returned. */ static char sqlite3AffinityType(const char *zType, int nType){ - int n, i; - static const struct { - const char *zSub; /* Keywords substring to search for */ - char nSub; /* length of zSub */ - char affinity; /* Affinity to return if it matches */ - } substrings[] = { - {"INT", 3, SQLITE_AFF_INTEGER}, - {"CHAR", 4, SQLITE_AFF_TEXT}, - {"CLOB", 4, SQLITE_AFF_TEXT}, - {"TEXT", 4, SQLITE_AFF_TEXT}, - {"BLOB", 4, SQLITE_AFF_NONE}, - }; - - if( nType==0 ){ - return SQLITE_AFF_NONE; - } - for(i=0; i