mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
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
This commit is contained in:
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Change\sthe\sdocumentation\sto\sclearly\sstate\sthat\sthe\sresult\sof\nsqlite3_column_type()\sis\sundefined\sfollowing\sa\stype\sconversion.\s(CVS\s4007)
|
||||
D 2007-05-15T14:17:25
|
||||
C Relax\sthe\srestriction\son\susing\sbytes\s0x80\sthrough\s0xbf\sas\sthe\sfirst\ncharacter\sof\san\sidentifier.\s\sEnhancements\sto\sALTER\sTABLE\stests\sfor\ntables\swith\sstrange\snames\sor\sstange\scolumn\snames.\s(CVS\s4008)
|
||||
D 2007-05-15T14:34:32
|
||||
F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -57,14 +57,14 @@ F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
|
||||
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
|
||||
F sqlite3.def a96c1d0d39362b763d2ddba220a32da41a15c4b4
|
||||
F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
|
||||
F src/alter.c 357378a0c09b654d9ae3764e58ba1034da4552b5
|
||||
F src/alter.c 1b1deeb97446ed87f2fa17a3eb6236548841a348
|
||||
F src/analyze.c e8fcb1c35ace8418615eb18d9601f321ac86b2ec
|
||||
F src/attach.c ba628db0c2b6a362f036d017bf1196cdfe4ebb37
|
||||
F src/auth.c 5ea90bc93dfea46e9fe4bf531e14c7cd98219ecb
|
||||
F src/btree.c 0c2f9b06c90d7c59925c03153c9d47fd739c8ca5
|
||||
F src/btree.h 1d527bf61ed176f980c34999d5793a0fd45dcf8c
|
||||
F src/btreeInt.h cb3c0e9eb842d06079a62cdf3492c90c5db7ba75
|
||||
F src/build.c a27a21a23fb08db0a9d6711e296f54b04fa25cee
|
||||
F src/build.c 50992d92e131a9aa9aa6657fb1ddc13e176fd70c
|
||||
F src/callback.c 9c12535669a638f90a67e10440b99c7b93c0fbf4
|
||||
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
|
||||
F src/date.c 6049db7d5a8fdf2c677ff7d58fa31d4f6593c988
|
||||
@ -126,7 +126,7 @@ F src/test_md5.c 6c42bc0a3c0b54be34623ff77a0eec32b2fa96e3
|
||||
F src/test_schema.c ced72140a3a25c148975428e170ec1850d3c3a7d
|
||||
F src/test_server.c a6460daed0b92ecbc2531b6dc73717470e7a648c
|
||||
F src/test_tclvar.c 315e77c17f128ff8c06b38c08617fd07c825a95b
|
||||
F src/tokenize.c 9aa8e3f06f56a700ef498582dae431be3d5c4f4c
|
||||
F src/tokenize.c 6cef9e6fc454d789a32c5b509ccb193a2b01977b
|
||||
F src/trigger.c 420192efe3e6f03addf7897c60c3c8bf913d3493
|
||||
F src/update.c 3359041db390a8f856d67272f299600e2104f350
|
||||
F src/utf.c 3fe21361e83cfcf5c18764d8d5c59fffdf9144db
|
||||
@ -145,7 +145,7 @@ F src/where.c f3920748cc650fc25ac916215500bdb90dee568e
|
||||
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
F test/all.test 93a40a7612b3c5e6efd1f5b98496a8b02a45cfdb
|
||||
F test/alter.test e2b5ccf30f11cfe61693c7e8620a6691e6a504e1
|
||||
F test/alter.test fa99dbd9cba1f813b3f5a1c127e9f4fd58dc70ba
|
||||
F test/alter2.test 50c3f554b8236d179d72511c0a4f23c5eb7f2af3
|
||||
F test/alter3.test a6eec8f454be9b6ce73d8d7dc711453675a10ce7
|
||||
F test/altermalloc.test 19323e0f452834044c27a54c6e78554d706de7ba
|
||||
@ -491,7 +491,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P b5e85deb5a0316781a6f39d6085b9fcfb9f88c6d
|
||||
R 2c94f4739f016800a57525b336740acc
|
||||
P 960be575e2b062a34c96d006e411ad34ded58063
|
||||
R f0d56e6c9e184f0b4efe24d6555a4f23
|
||||
U drh
|
||||
Z 5d300394ab97e7ae63df9330c51a060a
|
||||
Z 85b2f0c86d0a527b2d32d29007854e33
|
||||
|
@ -1 +1 @@
|
||||
960be575e2b062a34c96d006e411ad34ded58063
|
||||
262a3e6339b31f269f8f07e43d295b90827e2779
|
@ -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,
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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++){}
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this script is testing the ALTER TABLE statement.
|
||||
#
|
||||
# $Id: alter.test,v 1.23 2007/05/15 09:00:16 drh Exp $
|
||||
# $Id: alter.test,v 1.24 2007/05/15 14:34:32 drh Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -703,6 +703,10 @@ do_test alter-11.1 {
|
||||
}
|
||||
} {1 {duplicate column name: abc}}
|
||||
do_test alter-11.2 {
|
||||
execsql {INSERT INTO t11 VALUES(1,2)}
|
||||
sqlite3_exec db {SELECT %c6%c6 AS xyz, abc FROM t11}
|
||||
} {0 {xyz abc 1 2}}
|
||||
do_test alter-11.3 {
|
||||
sqlite3_exec db {CREATE TABLE t11b("%81%82%83" text)}
|
||||
execsql {
|
||||
ALTER TABLE t11b ADD COLUMN abc;
|
||||
@ -711,9 +715,35 @@ do_test alter-11.2 {
|
||||
ALTER TABLE t11b ADD COLUMN abc;
|
||||
}
|
||||
} {1 {duplicate column name: abc}}
|
||||
do_test alter-11.3 {
|
||||
set v [sqlite3_exec db {CREATE TABLE t11c(%81%82%83 text)}]
|
||||
set v [string range $v 0 20]\175
|
||||
} {1 {unrecognized token}}
|
||||
do_test alter-11.4 {
|
||||
execsql {INSERT INTO t11b VALUES(3,4)}
|
||||
sqlite3_exec db {SELECT %81%82%83 AS xyz, abc FROM t11b}
|
||||
} {0 {xyz abc 3 4}}
|
||||
do_test alter-11.5 {
|
||||
sqlite3_exec db {SELECT [%81%82%83] AS xyz, abc FROM t11b}
|
||||
} {0 {xyz abc 3 4}}
|
||||
do_test alter-11.6 {
|
||||
sqlite3_exec db {SELECT "%81%82%83" AS xyz, abc FROM t11b}
|
||||
} {0 {xyz abc 3 4}}
|
||||
do_test alter-11.7 {
|
||||
sqlite3_exec db {CREATE TABLE t11c(%81%82%83 text)}
|
||||
execsql {
|
||||
ALTER TABLE t11c ADD COLUMN abc;
|
||||
}
|
||||
catchsql {
|
||||
ALTER TABLE t11c ADD COLUMN abc;
|
||||
}
|
||||
} {1 {duplicate column name: abc}}
|
||||
do_test alter-11.8 {
|
||||
execsql {INSERT INTO t11c VALUES(5,6)}
|
||||
sqlite3_exec db {SELECT %81%82%83 AS xyz, abc FROM t11c}
|
||||
} {0 {xyz abc 5 6}}
|
||||
do_test alter-11.9 {
|
||||
sqlite3_exec db {SELECT [%81%82%83] AS xyz, abc FROM t11c}
|
||||
} {0 {xyz abc 5 6}}
|
||||
do_test alter-11.10 {
|
||||
sqlite3_exec db {SELECT "%81%82%83" AS xyz, abc FROM t11c}
|
||||
} {0 {xyz abc 5 6}}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user