SQLite

Check-in [9211e14cf8]
Login

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

Overview
Comment:Code cleanup in build.c. (CVS 1265)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9211e14cf81f4de125bad246d8a289786f2854aa
User & Date: drh 2004-02-22 18:56:49.000
Context
2004-02-22
20:05
Use sqliteVdbeOp3 instead of sqliteVdbeChangeP3 where applicable. (CVS 1266) (check-in: 51f1e8f753 user: drh tags: trunk)
18:56
Code cleanup in build.c. (CVS 1265) (check-in: 9211e14cf8 user: drh tags: trunk)
18:40
Use sqliteErrorMsg instead of sqliteSetString whereever practical. (CVS 1264) (check-in: 69aac043af user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/build.c.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**     PRAGMA
**
** $Id: build.c,v 1.172 2004/02/22 18:40:57 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Check to see if the schema for the database needs







|







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

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Check to see if the schema for the database needs
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
** The collation type is text (SQLITE_SO_TEXT) if the type
** name contains the character stream "text" or "blob" or
** "clob".  Any other type name is collated as numeric
** (SQLITE_SO_NUM).
*/
int sqliteCollateType(const char *zType, int nType){
  int i;
  for(i=0; i<nType-1; i++){
    switch( zType[i] ){
      case 'b':
      case 'B': {
        if( i<nType-3 && sqliteStrNICmp(&zType[i],"blob",4)==0 ){
          return SQLITE_SO_TEXT;
        }
        break;
      }
      case 'c':
      case 'C': {
        if( i<nType-3 && (sqliteStrNICmp(&zType[i],"char",4)==0 ||
                           sqliteStrNICmp(&zType[i],"clob",4)==0)
        ){
          return SQLITE_SO_TEXT;
        }
        break;
      }
      case 'x':
      case 'X': {
        if( i>=2 && sqliteStrNICmp(&zType[i-2],"text",4)==0 ){
          return SQLITE_SO_TEXT;
        }
        break;
      }
      default: {
        break;
      }
    }
  }
  return SQLITE_SO_NUM;
}

/*
** This routine is called by the parser while in the middle of







|
|
<
<
|
|
|
<
<
<
<
<
|
<
|
|
<
<
<
<
|
|
<
<
<
<
<
<







724
725
726
727
728
729
730
731
732


733
734
735





736

737
738




739
740






741
742
743
744
745
746
747
** The collation type is text (SQLITE_SO_TEXT) if the type
** name contains the character stream "text" or "blob" or
** "clob".  Any other type name is collated as numeric
** (SQLITE_SO_NUM).
*/
int sqliteCollateType(const char *zType, int nType){
  int i;
  for(i=0; i<nType-3; i++){
    int c = *(zType++) | 0x60;


    if( (c=='b' || c=='c') && sqliteStrNICmp(zType, "lob", 3)==0 ){
      return SQLITE_SO_TEXT;
    }





    if( c=='c' && sqliteStrNICmp(zType, "har", 3)==0 ){

      return SQLITE_SO_TEXT;
    }




    if( c=='t' && sqliteStrNICmp(zType, "ext", 3)==0 ){
      return SQLITE_SO_TEXT;






    }
  }
  return SQLITE_SO_NUM;
}

/*
** This routine is called by the parser while in the middle of