SQLite

Check-in [32b926154a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Performance tweaks for sqlite3AffinityType. (CVS 2295)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 32b926154aaae9264359fa1e9a7189afd08b0bb7
User & Date: drh 2005-01-31 23:45:56.000
Context
2005-02-01
01:21
Replace sqlite3AffinityType() with a slightly faster version. (CVS 2296) (check-in: abe9f5e81f user: danielk1977 tags: trunk)
2005-01-31
23:45
Performance tweaks for sqlite3AffinityType. (CVS 2295) (check-in: 32b926154a user: drh tags: trunk)
12:56
Move sqlite3HashNoCase to hash.c. (CVS 2294) (check-in: 5c10ccd8e9 user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/build.c.
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
**     CREATE INDEX
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**
** $Id: build.c,v 1.303 2005/01/31 12:56:44 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Initialize the pParse structure as needed.







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
**     CREATE INDEX
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**
** $Id: build.c,v 1.304 2005/01/31 23:45:56 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Initialize the pParse structure as needed.
872
873
874
875
876
877
878
879
880

881
882
883
884
885
886
887
888
889
890
891
892
893
    {"BLOB", 4, SQLITE_AFF_NONE},
  };

  if( nType==0 ){
    return SQLITE_AFF_NONE;
  }
  for(i=0; i<sizeof(substrings)/sizeof(substrings[0]); i++){
    int c1 = substrings[i].zSub[0];
    int c2 = tolower(c1);

    int limit = nType - substrings[i].nSub;
    const char *z = substrings[i].zSub;
    for(n=0; n<=limit; n++){
      int c = zType[n];
      if( (c==c1 || c==c2)
             && 0==sqlite3StrNICmp(&zType[n], z, substrings[i].nSub) ){
        return substrings[i].affinity;
      }
    }
  }
  return SQLITE_AFF_NUMERIC;
}








|
|
>
|
|
|
<
<
|







872
873
874
875
876
877
878
879
880
881
882
883
884


885
886
887
888
889
890
891
892
    {"BLOB", 4, SQLITE_AFF_NONE},
  };

  if( nType==0 ){
    return SQLITE_AFF_NONE;
  }
  for(i=0; i<sizeof(substrings)/sizeof(substrings[0]); i++){
    const char *zSub = substrings[i].zSub;
    int c1 = tolower(zSub[0]);
    int len = substrings[i].nSub;
    int limit = nType - len;
    const char *z = zType;
    for(n=0; n<=limit; n++, z++){


      if( tolower(z[0])==c1 && 0==sqlite3StrNICmp(z, zSub, len) ){
        return substrings[i].affinity;
      }
    }
  }
  return SQLITE_AFF_NUMERIC;
}