diff options
author | drh <drh@noemail.net> | 2007-05-15 14:34:32 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-05-15 14:34:32 +0000 |
commit | 9a087a99e5f94e043034ba368e61d2697af10136 (patch) | |
tree | c9fb487bee0fec3646c7fcb215ad013adaa7f009 /src | |
parent | 76cb812d2560a7c35b698631ec45b3f5b40cab38 (diff) | |
download | sqlite-9a087a99e5f94e043034ba368e61d2697af10136.tar.gz sqlite-9a087a99e5f94e043034ba368e61d2697af10136.zip |
Relax the restriction on using bytes 0x80 through 0xbf as the first
character of an identifier. Enhancements to ALTER TABLE tests for
tables with strange names or stange column names. (CVS 4008)
FossilOrigin-Name: 262a3e6339b31f269f8f07e43d295b90827e2779
Diffstat (limited to 'src')
-rw-r--r-- | src/alter.c | 7 | ||||
-rw-r--r-- | src/build.c | 9 | ||||
-rw-r--r-- | src/tokenize.c | 4 |
3 files changed, 7 insertions, 13 deletions
diff --git a/src/alter.c b/src/alter.c index 7049674b2..ddcedddcb 100644 --- a/src/alter.c +++ b/src/alter.c @@ -12,7 +12,7 @@ ** This file contains C code routines that used to generate VDBE code ** that implements the ALTER TABLE command. ** -** $Id: alter.c,v 1.24 2007/05/15 03:56:49 drh Exp $ +** $Id: alter.c,v 1.25 2007/05/15 14:34:32 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -273,7 +273,6 @@ void sqlite3AlterRenameTable( Table *pTab; /* Table being renamed */ char *zName = 0; /* NULL-terminated version of pName */ sqlite3 *db = pParse->db; /* Database connection */ - int i; /* Loop counter */ int nTabName; /* Number of UTF-8 characters in zTabName */ const char *zTabName; /* Original name of the table */ Vdbe *v; @@ -339,9 +338,7 @@ void sqlite3AlterRenameTable( /* figure out how many UTF-8 characters are in zName */ zTabName = pTab->zName; - for(i=nTabName=0; zTabName[i]; i++){ - if( (zTabName[i]&0xc0)!=0x80 ) nTabName++; - } + nTabName = sqlite3Utf8CharLen(zTabName, -1); /* Modify the sqlite_master table to use the new table name. */ sqlite3NestedParse(pParse, diff --git a/src/build.c b/src/build.c index 9f6cafd24..01665e3da 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.431 2007/05/15 03:56:49 drh Exp $ +** $Id: build.c,v 1.432 2007/05/15 14:34:32 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -1562,16 +1562,13 @@ void sqlite3EndTable( #ifndef SQLITE_OMIT_ALTERTABLE if( !p->pSelect ){ const char *zName = (const char *)pParse->sNameToken.z; - int nName, i, nUtfChar; + int nName; assert( !pSelect && pCons && pEnd ); if( pCons->z==0 ){ pCons = pEnd; } nName = (const char *)pCons->z - zName; - for(i=nUtfChar=0; i<nName; i++){ - if( (zName[i]&0xc0)!=0x80 ) nUtfChar++; - } - p->addColOffset = 13 + nUtfChar; + p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName); } #endif } diff --git a/src/tokenize.c b/src/tokenize.c index a9e0167b5..b5a7f8580 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -15,7 +15,7 @@ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** -** $Id: tokenize.c,v 1.128 2007/05/15 09:00:15 drh Exp $ +** $Id: tokenize.c,v 1.129 2007/05/15 14:34:32 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -365,7 +365,7 @@ static int getToken(const unsigned char *z, int *tokenType){ } #endif default: { - if( !IdChar(*z) || (*z & 0xc0)==0x80 ){ + if( !IdChar(*z) ){ break; } for(i=1; IdChar(z[i]); i++){} |