Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix error reporting when trying to attach a database with a foriegn text encoding. (CVS 1545) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
beab038c71eecbabb1351b0c98a71f32 |
User & Date: | danielk1977 2004-06-09 12:30:05.000 |
Context
2004-06-09
| ||
14:01 | Change the MEMORY_DEBUG macro to SQLITE_DEBUG. (CVS 1546) (check-in: 428b685b71 user: drh tags: trunk) | |
12:30 | Fix error reporting when trying to attach a database with a foriegn text encoding. (CVS 1545) (check-in: beab038c71 user: danielk1977 tags: trunk) | |
09:55 | Some progress on user-defined collation sequences. (CVS 1544) (check-in: c634e71f19 user: danielk1977 tags: trunk) | |
Changes
Changes to src/attach.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. ** ** $Id: attach.c,v 1.14 2004/06/09 12:30:05 danielk1977 Exp $ */ #include "sqliteInt.h" /* ** This routine is called by the parser to process an ATTACH statement: ** ** ATTACH DATABASE filename AS dbname |
︙ | ︙ | |||
101 102 103 104 105 106 107 | sqliteCodecAttach(db, db->nDb-1, zKey, nKey); } #endif sqliteFree(zFile); db->flags &= ~SQLITE_Initialized; if( pParse->nErr ) return; if( rc==SQLITE_OK ){ | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | sqliteCodecAttach(db, db->nDb-1, zKey, nKey); } #endif sqliteFree(zFile); db->flags &= ~SQLITE_Initialized; if( pParse->nErr ) return; if( rc==SQLITE_OK ){ rc = sqlite3ReadSchema(pParse->db, &pParse->zErrMsg); } if( rc ){ int i = db->nDb - 1; assert( i>=2 ); if( db->aDb[i].pBt ){ sqlite3BtreeClose(db->aDb[i].pBt); db->aDb[i].pBt = 0; |
︙ | ︙ |
Changes to src/build.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** PRAGMA ** | | | 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.212 2004/06/09 12:30:05 danielk1977 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 |
︙ | ︙ | |||
126 127 128 129 130 131 132 | ** using the ATTACH command. ** ** See also sqlite3LocateTable(). */ Table *sqlite3FindTable(sqlite *db, const char *zName, const char *zDatabase){ Table *p = 0; int i; | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | ** using the ATTACH command. ** ** See also sqlite3LocateTable(). */ Table *sqlite3FindTable(sqlite *db, const char *zName, const char *zDatabase){ Table *p = 0; int i; int rc = sqlite3ReadSchema(db, 0); for(i=0; rc==SQLITE_OK && i<db->nDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ if( zDatabase!=0 && sqlite3StrICmp(zDatabase, db->aDb[j].zName) ) continue; p = sqlite3HashFind(&db->aDb[j].tblHash, zName, strlen(zName)+1); if( p ) break; } return p; |
︙ | ︙ | |||
179 180 181 182 183 184 185 | ** for duplicate index names is done.) The search order is ** TEMP first, then MAIN, then any auxiliary databases added ** using the ATTACH command. */ Index *sqlite3FindIndex(sqlite *db, const char *zName, const char *zDb){ Index *p = 0; int i; | | | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | ** for duplicate index names is done.) The search order is ** TEMP first, then MAIN, then any auxiliary databases added ** using the ATTACH command. */ Index *sqlite3FindIndex(sqlite *db, const char *zName, const char *zDb){ Index *p = 0; int i; int rc = sqlite3ReadSchema(db, 0); for(i=0; rc==SQLITE_OK && i<db->nDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zName) ) continue; p = sqlite3HashFind(&db->aDb[j].idxHash, zName, strlen(zName)+1); if( p ) break; } return p; |
︙ | ︙ |
Changes to src/main.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** ** $Id: main.c,v 1.209 2004/06/09 12:30:06 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** A pointer to this structure is used to communicate information |
︙ | ︙ | |||
378 379 380 381 382 383 384 | return rc; } /* ** This routine is a no-op if the database schema is already initialised. ** Otherwise, the schema is loaded. An error code is returned. */ | | < | | < < < < < | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | return rc; } /* ** This routine is a no-op if the database schema is already initialised. ** Otherwise, the schema is loaded. An error code is returned. */ int sqlite3ReadSchema(sqlite *db, char **pzErrMsg){ int rc = SQLITE_OK; if( !db->init.busy ){ if( (db->flags & SQLITE_Initialized)==0 ){ rc = sqlite3Init(db, pzErrMsg); } } assert( rc!=SQLITE_OK || (db->flags & SQLITE_Initialized)||db->init.busy ); return rc; } /* ** The version of the library */ const char rcsid[] = "@(#) \044Id: SQLite version " SQLITE_VERSION " $"; |
︙ | ︙ |
Changes to src/pragma.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** ** $Id: pragma.c,v 1.39 2004/06/09 12:30:06 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** Interpret the given string as a boolean value. */ |
︙ | ︙ | |||
199 200 201 202 203 204 205 | { OP_Dup, 0, 0, 0}, { OP_Integer, 0, 0, 0}, { OP_Ne, 0, 6, 0}, { OP_Integer, 0, 0, 0}, /* 5 */ { OP_Callback, 1, 0, 0}, }; int addr; | | > > > | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | { OP_Dup, 0, 0, 0}, { OP_Integer, 0, 0, 0}, { OP_Ne, 0, 6, 0}, { OP_Integer, 0, 0, 0}, /* 5 */ { OP_Callback, 1, 0, 0}, }; int addr; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } if( pRight->z==pLeft->z ){ sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "cache_size", P3_STATIC); addr = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize); sqlite3VdbeChangeP1(v, addr+5, MAX_PAGES); }else{ int size = atoi(zRight); |
︙ | ︙ | |||
239 240 241 242 243 244 245 | ** to its default value when the database is closed and reopened. ** N should be a positive integer. */ if( sqlite3StrICmp(zLeft,"cache_size")==0 ){ static VdbeOpList getCacheSize[] = { { OP_Callback, 1, 0, 0}, }; | | > > > | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | ** to its default value when the database is closed and reopened. ** N should be a positive integer. */ if( sqlite3StrICmp(zLeft,"cache_size")==0 ){ static VdbeOpList getCacheSize[] = { { OP_Callback, 1, 0, 0}, }; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } if( pRight->z==pLeft->z ){ int size = db->cache_size;; if( size<0 ) size = -size; sqlite3VdbeAddOp(v, OP_Integer, size, 0); sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "cache_size", P3_STATIC); sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize); |
︙ | ︙ | |||
290 291 292 293 294 295 296 | { OP_AddImm, 1, 0, 0}, { OP_Callback, 1, 0, 0}, { OP_Halt, 0, 0, 0}, { OP_AddImm, -1, 0, 0}, /* 9 */ { OP_Callback, 1, 0, 0} }; int addr; | | > > > | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | { OP_AddImm, 1, 0, 0}, { OP_Callback, 1, 0, 0}, { OP_Halt, 0, 0, 0}, { OP_AddImm, -1, 0, 0}, /* 9 */ { OP_Callback, 1, 0, 0} }; int addr; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } if( pRight->z==pLeft->z ){ sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "synchronous", P3_STATIC); addr = sqlite3VdbeAddOpList(v, ArraySize(getSync), getSync); sqlite3VdbeChangeP2(v, addr+2, addr+9); }else{ int size = db->cache_size; |
︙ | ︙ | |||
334 335 336 337 338 339 340 | ** default value will be restored the next time the database is ** opened. */ if( sqlite3StrICmp(zLeft,"synchronous")==0 ){ static VdbeOpList getSync[] = { { OP_Callback, 1, 0, 0}, }; | | > > > | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | ** default value will be restored the next time the database is ** opened. */ if( sqlite3StrICmp(zLeft,"synchronous")==0 ){ static VdbeOpList getSync[] = { { OP_Callback, 1, 0, 0}, }; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } if( pRight->z==pLeft->z ){ sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "synchronous", P3_STATIC); sqlite3VdbeAddOp(v, OP_Integer, db->safety_level-1, 0); sqlite3VdbeAddOpList(v, ArraySize(getSync), getSync); }else{ int size = db->cache_size; |
︙ | ︙ | |||
367 368 369 370 371 372 373 | if( flagPragma(pParse, zLeft, zRight) ){ /* The flagPragma() call also generates any necessary code */ }else if( sqlite3StrICmp(zLeft, "table_info")==0 ){ Table *pTab; | | > > > | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | if( flagPragma(pParse, zLeft, zRight) ){ /* The flagPragma() call also generates any necessary code */ }else if( sqlite3StrICmp(zLeft, "table_info")==0 ){ Table *pTab; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } pTab = sqlite3FindTable(db, zRight, 0); if( pTab ){ int i; sqlite3VdbeSetNumCols(v, 6); sqlite3VdbeSetColName(v, 0, "cid", P3_STATIC); sqlite3VdbeSetColName(v, 1, "name", P3_STATIC); sqlite3VdbeSetColName(v, 2, "type", P3_STATIC); |
︙ | ︙ | |||
396 397 398 399 400 401 402 | } } }else if( sqlite3StrICmp(zLeft, "index_info")==0 ){ Index *pIdx; Table *pTab; | | > > > | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | } } }else if( sqlite3StrICmp(zLeft, "index_info")==0 ){ Index *pIdx; Table *pTab; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } pIdx = sqlite3FindIndex(db, zRight, 0); if( pIdx ){ int i; pTab = pIdx->pTable; sqlite3VdbeSetNumCols(v, 3); sqlite3VdbeSetColName(v, 0, "seqno", P3_STATIC); sqlite3VdbeSetColName(v, 1, "cid", P3_STATIC); |
︙ | ︙ | |||
419 420 421 422 423 424 425 | } } }else if( sqlite3StrICmp(zLeft, "index_list")==0 ){ Index *pIdx; Table *pTab; | | > > > | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | } } }else if( sqlite3StrICmp(zLeft, "index_list")==0 ){ Index *pIdx; Table *pTab; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } pTab = sqlite3FindTable(db, zRight, 0); if( pTab ){ v = sqlite3GetVdbe(pParse); pIdx = pTab->pIndex; } if( pTab && pIdx ){ int i = 0; |
︙ | ︙ | |||
445 446 447 448 449 450 451 | } } }else if( sqlite3StrICmp(zLeft, "foreign_key_list")==0 ){ FKey *pFK; Table *pTab; | | > > > | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | } } }else if( sqlite3StrICmp(zLeft, "foreign_key_list")==0 ){ FKey *pFK; Table *pTab; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } pTab = sqlite3FindTable(db, zRight, 0); if( pTab ){ v = sqlite3GetVdbe(pParse); pFK = pTab->pFKey; } if( pTab && pFK ){ int i = 0; |
︙ | ︙ | |||
478 479 480 481 482 483 484 | pFK = pFK->pNextFrom; } } }else if( sqlite3StrICmp(zLeft, "database_list")==0 ){ int i; | | > > > | 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | pFK = pFK->pNextFrom; } } }else if( sqlite3StrICmp(zLeft, "database_list")==0 ){ int i; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } sqlite3VdbeSetNumCols(v, 3); sqlite3VdbeSetColName(v, 0, "seq", P3_STATIC); sqlite3VdbeSetColName(v, 1, "name", P3_STATIC); sqlite3VdbeSetColName(v, 2, "file", P3_STATIC); for(i=0; i<db->nDb; i++){ if( db->aDb[i].pBt==0 ) continue; assert( db->aDb[i].zName!=0 ); |
︙ | ︙ | |||
510 511 512 513 514 515 516 | ** Note that it is possible for the library compile-time options to ** override this setting */ if( sqlite3StrICmp(zLeft, "temp_store")==0 ){ static VdbeOpList getTmpDbLoc[] = { { OP_Callback, 1, 0, 0}, }; | | > > > | 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | ** Note that it is possible for the library compile-time options to ** override this setting */ if( sqlite3StrICmp(zLeft, "temp_store")==0 ){ static VdbeOpList getTmpDbLoc[] = { { OP_Callback, 1, 0, 0}, }; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } if( pRight->z==pLeft->z ){ sqlite3VdbeAddOp(v, OP_Integer, db->temp_store, 0); sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "temp_store", P3_STATIC); sqlite3VdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc); }else{ changeTempStorage(pParse, zRight); |
︙ | ︙ | |||
536 537 538 539 540 541 542 | ** Note that it is possible for the library compile-time options to ** override this setting */ if( sqlite3StrICmp(zLeft, "default_temp_store")==0 ){ static VdbeOpList getTmpDbLoc[] = { { OP_ReadCookie, 0, 5, 0}, { OP_Callback, 1, 0, 0}}; | | > > > | > > > | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | ** Note that it is possible for the library compile-time options to ** override this setting */ if( sqlite3StrICmp(zLeft, "default_temp_store")==0 ){ static VdbeOpList getTmpDbLoc[] = { { OP_ReadCookie, 0, 5, 0}, { OP_Callback, 1, 0, 0}}; if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } if( pRight->z==pLeft->z ){ sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "temp_store", P3_STATIC); sqlite3VdbeAddOpList(v, ArraySize(getTmpDbLoc), getTmpDbLoc); }else{ sqlite3BeginWriteOperation(pParse, 0, 0); sqlite3VdbeAddOp(v, OP_Integer, getTempStore(zRight), 0); sqlite3VdbeAddOp(v, OP_SetCookie, 0, 5); sqlite3EndWriteOperation(pParse); } }else #ifndef NDEBUG if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){ extern void sqlite3ParserTrace(FILE*, char *); if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } if( getBoolean(zRight) ){ sqlite3ParserTrace(stdout, "parser: "); }else{ sqlite3ParserTrace(0, 0); } }else #endif |
︙ | ︙ | |||
585 586 587 588 589 590 591 | { OP_Integer, 0, 0, 0}, { OP_Ne, 0, 0, 0}, /* 2 */ { OP_String8, 0, 0, "ok"}, { OP_Callback, 1, 0, 0}, }; /* Initialize the VDBE program */ | | > > > | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | { OP_Integer, 0, 0, 0}, { OP_Ne, 0, 0, 0}, /* 2 */ { OP_String8, 0, 0, "ok"}, { OP_Callback, 1, 0, 0}, }; /* Initialize the VDBE program */ if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "integrity_check", P3_STATIC); sqlite3VdbeAddOpList(v, ArraySize(initCode), initCode); /* Do an integrity check on each database file */ for(i=0; i<db->nDb; i++){ HashElem *x; |
︙ | ︙ | |||
730 731 732 733 734 735 736 | { "UTF16le", TEXT_Utf16le }, { "UTF16be", TEXT_Utf16be }, { "UTF16", TEXT_Utf16 }, { 0, 0 } }; struct EncName *pEnc; if( pRight->z==pLeft->z ){ /* "PRAGMA encoding" */ | | > > > | 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | { "UTF16le", TEXT_Utf16le }, { "UTF16be", TEXT_Utf16be }, { "UTF16", TEXT_Utf16 }, { 0, 0 } }; struct EncName *pEnc; if( pRight->z==pLeft->z ){ /* "PRAGMA encoding" */ if( SQLITE_OK!=sqlite3ReadSchema(pParse->db, &pParse->zErrMsg) ){ pParse->nErr++; return; } sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, "encoding", P3_STATIC); sqlite3VdbeAddOp(v, OP_String8, 0, 0); for(pEnc=&encnames[0]; pEnc->zName; pEnc++){ if( pEnc->enc==pParse->db->enc ){ sqlite3VdbeChangeP3(v, -1, pEnc->zName, P3_STATIC); break; |
︙ | ︙ |
Changes to src/sqliteInt.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** ** @(#) $Id: sqliteInt.h,v 1.274 2004/06/09 12:30:06 danielk1977 Exp $ */ #include "config.h" #include "sqlite3.h" #include "hash.h" #include "parse.h" #include <stdio.h> #include <stdlib.h> |
︙ | ︙ | |||
1385 1386 1387 1388 1389 1390 1391 | void sqlite3Error(sqlite *, int, const char*,...); int sqlite3utfTranslate(const void *, int , u8 , void **, int *, u8); u8 sqlite3UtfReadBom(const void *zData, int nData); void *sqlite3HexToBlob(const char *z); int sqlite3TwoPartName(Parse *, Token *, Token *, Token **); const char *sqlite3ErrStr(int); int sqlite3ReadUniChar(const char *zStr, int *pOffset, u8 *pEnc, int fold); | | | 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 | void sqlite3Error(sqlite *, int, const char*,...); int sqlite3utfTranslate(const void *, int , u8 , void **, int *, u8); u8 sqlite3UtfReadBom(const void *zData, int nData); void *sqlite3HexToBlob(const char *z); int sqlite3TwoPartName(Parse *, Token *, Token *, Token **); const char *sqlite3ErrStr(int); int sqlite3ReadUniChar(const char *zStr, int *pOffset, u8 *pEnc, int fold); int sqlite3ReadSchema(sqlite *db, char **); CollSeq *sqlite3FindCollSeq(sqlite *,const char *,int,int); CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName, int nName); CollSeq *sqlite3ExprCollSeq(Expr *pExpr); |
Changes to src/trigger.c.
︙ | ︙ | |||
417 418 419 420 421 422 423 | int i; const char *zDb; const char *zName; int nName; sqlite *db = pParse->db; if( sqlite3_malloc_failed ) goto drop_trigger_cleanup; | | > > > | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | int i; const char *zDb; const char *zName; int nName; sqlite *db = pParse->db; if( sqlite3_malloc_failed ) goto drop_trigger_cleanup; if( SQLITE_OK!=sqlite3ReadSchema(db, &pParse->zErrMsg) ){ pParse->nErr++; goto drop_trigger_cleanup; } assert( pName->nSrc==1 ); zDb = pName->a[0].zDatabase; zName = pName->a[0].zName; nName = strlen(zName); for(i=0; i<db->nDb; i++){ int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ |
︙ | ︙ |
Changes to test/enc2.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. The focus of # this file is testing the SQLite routines used for converting between the # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and # UTF-16be). # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. The focus of # this file is testing the SQLite routines used for converting between the # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and # UTF-16be). # # $Id: enc2.test,v 1.6 2004/06/09 12:30:06 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl db close # Return the UTF-8 representation of the supplied UTF-16 string $str. |
︙ | ︙ | |||
110 111 112 113 114 115 116 | # The three unicode encodings understood by SQLite. set encodings [list UTF-8 UTF-16le UTF-16be] set i 1 foreach enc $encodings { file delete -force test.db | | > > > > > > > > > > > > > > > > > > > > | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | # The three unicode encodings understood by SQLite. set encodings [list UTF-8 UTF-16le UTF-16be] set i 1 foreach enc $encodings { file delete -force test.db sqlite db test.db db eval "PRAGMA encoding = \"$enc\"" execsql $dbcontents db close run_test_script enc2-$i $enc incr i } # Test that it is an error to try to attach a database with a different # encoding to the main database. do_test enc2-4.1 { file delete -force test.db sqlite db test.db db eval "PRAGMA encoding = 'UTF-8'" db eval "CREATE TABLE abc(a, b, c);" } {} do_test enc2-4.2 { file delete -force test2.db sqlite db2 test2.db db2 eval "PRAGMA encoding = 'UTF-16'" db2 eval "CREATE TABLE abc(a, b, c);" } {} do_test enc2-4.3 { catchsql { ATTACH 'test2.db' as aux; } } {1 {attached databases must use the same text encoding as main database}} finish_test |