1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-15 11:41:13 +03:00

Rework the logic that generates a schema for tables created using

"CREATE TABLE ... AS SELECT ...".  Instead of trying to copy the raw
datatype string from the right-hand side, just make the type one 
of TEXT, INT, REAL, NUM, or nothing.  This is much simpler than 
trying to parse and quote datatype strings.  Other minor 
implifications to build.c are bundled with this change. (CVS 6626)

FossilOrigin-Name: 33cf83591e6e13875ef6ada5b8ac8ab07619d8bc
This commit is contained in:
drh
2009-05-11 20:53:28 +00:00
parent aaac8b4e1b
commit c4a64facce
10 changed files with 134 additions and 184 deletions

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.550 2009/05/09 18:59:42 drh Exp $
** $Id: main.c,v 1.551 2009/05/11 20:53:29 drh Exp $
*/
#include "sqliteInt.h"
@@ -1361,7 +1361,7 @@ static int createCollation(
){
CollSeq *pColl;
int enc2;
int nName;
int nName = sqlite3Strlen30(zName);
assert( sqlite3_mutex_held(db->mutex) );
@@ -1383,8 +1383,7 @@ static int createCollation(
** sequence. If so, and there are active VMs, return busy. If there
** are no active VMs, invalidate any pre-compiled statements.
*/
nName = sqlite3Strlen30(zName);
pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, nName, 0);
pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 0);
if( pColl && pColl->xCmp ){
if( db->activeVdbeCnt ){
sqlite3Error(db, SQLITE_BUSY,
@@ -1414,7 +1413,7 @@ static int createCollation(
}
}
pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, nName, 1);
pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 1);
if( pColl ){
pColl->xCmp = xCompare;
pColl->pUser = pCtx;
@@ -1603,7 +1602,7 @@ static int openDatabase(
if( db->mallocFailed ){
goto opendb_out;
}
db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 6, 0);
db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 0);
assert( db->pDfltColl!=0 );
/* Also add a UTF-8 case-insensitive collation sequence. */
@@ -1611,7 +1610,7 @@ static int openDatabase(
/* Set flags on the built-in collating sequences */
db->pDfltColl->type = SQLITE_COLL_BINARY;
pColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "NOCASE", 6, 0);
pColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "NOCASE", 0);
if( pColl ){
pColl->type = SQLITE_COLL_NOCASE;
}