Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Begin testing the new ATTACH and DETACH commands. (CVS 898) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7a0f8024a1323a15d0c83afe93024007 |
User & Date: | drh 2003-04-05 03:42:27.000 |
Context
2003-04-05
| ||
16:56 | More testing of ATTACH and DETACH. (CVS 899) (check-in: 51f515f28c user: drh tags: trunk) | |
03:42 | Begin testing the new ATTACH and DETACH commands. (CVS 898) (check-in: 7a0f8024a1 user: drh tags: trunk) | |
2003-04-03
| ||
19:35 | Fix for ticket #276. (CVS 897) (check-in: 452128c6fd user: drh tags: trunk) | |
Changes
Changes to src/build.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 | ** COPY ** VACUUM ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** PRAGMA ** | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ** COPY ** VACUUM ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** PRAGMA ** ** $Id: build.c,v 1.140 2003/04/05 03:42:27 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 |
︙ | ︙ | |||
2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 | Db *aNew; int rc, i; char *zFile, *zName; sqlite *db; if( pParse->explain ) return; db = pParse->db; if( db->nDb>=MAX_ATTACHED ){ sqliteErrorMsg(pParse, "too many attached databases - max %d", MAX_ATTACHED); return; } if( db->aDb==db->aDbStatic ){ aNew = sqliteMalloc( sizeof(db->aDb[0])*3 ); | > > > > > | 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 | Db *aNew; int rc, i; char *zFile, *zName; sqlite *db; if( pParse->explain ) return; db = pParse->db; if( db->file_format<4 ){ sqliteErrorMsg(pParse, "cannot attach auxiliary databases to an " "older format master database", 0); return; } if( db->nDb>=MAX_ATTACHED ){ sqliteErrorMsg(pParse, "too many attached databases - max %d", MAX_ATTACHED); return; } if( db->aDb==db->aDbStatic ){ aNew = sqliteMalloc( sizeof(db->aDb[0])*3 ); |
︙ | ︙ | |||
2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 | sqliteErrorMsg(pParse, "unable to open database: %s", zFile); } sqliteFree(zFile); db->flags &= ~SQLITE_Initialized; if( pParse->nErr ) return; rc = sqliteInit(pParse->db, &pParse->zErrMsg); if( rc ){ pParse->nErr++; } } /* ** This routine is called by the parser to process a DETACH statement: ** | > | 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 | sqliteErrorMsg(pParse, "unable to open database: %s", zFile); } sqliteFree(zFile); db->flags &= ~SQLITE_Initialized; if( pParse->nErr ) return; rc = sqliteInit(pParse->db, &pParse->zErrMsg); if( rc ){ sqliteResetInternalSchema(db, 0); pParse->nErr++; } } /* ** This routine is called by the parser to process a DETACH statement: ** |
︙ | ︙ |
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.121 2003/04/05 03:42:27 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** A pointer to this structure is used to communicate information |
︙ | ︙ | |||
293 294 295 296 297 298 299 | /* This happens if the database was initially empty */ db->file_format = 4; }else if( db->file_format>4 ){ sqliteBtreeCloseCursor(curMain); sqliteSetString(pzErrMsg, "unsupported file format", 0); return SQLITE_ERROR; } | | > > > > > | | > | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | /* This happens if the database was initially empty */ db->file_format = 4; }else if( db->file_format>4 ){ sqliteBtreeCloseCursor(curMain); sqliteSetString(pzErrMsg, "unsupported file format", 0); return SQLITE_ERROR; } }else if( db->file_format!=meta[2] || db->file_format<4 ){ assert( db->file_format>=4 ); if( meta[2]==0 ){ sqliteSetString(pzErrMsg, "cannot attach empty database: ", db->aDb[iDb].zName, 0); }else{ sqliteSetString(pzErrMsg, "incompatible file format in auxiliary " "database: ", db->aDb[iDb].zName, 0); } sqliteBtreeClose(db->aDb[iDb].pBt); db->aDb[iDb].pBt = 0; return SQLITE_FORMAT; } sqliteBtreeSetCacheSize(db->aDb[iDb].pBt, size); sqliteBtreeSetSafetyLevel(db->aDb[iDb].pBt, meta[4]==0 ? 2 : meta[4]); |
︙ | ︙ |
Added test/attach.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | # 2003 April 4 # # 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 implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # # $Id: attach.test,v 1.1 2003/04/05 03:42:27 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl file delete -force test2.db file delete -force test2.db-journal do_test attach-1.1 { execsql { CREATE TABLE t1(a,b); INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); SELECT * FROM t1; } } {1 2 3 4} do_test attach-1.2 { sqlite db2 test2.db execsql { CREATE TABLE t2(x,y); INSERT INTO t2 VALUES(1,'x'); INSERT INTO t2 VALUES(2,'y'); SELECT * FROM t2; } } {1 x 2 y} do_test attach-1.3 { execsql { ATTACH DATABASE 'test2.db' AS two; SELECT * FROM two.t2; } } {1 x 2 y} do_test attach-1.4 { execsql { SELECT * FROM t2; } } {1 x 2 y} do_test attach-1.5 { execsql { DETACH DATABASE two; SELECT * FROM t1; } } {1 2 3 4} do_test attach-1.6 { catchsql { SELECT * FROM t2; } } {1 {no such table: t2}} do_test attach-1.7 { catchsql { SELECT * FROM two.t2; } } {1 {no such table: two.t2}} db2 close finish_test |
Changes to test/auth.test.
|
| | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # 2003 April 4 # # 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 implements regression tests for SQLite library. The # focus of this script is testing the ATTACH and DETACH commands # and related functionality. # # $Id: auth.test,v 1.6 2003/04/05 03:42:27 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl if {[info command sqlite_set_authorizer]!=""} { |
︙ | ︙ |