/ Check-in [07c00fff]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixes to the test suite (no code changes) so that quick.test runs with OMIT_ATTACH builds. #2706. (CVS 4480)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 07c00fffe50e8380748f7ae02328531a75d64610
User & Date: danielk1977 2007-10-09 08:29:32
Context
2007-10-09
15:20
Fix a typo in the wince driver. Ticket #2710. See also ticket #2702. (CVS 4481) check-in: beb91af7 user: drh tags: trunk
08:29
Fixes to the test suite (no code changes) so that quick.test runs with OMIT_ATTACH builds. #2706. (CVS 4480) check-in: 07c00fff user: danielk1977 tags: trunk
2007-10-08
15:06
More untested changes for wince contributed by users. Ticket #2702. (CVS 4479) check-in: ccd709e1 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/alter.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the ALTER TABLE statement.
    13     13   #
    14         -# $Id: alter.test,v 1.25 2007/05/15 16:51:37 drh Exp $
           14  +# $Id: alter.test,v 1.26 2007/10/09 08:29:32 danielk1977 Exp $
    15     15   #
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
    21     21   ifcapable !altertable {
................................................................................
   199    199        index i3                           <t2>          \
   200    200        index {sqlite_autoindex_<t2>_1}    <t2>          \
   201    201        index {sqlite_autoindex_<t2>_2}    <t2>          \
   202    202     ]
   203    203   
   204    204   # Check that ALTER TABLE works on attached databases.
   205    205   #
   206         -do_test alter-1.8.1 {
   207         -  file delete -force test2.db
   208         -  file delete -force test2.db-journal
   209         -  execsql {
   210         -    ATTACH 'test2.db' AS aux;
   211         -  }
   212         -} {}
   213         -do_test alter-1.8.2 {
   214         -  execsql {
   215         -    CREATE TABLE t4(a PRIMARY KEY, b, c);
   216         -    CREATE TABLE aux.t4(a PRIMARY KEY, b, c);
   217         -    CREATE INDEX i4 ON t4(b);
   218         -    CREATE INDEX aux.i4 ON t4(b);
   219         -  }
   220         -} {}
   221         -do_test alter-1.8.3 {
   222         -  execsql {
   223         -    INSERT INTO t4 VALUES('main', 'main', 'main');
   224         -    INSERT INTO aux.t4 VALUES('aux', 'aux', 'aux');
   225         -    SELECT * FROM t4 WHERE a = 'main';
   226         -  }
   227         -} {main main main}
   228         -do_test alter-1.8.4 {
   229         -  execsql {
   230         -    ALTER TABLE t4 RENAME TO t5;
   231         -    SELECT * FROM t4 WHERE a = 'aux';
   232         -  }
   233         -} {aux aux aux}
   234         -do_test alter-1.8.5 {
   235         -  execsql {
   236         -    SELECT * FROM t5;
   237         -  }
   238         -} {main main main}
   239         -do_test alter-1.8.6 {
   240         -  execsql {
   241         -    SELECT * FROM t5 WHERE b = 'main';
   242         -  }
   243         -} {main main main}
   244         -do_test alter-1.8.7 {
   245         -  execsql {
   246         -    ALTER TABLE aux.t4 RENAME TO t5;
   247         -    SELECT * FROM aux.t5 WHERE b = 'aux';
   248         -  }
   249         -} {aux aux aux}
          206  +ifcapable attach {
          207  +  do_test alter-1.8.1 {
          208  +    file delete -force test2.db
          209  +    file delete -force test2.db-journal
          210  +    execsql {
          211  +      ATTACH 'test2.db' AS aux;
          212  +    }
          213  +  } {}
          214  +  do_test alter-1.8.2 {
          215  +    execsql {
          216  +      CREATE TABLE t4(a PRIMARY KEY, b, c);
          217  +      CREATE TABLE aux.t4(a PRIMARY KEY, b, c);
          218  +      CREATE INDEX i4 ON t4(b);
          219  +      CREATE INDEX aux.i4 ON t4(b);
          220  +    }
          221  +  } {}
          222  +  do_test alter-1.8.3 {
          223  +    execsql {
          224  +      INSERT INTO t4 VALUES('main', 'main', 'main');
          225  +      INSERT INTO aux.t4 VALUES('aux', 'aux', 'aux');
          226  +      SELECT * FROM t4 WHERE a = 'main';
          227  +    }
          228  +  } {main main main}
          229  +  do_test alter-1.8.4 {
          230  +    execsql {
          231  +      ALTER TABLE t4 RENAME TO t5;
          232  +      SELECT * FROM t4 WHERE a = 'aux';
          233  +    }
          234  +  } {aux aux aux}
          235  +  do_test alter-1.8.5 {
          236  +    execsql {
          237  +      SELECT * FROM t5;
          238  +    }
          239  +  } {main main main}
          240  +  do_test alter-1.8.6 {
          241  +    execsql {
          242  +      SELECT * FROM t5 WHERE b = 'main';
          243  +    }
          244  +  } {main main main}
          245  +  do_test alter-1.8.7 {
          246  +    execsql {
          247  +      ALTER TABLE aux.t4 RENAME TO t5;
          248  +      SELECT * FROM aux.t5 WHERE b = 'aux';
          249  +    }
          250  +  } {aux aux aux}
          251  +}
   250    252   
   251    253   do_test alter-1.9.1 {
   252    254     execsql {
   253    255       CREATE TABLE tbl1   (a, b, c);
   254    256       INSERT INTO tbl1 VALUES(1, 2, 3);
   255    257     }
   256    258   } {}
................................................................................
   392    394     set ::TRIGGER
   393    395   } {trig3 4 5 6}
   394    396   
   395    397   # Make sure "ON" cannot be used as a database, table or column name without
   396    398   # quoting. Otherwise the sqlite_alter_trigger() function might not work.
   397    399   file delete -force test3.db
   398    400   file delete -force test3.db-journal
   399         -do_test alter-3.2.1 {
   400         -  catchsql {
   401         -    ATTACH 'test3.db' AS ON;
   402         -  }
   403         -} {1 {near "ON": syntax error}}
   404         -do_test alter-3.2.2 {
   405         -  catchsql {
   406         -    ATTACH 'test3.db' AS 'ON';
   407         -  }
   408         -} {0 {}}
   409         -do_test alter-3.2.3 {
   410         -  catchsql {
   411         -    CREATE TABLE ON.t1(a, b, c); 
   412         -  }
   413         -} {1 {near "ON": syntax error}}
   414         -do_test alter-3.2.4 {
   415         -  catchsql {
   416         -    CREATE TABLE 'ON'.t1(a, b, c); 
   417         -  }
   418         -} {0 {}}
   419         -do_test alter-3.2.4 {
   420         -  catchsql {
   421         -    CREATE TABLE 'ON'.ON(a, b, c); 
   422         -  }
   423         -} {1 {near "ON": syntax error}}
   424         -do_test alter-3.2.5 {
   425         -  catchsql {
   426         -    CREATE TABLE 'ON'.'ON'(a, b, c); 
   427         -  }
   428         -} {0 {}}
          401  +ifcapable attach {
          402  +  do_test alter-3.2.1 {
          403  +    catchsql {
          404  +      ATTACH 'test3.db' AS ON;
          405  +    }
          406  +  } {1 {near "ON": syntax error}}
          407  +  do_test alter-3.2.2 {
          408  +    catchsql {
          409  +      ATTACH 'test3.db' AS 'ON';
          410  +    }
          411  +  } {0 {}}
          412  +  do_test alter-3.2.3 {
          413  +    catchsql {
          414  +      CREATE TABLE ON.t1(a, b, c); 
          415  +    }
          416  +  } {1 {near "ON": syntax error}}
          417  +  do_test alter-3.2.4 {
          418  +    catchsql {
          419  +      CREATE TABLE 'ON'.t1(a, b, c); 
          420  +    }
          421  +  } {0 {}}
          422  +  do_test alter-3.2.4 {
          423  +    catchsql {
          424  +      CREATE TABLE 'ON'.ON(a, b, c); 
          425  +    }
          426  +  } {1 {near "ON": syntax error}}
          427  +  do_test alter-3.2.5 {
          428  +    catchsql {
          429  +      CREATE TABLE 'ON'.'ON'(a, b, c); 
          430  +    }
          431  +  } {0 {}}
          432  +}
   429    433   do_test alter-3.2.6 {
   430    434     catchsql {
   431    435       CREATE TABLE t10(a, ON, c);
   432    436     }
   433    437   } {1 {near "ON": syntax error}}
   434    438   do_test alter-3.2.7 {
   435    439     catchsql {
................................................................................
   437    441     }
   438    442   } {0 {}}
   439    443   do_test alter-3.2.8 {
   440    444     catchsql {
   441    445       CREATE TRIGGER trig4 AFTER INSERT ON ON BEGIN SELECT 1; END;
   442    446     }
   443    447   } {1 {near "ON": syntax error}}
   444         -do_test alter-3.2.9 {
   445         -  catchsql {
   446         -    CREATE TRIGGER 'on'.trig4 AFTER INSERT ON 'ON' BEGIN SELECT 1; END;
   447         -  }
   448         -} {0 {}}
          448  +ifcapable attach {
          449  +  do_test alter-3.2.9 {
          450  +    catchsql {
          451  +      CREATE TRIGGER 'on'.trig4 AFTER INSERT ON 'ON' BEGIN SELECT 1; END;
          452  +    }
          453  +  } {0 {}}
          454  +}
   449    455   do_test alter-3.2.10 {
   450    456     execsql {
   451    457       DROP TABLE t10;
   452    458     }
   453    459   } {}
   454    460   
   455    461   do_test alter-3.3.1 {

Changes to test/alter2.test.

     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing that SQLite can handle a subtle 
    13     13   # file format change that may be used in the future to implement
    14     14   # "ALTER TABLE ... ADD COLUMN".
    15     15   #
    16         -# $Id: alter2.test,v 1.9 2007/09/12 17:01:45 danielk1977 Exp $
           16  +# $Id: alter2.test,v 1.10 2007/10/09 08:29:32 danielk1977 Exp $
    17     17   #
    18     18   
    19     19   set testdir [file dirname $argv0]
    20     20   source $testdir/tester.tcl
    21     21   
    22     22   # We have to have pragmas in order to do this test
    23     23   ifcapable {!pragma} return
................................................................................
   283    283   do_test alter2-6.1 {
   284    284     db close
   285    285     set_file_format 2
   286    286     sqlite3 db test.db
   287    287     set ::DB [sqlite3_connection_pointer db]
   288    288     get_file_format
   289    289   } {2}
   290         -do_test alter2-6.2 {
   291         -  file delete -force test2.db-journal
   292         -  file delete -force test2.db
   293         -  execsql {
   294         -    ATTACH 'test2.db' AS aux;
   295         -    CREATE TABLE aux.t1(a, b);
   296         -  }
   297         -  get_file_format test2.db
   298         -} $default_file_format
          290  +ifcapable attach {
          291  +  do_test alter2-6.2 {
          292  +    file delete -force test2.db-journal
          293  +    file delete -force test2.db
          294  +    execsql {
          295  +      ATTACH 'test2.db' AS aux;
          296  +      CREATE TABLE aux.t1(a, b);
          297  +    }
          298  +    get_file_format test2.db
          299  +  } $default_file_format
          300  +}
   299    301   do_test alter2-6.3 {
   300    302     execsql {
   301    303       CREATE TABLE t1(a, b);
   302    304     }
   303    305     get_file_format 
   304    306   } {2}
   305    307   

Changes to test/alter3.test.

     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing that SQLite can handle a subtle 
    13     13   # file format change that may be used in the future to implement
    14     14   # "ALTER TABLE ... ADD COLUMN".
    15     15   #
    16         -# $Id: alter3.test,v 1.9 2006/01/17 09:35:02 danielk1977 Exp $
           16  +# $Id: alter3.test,v 1.10 2007/10/09 08:29:32 danielk1977 Exp $
    17     17   #
    18     18   
    19     19   set testdir [file dirname $argv0]
    20     20   
    21     21   source $testdir/tester.tcl
    22     22   
    23     23   # If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
................................................................................
   232    232   }
   233    233   do_test alter3-4.99 {
   234    234     execsql {
   235    235       DROP TABLE t1;
   236    236     }
   237    237   } {}
   238    238   
   239         -do_test alter3-5.1 {
   240         -  file delete -force test2.db
   241         -  file delete -force test2.db-journal
   242         -  execsql {
   243         -    CREATE TABLE t1(a, b);
   244         -    INSERT INTO t1 VALUES(1, 'one');
   245         -    INSERT INTO t1 VALUES(2, 'two');
   246         -    ATTACH 'test2.db' AS aux;
   247         -    CREATE TABLE aux.t1 AS SELECT * FROM t1;
   248         -    PRAGMA aux.schema_version = 30;
   249         -    SELECT sql FROM aux.sqlite_master;
   250         -  } 
   251         -} {{CREATE TABLE t1(a,b)}}
   252         -do_test alter3-5.2 {
   253         -  execsql {
   254         -    ALTER TABLE aux.t1 ADD COLUMN c VARCHAR(128);
   255         -    SELECT sql FROM aux.sqlite_master;
          239  +ifcapable attach {
          240  +  do_test alter3-5.1 {
          241  +    file delete -force test2.db
          242  +    file delete -force test2.db-journal
          243  +    execsql {
          244  +      CREATE TABLE t1(a, b);
          245  +      INSERT INTO t1 VALUES(1, 'one');
          246  +      INSERT INTO t1 VALUES(2, 'two');
          247  +      ATTACH 'test2.db' AS aux;
          248  +      CREATE TABLE aux.t1 AS SELECT * FROM t1;
          249  +      PRAGMA aux.schema_version = 30;
          250  +      SELECT sql FROM aux.sqlite_master;
          251  +    } 
          252  +  } {{CREATE TABLE t1(a,b)}}
          253  +  do_test alter3-5.2 {
          254  +    execsql {
          255  +      ALTER TABLE aux.t1 ADD COLUMN c VARCHAR(128);
          256  +      SELECT sql FROM aux.sqlite_master;
          257  +    }
          258  +  } {{CREATE TABLE t1(a,b, c VARCHAR(128))}}
          259  +  do_test alter3-5.3 {
          260  +    execsql {
          261  +      SELECT * FROM aux.t1;
          262  +    }
          263  +  } {1 one {} 2 two {}}
          264  +  ifcapable schema_version {
          265  +    do_test alter3-5.4 {
          266  +      execsql {
          267  +        PRAGMA aux.schema_version;
          268  +      }
          269  +    } {31}
   256    270     }
   257         -} {{CREATE TABLE t1(a,b, c VARCHAR(128))}}
   258         -do_test alter3-5.3 {
   259         -  execsql {
   260         -    SELECT * FROM aux.t1;
          271  +  if {!$has_codec} {
          272  +    do_test alter3-5.5 {
          273  +      list [get_file_format test2.db] [get_file_format]
          274  +    } {2 3}
   261    275     }
   262         -} {1 one {} 2 two {}}
   263         -ifcapable schema_version {
   264         -  do_test alter3-5.4 {
          276  +  do_test alter3-5.6 {
          277  +    execsql {
          278  +      ALTER TABLE aux.t1 ADD COLUMN d DEFAULT 1000;
          279  +      SELECT sql FROM aux.sqlite_master;
          280  +    }
          281  +  } {{CREATE TABLE t1(a,b, c VARCHAR(128), d DEFAULT 1000)}}
          282  +  do_test alter3-5.7 {
   265    283       execsql {
   266         -      PRAGMA aux.schema_version;
          284  +      SELECT * FROM aux.t1;
   267    285       }
   268         -  } {31}
   269         -}
   270         -if {!$has_codec} {
   271         -  do_test alter3-5.5 {
   272         -    list [get_file_format test2.db] [get_file_format]
   273         -  } {2 3}
   274         -}
   275         -do_test alter3-5.6 {
   276         -  execsql {
   277         -    ALTER TABLE aux.t1 ADD COLUMN d DEFAULT 1000;
   278         -    SELECT sql FROM aux.sqlite_master;
          286  +  } {1 one {} 1000 2 two {} 1000}
          287  +  ifcapable schema_version {
          288  +    do_test alter3-5.8 {
          289  +      execsql {
          290  +        PRAGMA aux.schema_version;
          291  +      }
          292  +    } {32}
   279    293     }
   280         -} {{CREATE TABLE t1(a,b, c VARCHAR(128), d DEFAULT 1000)}}
   281         -do_test alter3-5.7 {
   282         -  execsql {
   283         -    SELECT * FROM aux.t1;
   284         -  }
   285         -} {1 one {} 1000 2 two {} 1000}
   286         -ifcapable schema_version {
   287         -  do_test alter3-5.8 {
          294  +  do_test alter3-5.9 {
          295  +    execsql {
          296  +      SELECT * FROM t1;
          297  +    }
          298  +  } {1 one 2 two}
          299  +  do_test alter3-5.99 {
   288    300       execsql {
   289         -      PRAGMA aux.schema_version;
          301  +      DROP TABLE aux.t1;
          302  +      DROP TABLE t1;
   290    303       }
   291         -  } {32}
          304  +  } {}
   292    305   }
   293         -do_test alter3-5.9 {
   294         -  execsql {
   295         -    SELECT * FROM t1;
   296         -  }
   297         -} {1 one 2 two}
   298         -do_test alter3-5.99 {
   299         -  execsql {
   300         -    DROP TABLE aux.t1;
   301         -    DROP TABLE t1;
   302         -  }
   303         -} {}
   304    306   
   305    307   #----------------------------------------------------------------
   306    308   # Test that the table schema is correctly reloaded when a column
   307    309   # is added to a table.
   308    310   #
   309    311   ifcapable trigger&&tempdb {
   310    312     do_test alter3-6.1 {

Changes to test/attach.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the ATTACH and DETACH commands
    13     13   # and related functionality.
    14     14   #
    15         -# $Id: attach.test,v 1.46 2007/09/12 17:01:45 danielk1977 Exp $
           15  +# $Id: attach.test,v 1.47 2007/10/09 08:29:32 danielk1977 Exp $
    16     16   #
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
           20  +
           21  +ifcapable !attach {
           22  +  finish_test
           23  +  return
           24  +}
    20     25   
    21     26   for {set i 2} {$i<=15} {incr i} {
    22     27     file delete -force test$i.db
    23     28     file delete -force test$i.db-journal
    24     29   }
    25     30   
    26     31   set btree_trace 0

Changes to test/attach2.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the ATTACH and DETACH commands
    13     13   # and related functionality.
    14     14   #
    15         -# $Id: attach2.test,v 1.36 2007/08/10 19:46:14 drh Exp $
           15  +# $Id: attach2.test,v 1.37 2007/10/09 08:29:32 danielk1977 Exp $
    16     16   #
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
           20  +
           21  +ifcapable !attach {
           22  +  finish_test
           23  +  return
           24  +}
    20     25   
    21     26   # Ticket #354
    22     27   #
    23     28   # Databases test.db and test2.db contain identical schemas.  Make
    24     29   # sure we can attach test2.db from test.db.
    25     30   #
    26     31   do_test attach2-1.1 {

Changes to test/attach3.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the ATTACH and DETACH commands
    13     13   # and schema changes to attached databases.
    14     14   #
    15         -# $Id: attach3.test,v 1.17 2006/06/20 11:01:09 danielk1977 Exp $
           15  +# $Id: attach3.test,v 1.18 2007/10/09 08:29:32 danielk1977 Exp $
    16     16   #
    17         -
    18     17   
    19     18   set testdir [file dirname $argv0]
    20     19   source $testdir/tester.tcl
           20  +
           21  +ifcapable !attach {
           22  +  finish_test
           23  +  return
           24  +}
    21     25   
    22     26   # Create tables t1 and t2 in the main database
    23     27   execsql {
    24     28     CREATE TABLE t1(a, b);
    25     29     CREATE TABLE t2(c, d);
    26     30   }
    27     31   

Changes to test/attachmalloc.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the ATTACH statement and
    13     13   # specifically out-of-memory conditions within that command.
    14     14   #
    15         -# $Id: attachmalloc.test,v 1.6 2007/10/03 08:46:45 danielk1977 Exp $
           15  +# $Id: attachmalloc.test,v 1.7 2007/10/09 08:29:32 danielk1977 Exp $
    16     16   #
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21         -ifcapable !memdebug {
           21  +ifcapable !memdebug||!attach {
    22     22     finish_test
    23     23     return
    24     24   }
    25     25   
    26     26   source $testdir/malloc_common.tcl
    27     27   
    28     28   do_malloc_test attachmalloc-1 -tclprep {

Changes to test/auth.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the sqlite3_set_authorizer() API
    13     13   # and related functionality.
    14     14   #
    15         -# $Id: auth.test,v 1.37 2006/08/24 14:59:46 drh Exp $
           15  +# $Id: auth.test,v 1.38 2007/10/09 08:29:32 danielk1977 Exp $
    16     16   #
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   # disable this test if the SQLITE_OMIT_AUTHORIZATION macro is
    22     22   # defined during compilation.
................................................................................
   301    301       if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} {
   302    302         return SQLITE_DENY
   303    303       }
   304    304       return SQLITE_OK
   305    305     }
   306    306     catchsql {SELECT * FROM t2}
   307    307   } {1 {access to t2.b is prohibited}}
   308         -do_test auth-1.35.2 {
   309         -  execsql {ATTACH DATABASE 'test.db' AS two}
   310         -  catchsql {SELECT * FROM two.t2}
   311         -} {1 {access to two.t2.b is prohibited}}
   312         -execsql {DETACH DATABASE two}
          308  +ifcapable attach {
          309  +  do_test auth-1.35.2 {
          310  +    execsql {ATTACH DATABASE 'test.db' AS two}
          311  +    catchsql {SELECT * FROM two.t2}
          312  +  } {1 {access to two.t2.b is prohibited}}
          313  +  execsql {DETACH DATABASE two}
          314  +}
   313    315   do_test auth-1.36 {
   314    316     proc auth {code arg1 arg2 arg3 arg4} {
   315    317       if {$code=="SQLITE_READ" && $arg1=="t2" && $arg2=="b"} {
   316    318         return SQLITE_IGNORE
   317    319       }
   318    320       return SQLITE_OK
   319    321     }
................................................................................
  1606   1608   } {0 {}}
  1607   1609   do_test auth-1.250 {
  1608   1610     execsql {SELECT * FROM t2}
  1609   1611   } {11 2 33 7 8 9}
  1610   1612   
  1611   1613   # ticket #340 - authorization for ATTACH and DETACH.
  1612   1614   #
  1613         -do_test auth-1.251 {
  1614         -  db authorizer ::auth
  1615         -  proc auth {code arg1 arg2 arg3 arg4} {
  1616         -    if {$code=="SQLITE_ATTACH"} {
  1617         -      set ::authargs [list $arg1 $arg2 $arg3 $arg4]
  1618         -    }
  1619         -    return SQLITE_OK
  1620         -  }
  1621         -  catchsql {
  1622         -    ATTACH DATABASE ':memory:' AS test1
  1623         -  }
  1624         -} {0 {}}
  1625         -do_test auth-1.252 {
  1626         -  set ::authargs
  1627         -} {:memory: {} {} {}}
  1628         -do_test auth-1.253 {
  1629         -  catchsql {DETACH DATABASE test1}
  1630         -  proc auth {code arg1 arg2 arg3 arg4} {
  1631         -    if {$code=="SQLITE_ATTACH"} {
  1632         -      set ::authargs [list $arg1 $arg2 $arg3 $arg4]
  1633         -      return SQLITE_DENY
  1634         -    }
  1635         -    return SQLITE_OK
  1636         -  }
  1637         -  catchsql {
  1638         -    ATTACH DATABASE ':memory:' AS test1;
  1639         -  }
  1640         -} {1 {not authorized}}
  1641         -do_test auth-1.254 {
  1642         -  lindex [execsql {PRAGMA database_list}] 7
  1643         -} {}
  1644         -do_test auth-1.255 {
  1645         -  catchsql {DETACH DATABASE test1}
  1646         -  proc auth {code arg1 arg2 arg3 arg4} {
  1647         -    if {$code=="SQLITE_ATTACH"} {
  1648         -      set ::authargs [list $arg1 $arg2 $arg3 $arg4]
  1649         -      return SQLITE_IGNORE
  1650         -    }
  1651         -    return SQLITE_OK
  1652         -  }
  1653         -  catchsql {
  1654         -    ATTACH DATABASE ':memory:' AS test1;
  1655         -  }
  1656         -} {0 {}}
  1657         -do_test auth-1.256 {
  1658         -  lindex [execsql {PRAGMA database_list}] 7
  1659         -} {}
  1660         -do_test auth-1.257 {
  1661         -  proc auth {code arg1 arg2 arg3 arg4} {
  1662         -    if {$code=="SQLITE_DETACH"} {
  1663         -      set ::authargs [list $arg1 $arg2 $arg3 $arg4]
         1615  +ifcapable attach {
         1616  +  do_test auth-1.251 {
         1617  +    db authorizer ::auth
         1618  +    proc auth {code arg1 arg2 arg3 arg4} {
         1619  +      if {$code=="SQLITE_ATTACH"} {
         1620  +        set ::authargs [list $arg1 $arg2 $arg3 $arg4]
         1621  +      }
         1622  +      return SQLITE_OK
         1623  +    }
         1624  +    catchsql {
         1625  +      ATTACH DATABASE ':memory:' AS test1
         1626  +    }
         1627  +  } {0 {}}
         1628  +  do_test auth-1.252 {
         1629  +    set ::authargs
         1630  +  } {:memory: {} {} {}}
         1631  +  do_test auth-1.253 {
         1632  +    catchsql {DETACH DATABASE test1}
         1633  +    proc auth {code arg1 arg2 arg3 arg4} {
         1634  +      if {$code=="SQLITE_ATTACH"} {
         1635  +        set ::authargs [list $arg1 $arg2 $arg3 $arg4]
         1636  +        return SQLITE_DENY
         1637  +      }
         1638  +      return SQLITE_OK
         1639  +    }
         1640  +    catchsql {
         1641  +      ATTACH DATABASE ':memory:' AS test1;
         1642  +    }
         1643  +  } {1 {not authorized}}
         1644  +  do_test auth-1.254 {
         1645  +    lindex [execsql {PRAGMA database_list}] 7
         1646  +  } {}
         1647  +  do_test auth-1.255 {
         1648  +    catchsql {DETACH DATABASE test1}
         1649  +    proc auth {code arg1 arg2 arg3 arg4} {
         1650  +      if {$code=="SQLITE_ATTACH"} {
         1651  +        set ::authargs [list $arg1 $arg2 $arg3 $arg4]
         1652  +        return SQLITE_IGNORE
         1653  +      }
         1654  +      return SQLITE_OK
         1655  +    }
         1656  +    catchsql {
         1657  +      ATTACH DATABASE ':memory:' AS test1;
         1658  +    }
         1659  +  } {0 {}}
         1660  +  do_test auth-1.256 {
         1661  +    lindex [execsql {PRAGMA database_list}] 7
         1662  +  } {}
         1663  +  do_test auth-1.257 {
         1664  +    proc auth {code arg1 arg2 arg3 arg4} {
         1665  +      if {$code=="SQLITE_DETACH"} {
         1666  +        set ::authargs [list $arg1 $arg2 $arg3 $arg4]
         1667  +        return SQLITE_OK
         1668  +      }
  1664   1669         return SQLITE_OK
  1665   1670       }
  1666         -    return SQLITE_OK
  1667         -  }
  1668         -  execsql {ATTACH DATABASE ':memory:' AS test1}
  1669         -  catchsql {
  1670         -    DETACH DATABASE test1;
  1671         -  }
  1672         -} {0 {}}
  1673         -do_test auth-1.258 {
  1674         -  lindex [execsql {PRAGMA database_list}] 7
  1675         -} {}
  1676         -do_test auth-1.259 {
  1677         -  execsql {ATTACH DATABASE ':memory:' AS test1}
  1678         -  proc auth {code arg1 arg2 arg3 arg4} {
  1679         -    if {$code=="SQLITE_DETACH"} {
  1680         -      set ::authargs [list $arg1 $arg2 $arg3 $arg4]
  1681         -      return SQLITE_IGNORE
         1671  +    execsql {ATTACH DATABASE ':memory:' AS test1}
         1672  +    catchsql {
         1673  +      DETACH DATABASE test1;
  1682   1674       }
  1683         -    return SQLITE_OK
  1684         -  }
  1685         -  catchsql {
  1686         -    DETACH DATABASE test1;
  1687         -  }
  1688         -} {0 {}}
  1689         -ifcapable tempdb {
  1690         -  ifcapable schema_pragmas {
  1691         -  do_test auth-1.260 {
         1675  +  } {0 {}}
         1676  +  do_test auth-1.258 {
  1692   1677       lindex [execsql {PRAGMA database_list}] 7
  1693         -  } {test1}
  1694         -  } ;# ifcapable schema_pragmas
  1695         -  do_test auth-1.261 {
         1678  +  } {}
         1679  +  do_test auth-1.259 {
         1680  +    execsql {ATTACH DATABASE ':memory:' AS test1}
  1696   1681       proc auth {code arg1 arg2 arg3 arg4} {
  1697   1682         if {$code=="SQLITE_DETACH"} {
  1698   1683           set ::authargs [list $arg1 $arg2 $arg3 $arg4]
  1699         -        return SQLITE_DENY
         1684  +        return SQLITE_IGNORE
  1700   1685         }
  1701   1686         return SQLITE_OK
  1702   1687       }
  1703   1688       catchsql {
  1704   1689         DETACH DATABASE test1;
  1705   1690       }
  1706         -  } {1 {not authorized}}
  1707         -  ifcapable schema_pragmas {
  1708         -  do_test auth-1.262 {
  1709         -    lindex [execsql {PRAGMA database_list}] 7
  1710         -  } {test1}
  1711         -  } ;# ifcapable schema_pragmas
  1712         -  db authorizer {}
  1713         -  execsql {DETACH DATABASE test1}
  1714         -  db authorizer ::auth
  1715         -  
  1716         -  # Authorization for ALTER TABLE. These tests are omitted if the library
  1717         -  # was built without ALTER TABLE support.
  1718         -  ifcapable altertable {
  1719         -  
  1720         -    do_test auth-1.263 {
         1691  +  } {0 {}}
         1692  +  ifcapable tempdb {
         1693  +    ifcapable schema_pragmas {
         1694  +    do_test auth-1.260 {
         1695  +      lindex [execsql {PRAGMA database_list}] 7
         1696  +    } {test1}
         1697  +    } ;# ifcapable schema_pragmas
         1698  +    do_test auth-1.261 {
  1721   1699         proc auth {code arg1 arg2 arg3 arg4} {
  1722         -        if {$code=="SQLITE_ALTER_TABLE"} {
  1723         -          set ::authargs [list $arg1 $arg2 $arg3 $arg4]
  1724         -          return SQLITE_OK
  1725         -        }
  1726         -        return SQLITE_OK
  1727         -      }
  1728         -      catchsql {
  1729         -        ALTER TABLE t1 RENAME TO t1x
  1730         -      }
  1731         -    } {0 {}}
  1732         -    do_test auth-1.264 {
  1733         -      execsql {SELECT name FROM sqlite_temp_master WHERE type='table'}
  1734         -    } {t1x}
  1735         -    do_test auth-1.265 {
  1736         -      set authargs
  1737         -    } {temp t1 {} {}}
  1738         -    do_test auth-1.266 {
  1739         -      proc auth {code arg1 arg2 arg3 arg4} {
  1740         -        if {$code=="SQLITE_ALTER_TABLE"} {
  1741         -          set ::authargs [list $arg1 $arg2 $arg3 $arg4]
  1742         -          return SQLITE_IGNORE
  1743         -        }
  1744         -        return SQLITE_OK
  1745         -      }
  1746         -      catchsql {
  1747         -        ALTER TABLE t1x RENAME TO t1
  1748         -      }
  1749         -    } {0 {}}
  1750         -    do_test auth-1.267 {
  1751         -      execsql {SELECT name FROM sqlite_temp_master WHERE type='table'}
  1752         -    } {t1x}
  1753         -    do_test auth-1.268 {
  1754         -      set authargs
  1755         -    } {temp t1x {} {}}
  1756         -    do_test auth-1.269 {
  1757         -      proc auth {code arg1 arg2 arg3 arg4} {
  1758         -        if {$code=="SQLITE_ALTER_TABLE"} {
         1700  +        if {$code=="SQLITE_DETACH"} {
  1759   1701             set ::authargs [list $arg1 $arg2 $arg3 $arg4]
  1760   1702             return SQLITE_DENY
  1761   1703           }
  1762   1704           return SQLITE_OK
  1763   1705         }
  1764   1706         catchsql {
  1765         -        ALTER TABLE t1x RENAME TO t1
         1707  +        DETACH DATABASE test1;
  1766   1708         }
  1767   1709       } {1 {not authorized}}
  1768         -    do_test auth-1.270 {
  1769         -      execsql {SELECT name FROM sqlite_temp_master WHERE type='table'}
  1770         -    } {t1x}
  1771         -
  1772         -    do_test auth-1.271 {
  1773         -      set authargs
  1774         -    } {temp t1x {} {}}
  1775         -  } ;# ifcapable altertable
  1776         -
  1777         -} else {
  1778         -  db authorizer {}
  1779         -  db eval {
  1780         -    DETACH DATABASE test1;
         1710  +    ifcapable schema_pragmas {
         1711  +    do_test auth-1.262 {
         1712  +      lindex [execsql {PRAGMA database_list}] 7
         1713  +    } {test1}
         1714  +    } ;# ifcapable schema_pragmas
         1715  +    db authorizer {}
         1716  +    execsql {DETACH DATABASE test1}
         1717  +    db authorizer ::auth
         1718  +    
         1719  +    # Authorization for ALTER TABLE. These tests are omitted if the library
         1720  +    # was built without ALTER TABLE support.
         1721  +    ifcapable altertable {
         1722  +    
         1723  +      do_test auth-1.263 {
         1724  +        proc auth {code arg1 arg2 arg3 arg4} {
         1725  +          if {$code=="SQLITE_ALTER_TABLE"} {
         1726  +            set ::authargs [list $arg1 $arg2 $arg3 $arg4]
         1727  +            return SQLITE_OK
         1728  +          }
         1729  +          return SQLITE_OK
         1730  +        }
         1731  +        catchsql {
         1732  +          ALTER TABLE t1 RENAME TO t1x
         1733  +        }
         1734  +      } {0 {}}
         1735  +      do_test auth-1.264 {
         1736  +        execsql {SELECT name FROM sqlite_temp_master WHERE type='table'}
         1737  +      } {t1x}
         1738  +      do_test auth-1.265 {
         1739  +        set authargs
         1740  +      } {temp t1 {} {}}
         1741  +      do_test auth-1.266 {
         1742  +        proc auth {code arg1 arg2 arg3 arg4} {
         1743  +          if {$code=="SQLITE_ALTER_TABLE"} {
         1744  +            set ::authargs [list $arg1 $arg2 $arg3 $arg4]
         1745  +            return SQLITE_IGNORE
         1746  +          }
         1747  +          return SQLITE_OK
         1748  +        }
         1749  +        catchsql {
         1750  +          ALTER TABLE t1x RENAME TO t1
         1751  +        }
         1752  +      } {0 {}}
         1753  +      do_test auth-1.267 {
         1754  +        execsql {SELECT name FROM sqlite_temp_master WHERE type='table'}
         1755  +      } {t1x}
         1756  +      do_test auth-1.268 {
         1757  +        set authargs
         1758  +      } {temp t1x {} {}}
         1759  +      do_test auth-1.269 {
         1760  +        proc auth {code arg1 arg2 arg3 arg4} {
         1761  +          if {$code=="SQLITE_ALTER_TABLE"} {
         1762  +            set ::authargs [list $arg1 $arg2 $arg3 $arg4]
         1763  +            return SQLITE_DENY
         1764  +          }
         1765  +          return SQLITE_OK
         1766  +        }
         1767  +        catchsql {
         1768  +          ALTER TABLE t1x RENAME TO t1
         1769  +        }
         1770  +      } {1 {not authorized}}
         1771  +      do_test auth-1.270 {
         1772  +        execsql {SELECT name FROM sqlite_temp_master WHERE type='table'}
         1773  +      } {t1x}
         1774  +  
         1775  +      do_test auth-1.271 {
         1776  +        set authargs
         1777  +      } {temp t1x {} {}}
         1778  +    } ;# ifcapable altertable
         1779  +  
         1780  +  } else {
         1781  +    db authorizer {}
         1782  +    db eval {
         1783  +      DETACH DATABASE test1;
         1784  +    }
  1781   1785     }
  1782   1786   }
  1783   1787   
  1784   1788   ifcapable  altertable {
  1785   1789   db authorizer {}
  1786   1790   catchsql {ALTER TABLE t1x RENAME TO t1}
  1787   1791   db authorizer ::auth

Changes to test/autoinc.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this script is testing the AUTOINCREMENT features.
    13     13   #
    14         -# $Id: autoinc.test,v 1.9 2006/01/03 00:33:50 drh Exp $
           14  +# $Id: autoinc.test,v 1.10 2007/10/09 08:29:32 danielk1977 Exp $
    15     15   #
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # If the library is not compiled with autoincrement support then
    21     21   # skip all tests in this file.
................................................................................
   412    412         SELECT 2, * FROM temp.sqlite_sequence;
   413    413       }
   414    414     } {}
   415    415   }
   416    416   
   417    417   # Make sure AUTOINCREMENT works on ATTACH-ed tables.
   418    418   #
   419         -ifcapable tempdb {
          419  +ifcapable tempdb&&attach {
   420    420     do_test autoinc-5.1 {
   421    421       file delete -force test2.db
   422    422       file delete -force test2.db-journal
   423    423       sqlite3 db2 test2.db
   424    424       execsql {
   425    425         CREATE TABLE t4(m INTEGER PRIMARY KEY AUTOINCREMENT, n);
   426    426         CREATE TABLE t5(o, p INTEGER PRIMARY KEY AUTOINCREMENT);

Changes to test/crash.test.

    13     13   # The focus of this file is testing the ability of the database to
    14     14   # uses its rollback journal to recover intact (no database corruption)
    15     15   # from a power failure during the middle of a COMMIT.  The OS interface
    16     16   # modules are overloaded using the modified I/O routines found in test6.c.  
    17     17   # These routines allow us to simulate the kind of file damage that 
    18     18   # occurs after a power failure.
    19     19   #
    20         -# $Id: crash.test,v 1.25 2007/08/20 14:23:44 danielk1977 Exp $
           20  +# $Id: crash.test,v 1.26 2007/10/09 08:29:32 danielk1977 Exp $
    21     21   
    22     22   set testdir [file dirname $argv0]
    23     23   source $testdir/tester.tcl
    24     24   
    25     25   ifcapable !crashtest {
    26     26     finish_test
    27     27     return
................................................................................
   205    205   # crash-4.1.*: Test recovery when crash occurs during sync() of the 
   206    206   #              main database journal file.
   207    207   # crash-4.2.*: Test recovery when crash occurs during sync() of an 
   208    208   #              attached database journal file.
   209    209   # crash-4.3.*: Test recovery when crash occurs during sync() of the master
   210    210   #              journal file. 
   211    211   #
   212         -do_test crash-4.0 {
   213         -  file delete -force test2.db
   214         -  file delete -force test2.db-journal
   215         -  execsql {
   216         -    ATTACH 'test2.db' AS aux;
   217         -    PRAGMA aux.default_cache_size = 10;
   218         -    CREATE TABLE aux.abc2 AS SELECT 2*a as a, 2*b as b, 2*c as c FROM abc;
   219         -  }
   220         -  expr ([file size test2.db] / 1024) > 450
   221         -} {1}
   222         -
   223         -set fin 0
   224         -for {set i 1} {$i<$repeats} {incr i} {
   225         -  set sig [signature]
   226         -  set sig2 [signature2]
   227         -  do_test crash-4.1.$i.1 {
   228         -     set c [crashsql -delay $i -file test.db-journal "
   229         -       ATTACH 'test2.db' AS aux;
   230         -       BEGIN;
   231         -       SELECT randstr($i,$i) FROM abc LIMIT $i;
   232         -       INSERT INTO abc VALUES(randstr(10,10), 0, 0);
   233         -       DELETE FROM abc WHERE random()%10!=0;
   234         -       INSERT INTO abc2 VALUES(randstr(10,10), 0, 0);
   235         -       DELETE FROM abc2 WHERE random()%10!=0;
   236         -       COMMIT;
   237         -     "]
   238         -     if { $c == {0 {}} } {
   239         -       set ::fin 1
   240         -       set c {1 {child process exited abnormally}}
   241         -     }
   242         -     set c
   243         -  } {1 {child process exited abnormally}}
   244         -  if {$::fin} break
   245         -  do_test crash-4.1.$i.2 {
   246         -    signature
   247         -  } $sig
   248         -  do_test crash-4.1.$i.3 {
   249         -    signature2
   250         -  } $sig2
   251         -} 
   252         -set i 0
   253         -set fin 0
   254         -while {[incr i]} {
   255         -  set sig [signature]
   256         -  set sig2 [signature2]
   257         -  set ::fin 0
   258         -  do_test crash-4.2.$i.1 {
   259         -     set c [crashsql -delay $i -file test2.db-journal "
   260         -       ATTACH 'test2.db' AS aux;
   261         -       BEGIN;
   262         -       SELECT randstr($i,$i) FROM abc LIMIT $i;
   263         -       INSERT INTO abc VALUES(randstr(10,10), 0, 0);
   264         -       DELETE FROM abc WHERE random()%10!=0;
   265         -       INSERT INTO abc2 VALUES(randstr(10,10), 0, 0);
   266         -       DELETE FROM abc2 WHERE random()%10!=0;
   267         -       COMMIT;
   268         -     "]
   269         -     if { $c == {0 {}} } {
   270         -       set ::fin 1
   271         -       set c {1 {child process exited abnormally}}
   272         -     }
   273         -     set c
   274         -  } {1 {child process exited abnormally}}
   275         -  if { $::fin } break
   276         -  do_test crash-4.2.$i.2 {
   277         -    signature
   278         -  } $sig
   279         -  do_test crash-4.2.$i.3 {
   280         -    signature2
   281         -  } $sig2
   282         -} 
   283         -for {set i 1} {$i < 5} {incr i} {
   284         -  set sig [signature]
   285         -  set sig2 [signature2]
   286         -  do_test crash-4.3.$i.1 {
   287         -     crashsql -delay 1 -file test.db-mj* "
   288         -       ATTACH 'test2.db' AS aux;
   289         -       BEGIN;
   290         -       SELECT random() FROM abc LIMIT $i;
   291         -       INSERT INTO abc VALUES(randstr(10,10), 0, 0);
   292         -       DELETE FROM abc WHERE random()%10!=0;
   293         -       INSERT INTO abc2 VALUES(randstr(10,10), 0, 0);
   294         -       DELETE FROM abc2 WHERE random()%10!=0;
   295         -       COMMIT;
   296         -     "
   297         -  } {1 {child process exited abnormally}}
   298         -  do_test crash-4.3.$i.2 {
   299         -    signature
   300         -  } $sig
   301         -  do_test crash-4.3.$i.3 {
   302         -    signature2
   303         -  } $sig2
          212  +ifcapable attach {
          213  +  do_test crash-4.0 {
          214  +    file delete -force test2.db
          215  +    file delete -force test2.db-journal
          216  +    execsql {
          217  +      ATTACH 'test2.db' AS aux;
          218  +      PRAGMA aux.default_cache_size = 10;
          219  +      CREATE TABLE aux.abc2 AS SELECT 2*a as a, 2*b as b, 2*c as c FROM abc;
          220  +    }
          221  +    expr ([file size test2.db] / 1024) > 450
          222  +  } {1}
          223  +  
          224  +  set fin 0
          225  +  for {set i 1} {$i<$repeats} {incr i} {
          226  +    set sig [signature]
          227  +    set sig2 [signature2]
          228  +    do_test crash-4.1.$i.1 {
          229  +       set c [crashsql -delay $i -file test.db-journal "
          230  +         ATTACH 'test2.db' AS aux;
          231  +         BEGIN;
          232  +         SELECT randstr($i,$i) FROM abc LIMIT $i;
          233  +         INSERT INTO abc VALUES(randstr(10,10), 0, 0);
          234  +         DELETE FROM abc WHERE random()%10!=0;
          235  +         INSERT INTO abc2 VALUES(randstr(10,10), 0, 0);
          236  +         DELETE FROM abc2 WHERE random()%10!=0;
          237  +         COMMIT;
          238  +       "]
          239  +       if { $c == {0 {}} } {
          240  +         set ::fin 1
          241  +         set c {1 {child process exited abnormally}}
          242  +       }
          243  +       set c
          244  +    } {1 {child process exited abnormally}}
          245  +    if {$::fin} break
          246  +    do_test crash-4.1.$i.2 {
          247  +      signature
          248  +    } $sig
          249  +    do_test crash-4.1.$i.3 {
          250  +      signature2
          251  +    } $sig2
          252  +  } 
          253  +  set i 0
          254  +  set fin 0
          255  +  while {[incr i]} {
          256  +    set sig [signature]
          257  +    set sig2 [signature2]
          258  +    set ::fin 0
          259  +    do_test crash-4.2.$i.1 {
          260  +       set c [crashsql -delay $i -file test2.db-journal "
          261  +         ATTACH 'test2.db' AS aux;
          262  +         BEGIN;
          263  +         SELECT randstr($i,$i) FROM abc LIMIT $i;
          264  +         INSERT INTO abc VALUES(randstr(10,10), 0, 0);
          265  +         DELETE FROM abc WHERE random()%10!=0;
          266  +         INSERT INTO abc2 VALUES(randstr(10,10), 0, 0);
          267  +         DELETE FROM abc2 WHERE random()%10!=0;
          268  +         COMMIT;
          269  +       "]
          270  +       if { $c == {0 {}} } {
          271  +         set ::fin 1
          272  +         set c {1 {child process exited abnormally}}
          273  +       }
          274  +       set c
          275  +    } {1 {child process exited abnormally}}
          276  +    if { $::fin } break
          277  +    do_test crash-4.2.$i.2 {
          278  +      signature
          279  +    } $sig
          280  +    do_test crash-4.2.$i.3 {
          281  +      signature2
          282  +    } $sig2
          283  +  } 
          284  +  for {set i 1} {$i < 5} {incr i} {
          285  +    set sig [signature]
          286  +    set sig2 [signature2]
          287  +    do_test crash-4.3.$i.1 {
          288  +       crashsql -delay 1 -file test.db-mj* "
          289  +         ATTACH 'test2.db' AS aux;
          290  +         BEGIN;
          291  +         SELECT random() FROM abc LIMIT $i;
          292  +         INSERT INTO abc VALUES(randstr(10,10), 0, 0);
          293  +         DELETE FROM abc WHERE random()%10!=0;
          294  +         INSERT INTO abc2 VALUES(randstr(10,10), 0, 0);
          295  +         DELETE FROM abc2 WHERE random()%10!=0;
          296  +         COMMIT;
          297  +       "
          298  +    } {1 {child process exited abnormally}}
          299  +    do_test crash-4.3.$i.2 {
          300  +      signature
          301  +    } $sig
          302  +    do_test crash-4.3.$i.3 {
          303  +      signature2
          304  +    } $sig2
          305  +  }
   304    306   }
   305    307   
   306    308   #--------------------------------------------------------------------------
   307    309   # The following test cases - crash-5.* - exposes a bug that existed in the
   308    310   # sqlite3pager_movepage() API used by auto-vacuum databases.
   309    311   # database when a crash occurs during a multi-file transaction. See comments
   310    312   # in test crash-5.3 for details.

Changes to test/enc2.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The focus of
    12     12   # this file is testing the SQLite routines used for converting between the
    13     13   # various suported unicode encodings (UTF-8, UTF-16, UTF-16le and
    14     14   # UTF-16be).
    15     15   #
    16         -# $Id: enc2.test,v 1.28 2006/09/23 20:36:03 drh Exp $
           16  +# $Id: enc2.test,v 1.29 2007/10/09 08:29:32 danielk1977 Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   # If UTF16 support is disabled, ignore the tests in this file
    22     22   #
    23     23   ifcapable {!utf16} {
................................................................................
   166    166     run_test_script enc2-$i $enc
   167    167     db close
   168    168     incr i
   169    169   }
   170    170   
   171    171   # Test that it is an error to try to attach a database with a different
   172    172   # encoding to the main database.
   173         -do_test enc2-4.1 {
   174         -  file delete -force test.db
   175         -  sqlite3 db test.db
   176         -  db eval "PRAGMA encoding = 'UTF-8'"
   177         -  db eval "CREATE TABLE abc(a, b, c);"
   178         -} {}
   179         -do_test enc2-4.2 {
   180         -  file delete -force test2.db
   181         -  sqlite3 db2 test2.db
   182         -  db2 eval "PRAGMA encoding = 'UTF-16'"
   183         -  db2 eval "CREATE TABLE abc(a, b, c);"
   184         -} {}
   185         -do_test enc2-4.3 {
   186         -  catchsql {
   187         -    ATTACH 'test2.db' as aux;
   188         -  }
   189         -} {1 {attached databases must use the same text encoding as main database}}
   190         -
   191         -db2 close
   192         -db close
          173  +ifcapable attach {
          174  +  do_test enc2-4.1 {
          175  +    file delete -force test.db
          176  +    sqlite3 db test.db
          177  +    db eval "PRAGMA encoding = 'UTF-8'"
          178  +    db eval "CREATE TABLE abc(a, b, c);"
          179  +  } {}
          180  +  do_test enc2-4.2 {
          181  +    file delete -force test2.db
          182  +    sqlite3 db2 test2.db
          183  +    db2 eval "PRAGMA encoding = 'UTF-16'"
          184  +    db2 eval "CREATE TABLE abc(a, b, c);"
          185  +  } {}
          186  +  do_test enc2-4.3 {
          187  +    catchsql {
          188  +      ATTACH 'test2.db' as aux;
          189  +    }
          190  +  } {1 {attached databases must use the same text encoding as main database}}
          191  +  db2 close
          192  +  db close
          193  +}
   193    194   
   194    195   # The following tests - enc2-5.* - test that SQLite selects the correct
   195    196   # collation sequence when more than one is available.
   196    197   
   197    198   set ::values [list one two three four five]
   198    199   set ::test_collate_enc INVALID
   199    200   proc test_collate {enc lhs rhs} {

Changes to test/exclusive.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library. The focus
    12     12   # of these tests is exclusive access mode (i.e. the thing activated by 
    13     13   # "PRAGMA locking_mode = EXCLUSIVE").
    14     14   #
    15         -# $Id: exclusive.test,v 1.6 2007/08/12 20:07:59 drh Exp $
           15  +# $Id: exclusive.test,v 1.7 2007/10/09 08:29:32 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   ifcapable {!pager_pragmas} {
    21     21     finish_test
    22     22     return
................................................................................
    80     80   do_test exclusive-1.6 {
    81     81     execsql {
    82     82       pragma locking_mode;
    83     83       pragma main.locking_mode;
    84     84       pragma temp.locking_mode;
    85     85     } 
    86     86   } [list normal normal $temp_mode]
    87         -do_test exclusive-1.7 {
    88         -  execsql {
    89         -    pragma locking_mode = exclusive;
    90         -    ATTACH 'test2.db' as aux;
    91         -  }
    92         -  execsql {
    93         -    pragma main.locking_mode;
    94         -    pragma aux.locking_mode;
    95         -  }
    96         -} {exclusive exclusive}
    97         -do_test exclusive-1.8 {
    98         -  execsql {
    99         -    pragma main.locking_mode = normal;
   100         -  }
   101         -  execsql {
   102         -    pragma main.locking_mode;
   103         -    pragma temp.locking_mode;
   104         -    pragma aux.locking_mode;
   105         -  }
   106         -} [list normal $temp_mode exclusive]
   107         -do_test exclusive-1.9 {
   108         -  execsql {
   109         -    pragma locking_mode;
   110         -  }
   111         -} {exclusive}
   112         -do_test exclusive-1.10 {
   113         -  execsql {
   114         -    ATTACH 'test3.db' as aux2;
   115         -  }
   116         -  execsql {
   117         -    pragma main.locking_mode;
   118         -    pragma aux.locking_mode;
   119         -    pragma aux2.locking_mode;
   120         -  }
   121         -} {normal exclusive exclusive}
   122         -do_test exclusive-1.11 {
   123         -  execsql {
   124         -    pragma aux.locking_mode = normal;
   125         -  }
   126         -  execsql {
   127         -    pragma main.locking_mode;
   128         -    pragma aux.locking_mode;
   129         -    pragma aux2.locking_mode;
   130         -  }
   131         -} {normal normal exclusive}
   132         -do_test exclusive-1.12 {
   133         -  execsql {
   134         -    pragma locking_mode = normal;
   135         -  }
   136         -  execsql {
   137         -    pragma main.locking_mode;
   138         -    pragma temp.locking_mode;
   139         -    pragma aux.locking_mode;
   140         -    pragma aux2.locking_mode;
   141         -  }
   142         -} [list normal $temp_mode normal normal]
   143         -do_test exclusive-1.13 {
   144         -  execsql {
   145         -    ATTACH 'test4.db' as aux3;
   146         -  }
   147         -  execsql {
   148         -    pragma main.locking_mode;
   149         -    pragma temp.locking_mode;
   150         -    pragma aux.locking_mode;
   151         -    pragma aux2.locking_mode;
   152         -    pragma aux3.locking_mode;
   153         -  }
   154         -} [list normal $temp_mode normal normal normal]
   155         -
   156         -do_test exclusive-1.99 {
   157         -  execsql {
   158         -    DETACH aux;
   159         -    DETACH aux2;
   160         -    DETACH aux3;
   161         -  }
   162         -} {}
           87  +ifcapable attach {
           88  +  do_test exclusive-1.7 {
           89  +    execsql {
           90  +      pragma locking_mode = exclusive;
           91  +      ATTACH 'test2.db' as aux;
           92  +    }
           93  +    execsql {
           94  +      pragma main.locking_mode;
           95  +      pragma aux.locking_mode;
           96  +    }
           97  +  } {exclusive exclusive}
           98  +  do_test exclusive-1.8 {
           99  +    execsql {
          100  +      pragma main.locking_mode = normal;
          101  +    }
          102  +    execsql {
          103  +      pragma main.locking_mode;
          104  +      pragma temp.locking_mode;
          105  +      pragma aux.locking_mode;
          106  +    }
          107  +  } [list normal $temp_mode exclusive]
          108  +  do_test exclusive-1.9 {
          109  +    execsql {
          110  +      pragma locking_mode;
          111  +    }
          112  +  } {exclusive}
          113  +  do_test exclusive-1.10 {
          114  +    execsql {
          115  +      ATTACH 'test3.db' as aux2;
          116  +    }
          117  +    execsql {
          118  +      pragma main.locking_mode;
          119  +      pragma aux.locking_mode;
          120  +      pragma aux2.locking_mode;
          121  +    }
          122  +  } {normal exclusive exclusive}
          123  +  do_test exclusive-1.11 {
          124  +    execsql {
          125  +      pragma aux.locking_mode = normal;
          126  +    }
          127  +    execsql {
          128  +      pragma main.locking_mode;
          129  +      pragma aux.locking_mode;
          130  +      pragma aux2.locking_mode;
          131  +    }
          132  +  } {normal normal exclusive}
          133  +  do_test exclusive-1.12 {
          134  +    execsql {
          135  +      pragma locking_mode = normal;
          136  +    }
          137  +    execsql {
          138  +      pragma main.locking_mode;
          139  +      pragma temp.locking_mode;
          140  +      pragma aux.locking_mode;
          141  +      pragma aux2.locking_mode;
          142  +    }
          143  +  } [list normal $temp_mode normal normal]
          144  +  do_test exclusive-1.13 {
          145  +    execsql {
          146  +      ATTACH 'test4.db' as aux3;
          147  +    }
          148  +    execsql {
          149  +      pragma main.locking_mode;
          150  +      pragma temp.locking_mode;
          151  +      pragma aux.locking_mode;
          152  +      pragma aux2.locking_mode;
          153  +      pragma aux3.locking_mode;
          154  +    }
          155  +  } [list normal $temp_mode normal normal normal]
          156  +  
          157  +  do_test exclusive-1.99 {
          158  +    execsql {
          159  +      DETACH aux;
          160  +      DETACH aux2;
          161  +      DETACH aux3;
          162  +    }
          163  +  } {}
          164  +}
   163    165   
   164    166   #----------------------------------------------------------------------
   165    167   # Test cases exclusive-2.X verify that connections in exclusive 
   166    168   # locking_mode do not relinquish locks.
   167    169   #
   168    170   do_test exclusive-2.0 {
   169    171     execsql {

Changes to test/hook.test.

    13     13   #
    14     14   # The focus of the tests in this file is the  following interface:
    15     15   #
    16     16   #      sqlite_commit_hook    (tests hook-1..hook-3 inclusive)
    17     17   #      sqlite_update_hook    (tests hook-4-*)
    18     18   #      sqlite_rollback_hook  (tests hook-5.*)
    19     19   #
    20         -# $Id: hook.test,v 1.11 2006/01/17 09:35:02 danielk1977 Exp $
           20  +# $Id: hook.test,v 1.12 2007/10/09 08:29:32 danielk1977 Exp $
    21     21   
    22     22   set testdir [file dirname $argv0]
    23     23   source $testdir/tester.tcl
    24     24   
    25     25   do_test hook-1.2 {
    26     26     db commit_hook
    27     27   } {}
................................................................................
   173    173       INSERT INTO t1 VALUES(1, 'one');
   174    174       INSERT INTO t1 VALUES(2, 'two');
   175    175     }
   176    176   }
   177    177   
   178    178   # Update-hook + ATTACH
   179    179   set ::update_hook {}
   180         -do_test hook-4.2.3 {
   181         -  file delete -force test2.db
   182         -  execsql {
   183         -    ATTACH 'test2.db' AS aux;
   184         -    CREATE TABLE aux.t3(a INTEGER PRIMARY KEY, b);
   185         -    INSERT INTO aux.t3 SELECT * FROM t1;
   186         -    UPDATE t3 SET b = 'two or so' WHERE a = 2;
   187         -    DELETE FROM t3 WHERE 1; -- Avoid the truncate optimization (for now)
   188         -  }
   189         -  set ::update_hook
   190         -} [list \
   191         -    INSERT aux t3 1 \
   192         -    INSERT aux t3 2 \
   193         -    UPDATE aux t3 2 \
   194         -    DELETE aux t3 1 \
   195         -    DELETE aux t3 2 \
   196         -]
          180  +ifcapable attach {
          181  +  do_test hook-4.2.3 {
          182  +    file delete -force test2.db
          183  +    execsql {
          184  +      ATTACH 'test2.db' AS aux;
          185  +      CREATE TABLE aux.t3(a INTEGER PRIMARY KEY, b);
          186  +      INSERT INTO aux.t3 SELECT * FROM t1;
          187  +      UPDATE t3 SET b = 'two or so' WHERE a = 2;
          188  +      DELETE FROM t3 WHERE 1; -- Avoid the truncate optimization (for now)
          189  +    }
          190  +    set ::update_hook
          191  +  } [list \
          192  +      INSERT aux t3 1 \
          193  +      INSERT aux t3 2 \
          194  +      UPDATE aux t3 2 \
          195  +      DELETE aux t3 1 \
          196  +      DELETE aux t3 2 \
          197  +  ]
          198  +}
   197    199   
   198    200   ifcapable trigger {
   199    201     execsql {
   200    202       DROP TRIGGER t1_trigger;
   201    203     }
   202    204   }
   203    205   
................................................................................
   217    219       UPDATE main t1 1 \
   218    220       UPDATE main t1 2 \
   219    221       UPDATE main t1 3 \
   220    222       DELETE main t1 2 \
   221    223       DELETE main t1 3 \
   222    224   ]
   223    225   set ::update_hook {}
   224         -ifcapable compound {
          226  +ifcapable compound&&attach {
   225    227     do_test hook-4.3.2 {
   226    228       execsql {
   227    229         SELECT * FROM t1 UNION SELECT * FROM t3;
   228    230         SELECT * FROM t1 UNION ALL SELECT * FROM t3;
   229    231         SELECT * FROM t1 INTERSECT SELECT * FROM t3;
   230    232         SELECT * FROM t1 EXCEPT SELECT * FROM t3;
   231    233         SELECT * FROM t1 ORDER BY b;

Changes to test/incrblob.test.

     5      5   #
     6      6   #    May you do good and not evil.
     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12         -# $Id: incrblob.test,v 1.16 2007/09/03 16:45:36 drh Exp $
           12  +# $Id: incrblob.test,v 1.17 2007/10/09 08:29:32 danielk1977 Exp $
    13     13   #
    14     14   
    15     15   set testdir [file dirname $argv0]
    16     16   source $testdir/tester.tcl
    17     17   
    18     18   ifcapable {!autovacuum || !pragma || !incrblob} {
    19     19     finish_test
................................................................................
   337    337   } {}
   338    338   
   339    339   #------------------------------------------------------------------------
   340    340   # incrblob-5.*: 
   341    341   #
   342    342   #     Test that opening a blob in an attached database works.
   343    343   #
   344         -do_test incrblob-5.1 {
   345         -  file delete -force test2.db test2.db-journal
   346         -  set ::size [expr [file size [info script]]]
   347         -  execsql {
   348         -    ATTACH 'test2.db' AS aux;
   349         -    CREATE TABLE aux.files(name, text);
   350         -    INSERT INTO aux.files VALUES('this one', zeroblob($::size));
   351         -  }
   352         -  set fd  [db incrblob aux files text 1]
   353         -  fconfigure $fd -translation binary
   354         -  set fd2 [open [info script]]
   355         -  fconfigure $fd2 -translation binary
   356         -  puts -nonewline $fd [read $fd2]
   357         -  close $fd
   358         -  close $fd2
   359         -  set ::text [db one {select text from aux.files}]
   360         -  string length $::text
   361         -} [file size [info script]]
   362         -do_test incrblob-5.2 {
   363         -  set fd2 [open [info script]]
   364         -  fconfigure $fd2 -translation binary
   365         -  set ::data [read $fd2]
   366         -  close $fd2
   367         -  set ::data
   368         -} $::text
          344  +ifcapable attach {
          345  +  do_test incrblob-5.1 {
          346  +    file delete -force test2.db test2.db-journal
          347  +    set ::size [expr [file size [info script]]]
          348  +    execsql {
          349  +      ATTACH 'test2.db' AS aux;
          350  +      CREATE TABLE aux.files(name, text);
          351  +      INSERT INTO aux.files VALUES('this one', zeroblob($::size));
          352  +    }
          353  +    set fd  [db incrblob aux files text 1]
          354  +    fconfigure $fd -translation binary
          355  +    set fd2 [open [info script]]
          356  +    fconfigure $fd2 -translation binary
          357  +    puts -nonewline $fd [read $fd2]
          358  +    close $fd
          359  +    close $fd2
          360  +    set ::text [db one {select text from aux.files}]
          361  +    string length $::text
          362  +  } [file size [info script]]
          363  +  do_test incrblob-5.2 {
          364  +    set fd2 [open [info script]]
          365  +    fconfigure $fd2 -translation binary
          366  +    set ::data [read $fd2]
          367  +    close $fd2
          368  +    set ::data
          369  +  } $::text
          370  +}
   369    371   
   370    372   # free memory
   371         -unset ::data
   372         -unset ::text
          373  +unset -nocomplain ::data
          374  +unset -nocomplain ::text
   373    375   
   374    376   #------------------------------------------------------------------------
   375    377   # incrblob-6.*: 
   376    378   #
   377    379   #     Test that opening a blob for write-access is impossible if
   378    380   #     another connection has the database RESERVED lock.
   379    381   #

Changes to test/incrvacuum2.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the incremental vacuum feature.
    13     13   #
    14         -# $Id: incrvacuum2.test,v 1.3 2007/05/17 06:44:28 danielk1977 Exp $
           14  +# $Id: incrvacuum2.test,v 1.4 2007/10/09 08:29:32 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # If this build of the library does not support auto-vacuum, omit this
    20     20   # whole file.
    21     21   ifcapable {!autovacuum || !pragma} {
................................................................................
    72     72       PRAGMA incremental_vacuum(1000);
    73     73     }
    74     74     file size test.db
    75     75   } {3072}
    76     76   
    77     77   # Make sure incremental vacuum works on attached databases.
    78     78   #
    79         -do_test incrvacuum2-2.1 {
    80         -  file delete -force test2.db test2.db-journal
    81         -  execsql {
    82         -    ATTACH DATABASE 'test2.db' AS aux;
    83         -    PRAGMA aux.auto_vacuum=incremental;
    84         -    CREATE TABLE aux.t2(x);
    85         -    INSERT INTO t2 VALUES(zeroblob(30000));
    86         -    INSERT INTO t1 SELECT * FROM t2;
    87         -    DELETE FROM t2;
    88         -    DELETE FROM t1;
    89         -  }
    90         -  list [file size test.db] [file size test2.db]
    91         -} {32768 32768}
    92         -do_test incrvacuum2-2.2 {
    93         -  execsql {
    94         -    PRAGMA aux.incremental_vacuum(1)
    95         -  }
    96         -  list [file size test.db] [file size test2.db]
    97         -} {32768 31744}
    98         -do_test incrvacuum2-2.3 {
    99         -  execsql {
   100         -    PRAGMA aux.incremental_vacuum(5)
   101         -  }
   102         -  list [file size test.db] [file size test2.db]
   103         -} {32768 26624}
   104         -do_test incrvacuum2-2.4 {
   105         -  execsql {
   106         -    PRAGMA main.incremental_vacuum(5)
   107         -  }
   108         -  list [file size test.db] [file size test2.db]
   109         -} {27648 26624}
   110         -do_test incrvacuum2-2.5 {
   111         -  execsql {
   112         -    PRAGMA aux.incremental_vacuum
   113         -  }
   114         -  list [file size test.db] [file size test2.db]
   115         -} {27648 3072}
   116         -do_test incrvacuum2-2.6 {
   117         -  execsql {
   118         -    PRAGMA incremental_vacuum(1)
   119         -  }
   120         -  list [file size test.db] [file size test2.db]
   121         -} {26624 3072}
           79  +ifcapable attach {
           80  +  do_test incrvacuum2-2.1 {
           81  +    file delete -force test2.db test2.db-journal
           82  +    execsql {
           83  +      ATTACH DATABASE 'test2.db' AS aux;
           84  +      PRAGMA aux.auto_vacuum=incremental;
           85  +      CREATE TABLE aux.t2(x);
           86  +      INSERT INTO t2 VALUES(zeroblob(30000));
           87  +      INSERT INTO t1 SELECT * FROM t2;
           88  +      DELETE FROM t2;
           89  +      DELETE FROM t1;
           90  +    }
           91  +    list [file size test.db] [file size test2.db]
           92  +  } {32768 32768}
           93  +  do_test incrvacuum2-2.2 {
           94  +    execsql {
           95  +      PRAGMA aux.incremental_vacuum(1)
           96  +    }
           97  +    list [file size test.db] [file size test2.db]
           98  +  } {32768 31744}
           99  +  do_test incrvacuum2-2.3 {
          100  +    execsql {
          101  +      PRAGMA aux.incremental_vacuum(5)
          102  +    }
          103  +    list [file size test.db] [file size test2.db]
          104  +  } {32768 26624}
          105  +  do_test incrvacuum2-2.4 {
          106  +    execsql {
          107  +      PRAGMA main.incremental_vacuum(5)
          108  +    }
          109  +    list [file size test.db] [file size test2.db]
          110  +  } {27648 26624}
          111  +  do_test incrvacuum2-2.5 {
          112  +    execsql {
          113  +      PRAGMA aux.incremental_vacuum
          114  +    }
          115  +    list [file size test.db] [file size test2.db]
          116  +  } {27648 3072}
          117  +  do_test incrvacuum2-2.6 {
          118  +    execsql {
          119  +      PRAGMA incremental_vacuum(1)
          120  +    }
          121  +    list [file size test.db] [file size test2.db]
          122  +  } {26624 3072}
          123  +}
   122    124   
   123    125    
   124    126   
   125    127   finish_test

Changes to test/insert4.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the INSERT transfer optimization.
    13     13   #
    14         -# $Id: insert4.test,v 1.7 2007/09/12 17:01:45 danielk1977 Exp $
           14  +# $Id: insert4.test,v 1.8 2007/10/09 08:29:32 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   ifcapable !view||!subquery {
    20     20     finish_test
    21     21     return
................................................................................
   230    230   #
   231    231   xfer_check insert4-3.22 1 {1 9} \
   232    232       {a int, b int} \
   233    233       {x integer, b int}
   234    234   
   235    235   # Ticket #2291.
   236    236   #
   237         -do_test insert4-4.1 {
   238         -  execsql {
   239         -    CREATE TABLE t4(a, b, UNIQUE(a,b));
   240         -    INSERT INTO t4 VALUES(NULL,0);
   241         -    INSERT INTO t4 VALUES(NULL,1);
   242         -    INSERT INTO t4 VALUES(NULL,1);
   243         -    VACUUM;   
   244         -  }
          237  +
          238  +do_test insert4-4.1a {
          239  +  execsql {CREATE TABLE t4(a, b, UNIQUE(a,b))}
   245    240   } {}
          241  +ifcapable vacuum {
          242  +  do_test insert4-4.1b {
          243  +    execsql {
          244  +      INSERT INTO t4 VALUES(NULL,0);
          245  +      INSERT INTO t4 VALUES(NULL,1);
          246  +      INSERT INTO t4 VALUES(NULL,1);
          247  +      VACUUM;   
          248  +    }
          249  +  } {}
          250  +}
   246    251   
   247    252   # Check some error conditions:
   248    253   #
   249    254   do_test insert4-5.1 {
   250    255     # Table does not exist.
   251    256     catchsql { INSERT INTO t2 SELECT * FROM nosuchtable }
   252    257   } {1 {no such table: nosuchtable}}

Changes to test/io.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   # The focus of this file is testing some specific characteristics of the 
    13     13   # IO traffic generated by SQLite (making sure SQLite is not writing out
    14     14   # more database pages than it has to, stuff like that).
    15     15   #
    16         -# $Id: io.test,v 1.11 2007/10/03 21:18:20 drh Exp $
           16  +# $Id: io.test,v 1.12 2007/10/09 08:29:32 danielk1977 Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   # Test summary:
    22     22   #
    23     23   # io-1.* -  Test that quick-balance does not journal pages unnecessarily.
................................................................................
   225    225   
   226    226   # Test that if the database modification is part of multi-file commit,
   227    227   # the journal file is always created. In this case, the journal file
   228    228   # is created during execution of the COMMIT statement, so we have to
   229    229   # use the same technique to check that it is created as in the above 
   230    230   # block.
   231    231   file delete -force test2.db test2.db-journal
   232         -do_test io-2.7.1 {
   233         -  execsql {
   234         -    ATTACH 'test2.db' AS aux;
   235         -    PRAGMA aux.page_size = 1024;
   236         -    CREATE TABLE aux.abc2(a, b);
   237         -    BEGIN;
   238         -    INSERT INTO abc VALUES(9, 10);
   239         -  }
   240         -  file exists test.db-journal
   241         -} {0}
   242         -do_test io-2.7.2 {
   243         -  execsql { INSERT INTO abc2 SELECT * FROM abc }
   244         -  file exists test2.db-journal
   245         -} {0}
   246         -do_test io-2.7.3 {
   247         -  execsql { SELECT * FROM abc UNION ALL SELECT * FROM abc2 }
   248         -} {1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10}
   249         -do_test io-2.7.4 {
   250         -  set fd [open test2.db-journal w]
   251         -  puts $fd "This is not a journal file"
   252         -  close $fd
   253         -  catchsql { COMMIT }
   254         -} {1 {unable to open database file}}
   255         -do_test io-2.7.5 {
   256         -  file delete -force test2.db-journal
   257         -  catchsql { COMMIT }
   258         -} {1 {cannot commit - no transaction is active}}
   259         -do_test io-2.7.6 {
   260         -  execsql { SELECT * FROM abc UNION ALL SELECT * FROM abc2 }
   261         -} {1 2 3 4 5 6 7 8}
          232  +ifcapable attach {
          233  +  do_test io-2.7.1 {
          234  +    execsql {
          235  +      ATTACH 'test2.db' AS aux;
          236  +      PRAGMA aux.page_size = 1024;
          237  +      CREATE TABLE aux.abc2(a, b);
          238  +      BEGIN;
          239  +      INSERT INTO abc VALUES(9, 10);
          240  +    }
          241  +    file exists test.db-journal
          242  +  } {0}
          243  +  do_test io-2.7.2 {
          244  +    execsql { INSERT INTO abc2 SELECT * FROM abc }
          245  +    file exists test2.db-journal
          246  +  } {0}
          247  +  do_test io-2.7.3 {
          248  +    execsql { SELECT * FROM abc UNION ALL SELECT * FROM abc2 }
          249  +  } {1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10}
          250  +  do_test io-2.7.4 {
          251  +    set fd [open test2.db-journal w]
          252  +    puts $fd "This is not a journal file"
          253  +    close $fd
          254  +    catchsql { COMMIT }
          255  +  } {1 {unable to open database file}}
          256  +  do_test io-2.7.5 {
          257  +    file delete -force test2.db-journal
          258  +    catchsql { COMMIT }
          259  +  } {1 {cannot commit - no transaction is active}}
          260  +  do_test io-2.7.6 {
          261  +    execsql { SELECT * FROM abc UNION ALL SELECT * FROM abc2 }
          262  +  } {1 2 3 4 5 6 7 8}
          263  +}
   262    264   
   263    265   # Try an explicit ROLLBACK before the journal file is created.
   264    266   #
   265    267   do_test io-2.8.1 {
   266    268     execsql {
   267    269       BEGIN;
   268    270       DELETE FROM abc;

Changes to test/ioerr.test.

    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing for correct handling of I/O errors
    13     13   # such as writes failing because the disk is full.
    14     14   # 
    15     15   # The tests in this file use special facilities that are only
    16     16   # available in the SQLite test fixture.
    17     17   #
    18         -# $Id: ioerr.test,v 1.32 2007/09/01 17:00:13 danielk1977 Exp $
           18  +# $Id: ioerr.test,v 1.33 2007/10/09 08:29:32 danielk1977 Exp $
    19     19   
    20     20   set testdir [file dirname $argv0]
    21     21   source $testdir/tester.tcl
    22     22   
    23     23   
    24     24   # If SQLITE_DEFAULT_AUTOVACUUM is set to true, then a simulated IO error
    25     25   # on the 8th IO operation in the SQL script below doesn't report an error.
................................................................................
   114    114    SELECT * FROM abc;
   115    115   }
   116    116   
   117    117   # Test IO errors that may occur during a multi-file commit.
   118    118   #
   119    119   # Tests 8 and 17 are excluded when auto-vacuum is enabled for the same 
   120    120   # reason as in test cases ioerr-1.XXX
   121         -set ex ""
   122         -if {[string match [execsql {pragma auto_vacuum}] 1]} {
   123         -  set ex [list 4 17]
          121  +ifcapable attach {
          122  +  set ex ""
          123  +  if {[string match [execsql {pragma auto_vacuum}] 1]} {
          124  +    set ex [list 4 17]
          125  +  }
          126  +  do_ioerr_test ioerr-5 -sqlprep {
          127  +    ATTACH 'test2.db' AS test2;
          128  +  } -sqlbody {
          129  +    BEGIN;
          130  +    CREATE TABLE t1(a,b,c);
          131  +    CREATE TABLE test2.t2(a,b,c);
          132  +    COMMIT;
          133  +  } -exclude $ex
   124    134   }
   125         -do_ioerr_test ioerr-5 -sqlprep {
   126         -  ATTACH 'test2.db' AS test2;
   127         -} -sqlbody {
   128         -  BEGIN;
   129         -  CREATE TABLE t1(a,b,c);
   130         -  CREATE TABLE test2.t2(a,b,c);
   131         -  COMMIT;
   132         -} -exclude $ex
   133    135   
   134    136   # Test IO errors when replaying two hot journals from a 2-file 
   135    137   # transaction. This test only runs on UNIX.
   136         -ifcapable crashtest {
          138  +ifcapable crashtest&&attach {
   137    139     if {![catch {sqlite3 -has_codec} r] && !$r} {
   138    140       do_ioerr_test ioerr-6 -tclprep {
   139    141         execsql {
   140    142           ATTACH 'test2.db' as aux;
   141    143           CREATE TABLE tx(a, b);
   142    144           CREATE TABLE aux.ty(a, b);
   143    145         }

Changes to test/malloc.test.

    12     12   # This file attempts to check the behavior of the SQLite library in 
    13     13   # an out-of-memory situation. When compiled with -DSQLITE_DEBUG=1, 
    14     14   # the SQLite library accepts a special command (sqlite3_memdebug_fail N C)
    15     15   # which causes the N-th malloc to fail.  This special feature is used
    16     16   # to see what happens in the library if a malloc were to really fail
    17     17   # due to an out-of-memory situation.
    18     18   #
    19         -# $Id: malloc.test,v 1.50 2007/10/03 15:02:40 danielk1977 Exp $
           19  +# $Id: malloc.test,v 1.51 2007/10/09 08:29:33 danielk1977 Exp $
    20     20   
    21     21   set testdir [file dirname $argv0]
    22     22   source $testdir/tester.tcl
    23     23   
    24     24   # Only run these tests if memory debugging is turned on.
    25     25   #
    26     26   ifcapable !memdebug {
................................................................................
   289    289     append sql16 "\00\00"
   290    290     set ::STMT [sqlite3_prepare16 db $sql16 -1 DUMMY]
   291    291     sqlite3_finalize $::STMT
   292    292   }
   293    293   
   294    294   # Test malloc errors when replaying two hot journals from a 2-file 
   295    295   # transaction.
   296         -ifcapable crashtest {
          296  +ifcapable crashtest&&attach {
   297    297     do_malloc_test 13 -tclprep {
   298    298       set rc [crashsql -delay 1 -file test2.db {
   299    299         ATTACH 'test2.db' as aux;
   300    300         PRAGMA cache_size = 10;
   301    301         BEGIN;
   302    302         CREATE TABLE aux.t2(a, b, c);
   303    303         CREATE TABLE t1(a, b, c);
................................................................................
   473    473     }
   474    474   }
   475    475   unset static_string
   476    476   
   477    477   # Make sure SQLITE_NOMEM is reported out on an ATTACH failure even
   478    478   # when the malloc failure occurs within the nested parse.
   479    479   #
   480         -do_malloc_test 20 -tclprep {
   481         -  db close
   482         -  file delete -force test2.db test2.db-journal
   483         -  sqlite3 db test2.db
   484         -  sqlite3_extended_result_codes db 1
   485         -  db eval {CREATE TABLE t1(x);}
   486         -  db close
   487         -} -tclbody {
   488         -  if {[catch {sqlite3 db test.db}]} {
   489         -    error "out of memory"
   490         -  }
   491         -  sqlite3_extended_result_codes db 1
   492         -} -sqlbody {
   493         -  ATTACH DATABASE 'test2.db' AS t2;
   494         -  SELECT * FROM t1;
   495         -  DETACH DATABASE t2;
   496         -} 
          480  +ifcapable attach {
          481  +  do_malloc_test 20 -tclprep {
          482  +    db close
          483  +    file delete -force test2.db test2.db-journal
          484  +    sqlite3 db test2.db
          485  +    sqlite3_extended_result_codes db 1
          486  +    db eval {CREATE TABLE t1(x);}
          487  +    db close
          488  +  } -tclbody {
          489  +    if {[catch {sqlite3 db test.db}]} {
          490  +      error "out of memory"
          491  +    }
          492  +    sqlite3_extended_result_codes db 1
          493  +  } -sqlbody {
          494  +    ATTACH DATABASE 'test2.db' AS t2;
          495  +    SELECT * FROM t1;
          496  +    DETACH DATABASE t2;
          497  +  } 
          498  +}
   497    499   
   498    500   # Test malloc failure whilst installing a foreign key.
   499    501   #
   500    502   ifcapable foreignkey {
   501    503     do_malloc_test 21 -sqlbody {
   502    504       CREATE TABLE abc(a, b, c, FOREIGN KEY(a) REFERENCES abc(b))
   503    505     } 

Changes to test/malloc3.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   # This file contains tests to ensure that the library handles malloc() failures
    13     13   # correctly. The emphasis of these tests are the _prepare(), _step() and
    14     14   # _finalize() calls.
    15     15   #
    16         -# $Id: malloc3.test,v 1.16 2007/10/03 08:46:45 danielk1977 Exp $
           16  +# $Id: malloc3.test,v 1.17 2007/10/09 08:29:33 danielk1977 Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   # Only run these tests if memory debugging is turned on.
    22     22   #
    23     23   ifcapable !memdebug {
................................................................................
   458    458       }
   459    459     } {a b c a b c 1 2 3 1 2 3}
   460    460   }
   461    461   
   462    462   # Test a simple multi-file transaction 
   463    463   #
   464    464   file delete -force test2.db
   465         -SQL {ATTACH 'test2.db' AS aux;}
   466         -SQL {BEGIN}
   467         -SQL {CREATE TABLE aux.tbl2(x, y, z)}
   468         -SQL {INSERT INTO tbl2 VALUES(1, 2, 3)}
   469         -SQL {INSERT INTO def VALUES(4, 5, 6)}
   470         -TEST 30 {
   471         -  do_test $testid {
   472         -    execsql {
   473         -      SELECT * FROM tbl2, def WHERE d = x;
   474         -    }
   475         -  } {1 2 3 1 2 3}
   476         -}
   477         -SQL {COMMIT}
   478         -TEST 31 {
   479         -  do_test $testid {
   480         -    execsql {
   481         -      SELECT * FROM tbl2, def WHERE d = x;
   482         -    }
   483         -  } {1 2 3 1 2 3}
          465  +ifcapable attach {
          466  +  SQL {ATTACH 'test2.db' AS aux;}
          467  +  SQL {BEGIN}
          468  +  SQL {CREATE TABLE aux.tbl2(x, y, z)}
          469  +  SQL {INSERT INTO tbl2 VALUES(1, 2, 3)}
          470  +  SQL {INSERT INTO def VALUES(4, 5, 6)}
          471  +  TEST 30 {
          472  +    do_test $testid {
          473  +      execsql {
          474  +        SELECT * FROM tbl2, def WHERE d = x;
          475  +      }
          476  +    } {1 2 3 1 2 3}
          477  +  }
          478  +  SQL {COMMIT}
          479  +  TEST 31 {
          480  +    do_test $testid {
          481  +      execsql {
          482  +        SELECT * FROM tbl2, def WHERE d = x;
          483  +      }
          484  +    } {1 2 3 1 2 3}
          485  +  }
   484    486   }
   485    487   
   486    488   # Test what happens when a malloc() fails while there are other active
   487    489   # statements. This changes the way sqlite3VdbeHalt() works.
   488    490   TEST 32 {
   489    491     if {![info exists ::STMT32]} {
   490    492       set sql "SELECT name FROM sqlite_master"

Changes to test/mallocD.test.

     5      5   #
     6      6   #    May you do good and not evil.
     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12         -# $Id: mallocD.test,v 1.3 2007/09/03 17:02:50 drh Exp $
           12  +# $Id: mallocD.test,v 1.4 2007/10/09 08:29:33 danielk1977 Exp $
    13     13   
    14     14   set testdir [file dirname $argv0]
    15     15   source $testdir/tester.tcl
    16     16   
    17     17   # Only run these tests if memory debugging is turned on.
    18     18   #
    19     19   ifcapable !memdebug {
................................................................................
    44     44   do_malloc_test mallocD-3 -sqlprep $PREP -sqlbody {
    45     45     BEGIN;
    46     46     INSERT INTO abc VALUES(1, 2, 3);
    47     47     INSERT INTO abc VALUES(4, 5, randstr(1500,1500));
    48     48     COMMIT;
    49     49   }
    50     50   
    51         -do_malloc_test mallocD-4 -sqlprep $PREP -sqlbody {
    52         -  ATTACH 'test2.db' AS aux;
    53         -  BEGIN;
    54         -  CREATE TABLE aux.def(d, e, f);
    55         -  INSERT INTO abc VALUES(4, 5, 6);
    56         -  COMMIT;
           51  +ifcapable attach {
           52  +  do_malloc_test mallocD-4 -sqlprep $PREP -sqlbody {
           53  +    ATTACH 'test2.db' AS aux;
           54  +    BEGIN;
           55  +    CREATE TABLE aux.def(d, e, f);
           56  +    INSERT INTO abc VALUES(4, 5, 6);
           57  +    COMMIT;
           58  +  }
    57     59   }
    58     60   
    59     61   sqlite3_simulate_device -char {}
    60     62   
    61     63   finish_test

Changes to test/pragma.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file implements tests for the PRAGMA command.
    14     14   #
    15         -# $Id: pragma.test,v 1.54 2007/05/17 16:38:30 danielk1977 Exp $
           15  +# $Id: pragma.test,v 1.55 2007/10/09 08:29:33 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Test organization:
    21     21   #
    22     22   # pragma-1.*: Test cache_size, default_cache_size and synchronous on main db.
................................................................................
   206    206   do_test pragma-1.18 {
   207    207     execsql {
   208    208       PRAGMA bogus = -1234;  -- Parsing of negative values
   209    209     }
   210    210   } {}
   211    211   
   212    212   # Test modifying the safety_level of an attached database.
   213         -do_test pragma-2.1 {
   214         -  file delete -force test2.db
   215         -  file delete -force test2.db-journal
   216         -  execsql {
   217         -    ATTACH 'test2.db' AS aux;
   218         -  } 
   219         -} {}
   220         -ifcapable pager_pragmas {
   221         -do_test pragma-2.2 {
   222         -  execsql {
   223         -    pragma aux.synchronous;
   224         -  } 
   225         -} {2}
   226         -do_test pragma-2.3 {
   227         -  execsql {
   228         -    pragma aux.synchronous = OFF;
   229         -    pragma aux.synchronous;
   230         -    pragma synchronous;
   231         -  } 
   232         -} {0 2}
   233         -do_test pragma-2.4 {
   234         -  execsql {
   235         -    pragma aux.synchronous = ON;
   236         -    pragma synchronous;
   237         -    pragma aux.synchronous;
   238         -  } 
   239         -} {2 1}
          213  +ifcapable pager_pragmas&&attach {
          214  +  do_test pragma-2.1 {
          215  +    file delete -force test2.db
          216  +    file delete -force test2.db-journal
          217  +    execsql {
          218  +      ATTACH 'test2.db' AS aux;
          219  +    } 
          220  +  } {}
          221  +  do_test pragma-2.2 {
          222  +    execsql {
          223  +      pragma aux.synchronous;
          224  +    } 
          225  +  } {2}
          226  +  do_test pragma-2.3 {
          227  +    execsql {
          228  +      pragma aux.synchronous = OFF;
          229  +      pragma aux.synchronous;
          230  +      pragma synchronous;
          231  +    } 
          232  +  } {0 2}
          233  +  do_test pragma-2.4 {
          234  +    execsql {
          235  +      pragma aux.synchronous = ON;
          236  +      pragma synchronous;
          237  +      pragma aux.synchronous;
          238  +    } 
          239  +  } {2 1}
   240    240   } ;# ifcapable pager_pragmas
   241    241   
   242    242   # Construct a corrupted index and make sure the integrity_check
   243    243   # pragma finds it.
   244    244   #
   245    245   # These tests won't work if the database is encrypted
   246    246   #
................................................................................
   255    255       CREATE INDEX i2 ON t2(a);
   256    256       INSERT INTO t2 VALUES(11,2,3);
   257    257       INSERT INTO t2 VALUES(22,3,4);
   258    258       COMMIT;
   259    259       SELECT rowid, * from t2;
   260    260     }
   261    261   } {1 11 2 3 2 22 3 4}
   262         -if {![sqlite3 -has-codec] && $sqlite_options(integrityck)} {
   263         -  do_test pragma-3.2 {
   264         -    set rootpage [execsql {SELECT rootpage FROM sqlite_master WHERE name='i2'}]
   265         -    set db [btree_open test.db 100 0]
   266         -    btree_begin_transaction $db
   267         -    set c [btree_cursor $db $rootpage 1]
   268         -    btree_first $c
   269         -    btree_delete $c
   270         -    btree_commit $db
   271         -    btree_close $db
   272         -    execsql {PRAGMA integrity_check}
   273         -  } {{rowid 1 missing from index i2} {wrong # of entries in index i2}}
   274         -  do_test pragma-3.3 {
   275         -    execsql {PRAGMA integrity_check=1}
   276         -  } {{rowid 1 missing from index i2}}
   277         -  do_test pragma-3.4 {
   278         -    execsql {
   279         -      ATTACH DATABASE 'test.db' AS t2;
   280         -      PRAGMA integrity_check
   281         -    }
   282         -  } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
   283         -  do_test pragma-3.5 {
   284         -    execsql {
   285         -      PRAGMA integrity_check=3
   286         -    }
   287         -  } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2}}
   288         -  do_test pragma-3.6 {
   289         -    execsql {
   290         -      PRAGMA integrity_check=xyz
   291         -    }
   292         -  } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
   293         -  do_test pragma-3.7 {
   294         -    execsql {
   295         -      PRAGMA integrity_check=0
   296         -    }
   297         -  } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
   298         -
   299         -  # Add additional corruption by appending unused pages to the end of
   300         -  # the database file testerr.db
   301         -  #
   302         -  do_test pragma-3.8 {
   303         -    execsql {DETACH t2}
   304         -    file delete -force testerr.db testerr.db-journal
   305         -    set out [open testerr.db w]
   306         -    fconfigure $out -translation binary
   307         -    set in [open test.db r]
   308         -    fconfigure $in -translation binary
   309         -    puts -nonewline $out [read $in]
   310         -    seek $in 0
   311         -    puts -nonewline $out [read $in]
   312         -    close $in
   313         -    close $out
   314         -    execsql {REINDEX t2}
   315         -    execsql {PRAGMA integrity_check}
   316         -  } {ok}
   317         -  do_test pragma-3.9 {
   318         -    execsql {
   319         -      ATTACH 'testerr.db' AS t2;
   320         -      PRAGMA integrity_check
   321         -    }
   322         -  } {{*** in database t2 ***
          262  +ifcapable attach {
          263  +  if {![sqlite3 -has-codec] && $sqlite_options(integrityck)} {
          264  +    do_test pragma-3.2 {
          265  +      set rootpage [execsql {SELECT rootpage FROM sqlite_master WHERE name='i2'}]
          266  +      set db [btree_open test.db 100 0]
          267  +      btree_begin_transaction $db
          268  +      set c [btree_cursor $db $rootpage 1]
          269  +      btree_first $c
          270  +      btree_delete $c
          271  +      btree_commit $db
          272  +      btree_close $db
          273  +      execsql {PRAGMA integrity_check}
          274  +    } {{rowid 1 missing from index i2} {wrong # of entries in index i2}}
          275  +    do_test pragma-3.3 {
          276  +      execsql {PRAGMA integrity_check=1}
          277  +    } {{rowid 1 missing from index i2}}
          278  +    do_test pragma-3.4 {
          279  +      execsql {
          280  +        ATTACH DATABASE 'test.db' AS t2;
          281  +        PRAGMA integrity_check
          282  +      }
          283  +    } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
          284  +    do_test pragma-3.5 {
          285  +      execsql {
          286  +        PRAGMA integrity_check=3
          287  +      }
          288  +    } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2}}
          289  +    do_test pragma-3.6 {
          290  +      execsql {
          291  +        PRAGMA integrity_check=xyz
          292  +      }
          293  +    } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
          294  +    do_test pragma-3.7 {
          295  +      execsql {
          296  +        PRAGMA integrity_check=0
          297  +      }
          298  +    } {{rowid 1 missing from index i2} {wrong # of entries in index i2} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
          299  +  
          300  +    # Add additional corruption by appending unused pages to the end of
          301  +    # the database file testerr.db
          302  +    #
          303  +    do_test pragma-3.8 {
          304  +      execsql {DETACH t2}
          305  +      file delete -force testerr.db testerr.db-journal
          306  +      set out [open testerr.db w]
          307  +      fconfigure $out -translation binary
          308  +      set in [open test.db r]
          309  +      fconfigure $in -translation binary
          310  +      puts -nonewline $out [read $in]
          311  +      seek $in 0
          312  +      puts -nonewline $out [read $in]
          313  +      close $in
          314  +      close $out
          315  +      execsql {REINDEX t2}
          316  +      execsql {PRAGMA integrity_check}
          317  +    } {ok}
          318  +    do_test pragma-3.9 {
          319  +      execsql {
          320  +        ATTACH 'testerr.db' AS t2;
          321  +        PRAGMA integrity_check
          322  +      }
          323  +    } {{*** in database t2 ***
          324  +Page 4 is never used
          325  +Page 5 is never used
          326  +Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
          327  +    do_test pragma-3.10 {
          328  +      execsql {
          329  +        PRAGMA integrity_check=1
          330  +      }
          331  +    } {{*** in database t2 ***
          332  +Page 4 is never used}}
          333  +    do_test pragma-3.11 {
          334  +      execsql {
          335  +        PRAGMA integrity_check=5
          336  +      }
          337  +    } {{*** in database t2 ***
   323    338   Page 4 is never used
   324    339   Page 5 is never used
   325    340   Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
   326         -  do_test pragma-3.10 {
   327         -    execsql {
   328         -      PRAGMA integrity_check=1
   329         -    }
   330         -  } {{*** in database t2 ***
   331         -Page 4 is never used}}
   332         -  do_test pragma-3.11 {
   333         -    execsql {
   334         -      PRAGMA integrity_check=5
   335         -    }
   336         -  } {{*** in database t2 ***
   337         -Page 4 is never used
   338         -Page 5 is never used
   339         -Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
   340         -  do_test pragma-3.12 {
   341         -    execsql {
   342         -      PRAGMA integrity_check=4
   343         -    }
   344         -  } {{*** in database t2 ***
          341  +    do_test pragma-3.12 {
          342  +      execsql {
          343  +        PRAGMA integrity_check=4
          344  +      }
          345  +    } {{*** in database t2 ***
   345    346   Page 4 is never used
   346    347   Page 5 is never used
   347    348   Page 6 is never used} {rowid 1 missing from index i2}}
   348         -  do_test pragma-3.13 {
   349         -    execsql {
   350         -      PRAGMA integrity_check=3
   351         -    }
   352         -  } {{*** in database t2 ***
          349  +    do_test pragma-3.13 {
          350  +      execsql {
          351  +        PRAGMA integrity_check=3
          352  +      }
          353  +    } {{*** in database t2 ***
   353    354   Page 4 is never used
   354    355   Page 5 is never used
   355    356   Page 6 is never used}}
   356         -  do_test pragma-3.14 {
   357         -    execsql {
   358         -      PRAGMA integrity_check(2)
   359         -    }
   360         -  } {{*** in database t2 ***
          357  +    do_test pragma-3.14 {
          358  +      execsql {
          359  +        PRAGMA integrity_check(2)
          360  +      }
          361  +    } {{*** in database t2 ***
   361    362   Page 4 is never used
   362    363   Page 5 is never used}}
   363         -  do_test pragma-3.15 {
   364         -    execsql {
   365         -      ATTACH 'testerr.db' AS t3;
   366         -      PRAGMA integrity_check
   367         -    }
   368         -  } {{*** in database t2 ***
          364  +    do_test pragma-3.15 {
          365  +      execsql {
          366  +        ATTACH 'testerr.db' AS t3;
          367  +        PRAGMA integrity_check
          368  +      }
          369  +    } {{*** in database t2 ***
   369    370   Page 4 is never used
   370    371   Page 5 is never used
   371    372   Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 ***
   372    373   Page 4 is never used
   373    374   Page 5 is never used
   374    375   Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2}}
   375         -  do_test pragma-3.16 {
   376         -    execsql {
   377         -      PRAGMA integrity_check(9)
   378         -    }
   379         -  } {{*** in database t2 ***
          376  +    do_test pragma-3.16 {
          377  +      execsql {
          378  +        PRAGMA integrity_check(9)
          379  +      }
          380  +    } {{*** in database t2 ***
   380    381   Page 4 is never used
   381    382   Page 5 is never used
   382    383   Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 ***
   383    384   Page 4 is never used
   384    385   Page 5 is never used
   385    386   Page 6 is never used} {rowid 1 missing from index i2}}
   386         -  do_test pragma-3.17 {
   387         -    execsql {
   388         -      PRAGMA integrity_check=7
   389         -    }
   390         -  } {{*** in database t2 ***
          387  +    do_test pragma-3.17 {
          388  +      execsql {
          389  +        PRAGMA integrity_check=7
          390  +      }
          391  +    } {{*** in database t2 ***
   391    392   Page 4 is never used
   392    393   Page 5 is never used
   393    394   Page 6 is never used} {rowid 1 missing from index i2} {wrong # of entries in index i2} {*** in database t3 ***
   394    395   Page 4 is never used
   395    396   Page 5 is never used}}
   396         -  do_test pragma-3.18 {
   397         -    execsql {
   398         -      PRAGMA integrity_check=4
   399         -    }
   400         -  } {{*** in database t2 ***
          397  +    do_test pragma-3.18 {
          398  +      execsql {
          399  +        PRAGMA integrity_check=4
          400  +      }
          401  +    } {{*** in database t2 ***
   401    402   Page 4 is never used
   402    403   Page 5 is never used
   403    404   Page 6 is never used} {rowid 1 missing from index i2}}
          405  +  }
          406  +  do_test pragma-3.99 {
          407  +    catchsql {DETACH t3}
          408  +    catchsql {DETACH t2}
          409  +    file delete -force testerr.db testerr.db-journal
          410  +    catchsql {DROP INDEX i2}
          411  +  } {0 {}}
   404    412   }
   405         -do_test pragma-3.99 {
   406         -  catchsql {DETACH t3}
   407         -  catchsql {DETACH t2}
   408         -  file delete -force testerr.db testerr.db-journal
   409         -  catchsql {DROP INDEX i2}
   410         -} {0 {}}
   411    413   
   412    414   # Test modifying the cache_size of an attached database.
   413         -ifcapable pager_pragmas {
          415  +ifcapable pager_pragmas&&attach {
   414    416   do_test pragma-4.1 {
   415    417     execsql {
   416    418       ATTACH 'test2.db' AS aux;
   417    419       pragma aux.cache_size;
   418    420       pragma aux.default_cache_size;
   419    421     } 
   420    422   } [list $DFLT_CACHE_SZ $DFLT_CACHE_SZ]
................................................................................
   477    479   } {2}
   478    480   catchsql {COMMIT;}
   479    481   } ;# ifcapable pager_pragmas
   480    482   
   481    483   # Test schema-query pragmas
   482    484   #
   483    485   ifcapable schema_pragmas {
   484         -ifcapable tempdb {
          486  +ifcapable tempdb&&attach {
   485    487     do_test pragma-6.1 {
   486    488       set res {}
   487    489       execsql {SELECT * FROM sqlite_temp_master}
   488    490       foreach {idx name file} [execsql {pragma database_list}] {
   489    491         lappend res $idx $name
   490    492       }
   491    493       set res
................................................................................
   643    645   do_test pragma-8.1.10 {
   644    646     sqlite3_finalize $::STMT
   645    647   } SQLITE_SCHEMA
   646    648   
   647    649   # Make sure the schema-version can be manipulated in an attached database.
   648    650   file delete -force test2.db
   649    651   file delete -force test2.db-journal
   650         -do_test pragma-8.1.11 {
   651         -  execsql {
   652         -    ATTACH 'test2.db' AS aux;
   653         -    CREATE TABLE aux.t1(a, b, c);
   654         -    PRAGMA aux.schema_version = 205;
   655         -  }
   656         -} {}
   657         -do_test pragma-8.1.12 {
   658         -  execsql {
   659         -    PRAGMA aux.schema_version;
   660         -  }
   661         -} 205
          652  +ifcapable attach {
          653  +  do_test pragma-8.1.11 {
          654  +    execsql {
          655  +      ATTACH 'test2.db' AS aux;
          656  +      CREATE TABLE aux.t1(a, b, c);
          657  +      PRAGMA aux.schema_version = 205;
          658  +    }
          659  +  } {}
          660  +  do_test pragma-8.1.12 {
          661  +    execsql {
          662  +      PRAGMA aux.schema_version;
          663  +    }
          664  +  } 205
          665  +}
   662    666   do_test pragma-8.1.13 {
   663    667     execsql {
   664    668       PRAGMA schema_version;
   665    669     }
   666    670   } 108
   667    671   
   668    672   # And check that modifying the schema-version in an attached database
   669    673   # forces the second connection to reload the schema.
   670         -do_test pragma-8.1.14 {
   671         -  sqlite3 db2 test.db; set ::DB2 [sqlite3_connection_pointer db2]
   672         -  execsql {
   673         -    ATTACH 'test2.db' AS aux;
   674         -    SELECT * FROM aux.t1;
   675         -  } db2
   676         -} {}
   677         -do_test pragma-8.1.15 {
   678         -  execsql {
   679         -    PRAGMA aux.schema_version = 206;
   680         -  }
   681         -} {}
   682         -do_test pragma-8.1.16 {
   683         -  set ::STMT [sqlite3_prepare $::DB2 "SELECT * FROM aux.t1" -1 DUMMY]
   684         -  sqlite3_step $::STMT
   685         -} SQLITE_ERROR
   686         -do_test pragma-8.1.17 {
   687         -  sqlite3_finalize $::STMT
   688         -} SQLITE_SCHEMA
   689         -do_test pragma-8.1.18 {
   690         -  db2 close
   691         -} {}
          674  +ifcapable attach {
          675  +  do_test pragma-8.1.14 {
          676  +    sqlite3 db2 test.db; set ::DB2 [sqlite3_connection_pointer db2]
          677  +    execsql {
          678  +      ATTACH 'test2.db' AS aux;
          679  +      SELECT * FROM aux.t1;
          680  +    } db2
          681  +  } {}
          682  +  do_test pragma-8.1.15 {
          683  +    execsql {
          684  +      PRAGMA aux.schema_version = 206;
          685  +    }
          686  +  } {}
          687  +  do_test pragma-8.1.16 {
          688  +    set ::STMT [sqlite3_prepare $::DB2 "SELECT * FROM aux.t1" -1 DUMMY]
          689  +    sqlite3_step $::STMT
          690  +  } SQLITE_ERROR
          691  +  do_test pragma-8.1.17 {
          692  +    sqlite3_finalize $::STMT
          693  +  } SQLITE_SCHEMA
          694  +  do_test pragma-8.1.18 {
          695  +    db2 close
          696  +  } {}
          697  +}
   692    698   
   693    699   # Now test that the user-version can be read and written (and that we aren't
   694    700   # accidentally manipulating the schema-version instead).
   695    701   do_test pragma-8.2.1 {
   696    702     execsql2 {
   697    703       PRAGMA user_version;
   698    704     }
................................................................................
   728    734     } {2}
   729    735     do_test pragma-8.2.4.3 {
   730    736       execsql {
   731    737         PRAGMA schema_version;
   732    738       }
   733    739     } {109}
   734    740   }
   735         -db eval {ATTACH 'test2.db' AS aux}
   736         -
   737         -# Check that the user-version in the auxilary database can be manipulated (
   738         -# and that we aren't accidentally manipulating the same in the main db).
   739         -do_test pragma-8.2.5 {
   740         -  execsql {
   741         -    PRAGMA aux.user_version;
   742         -  }
   743         -} {0}
   744         -do_test pragma-8.2.6 {
   745         -  execsql {
   746         -    PRAGMA aux.user_version = 3;
   747         -  }
   748         -} {}
   749         -do_test pragma-8.2.7 {
   750         -  execsql {
   751         -    PRAGMA aux.user_version;
   752         -  }
   753         -} {3}
   754         -do_test pragma-8.2.8 {
   755         -  execsql {
   756         -    PRAGMA main.user_version;
   757         -  }
   758         -} {2}
   759         -
   760         -# Now check that a ROLLBACK resets the user-version if it has been modified
   761         -# within a transaction.
   762         -do_test pragma-8.2.9 {
   763         -  execsql {
   764         -    BEGIN;
   765         -    PRAGMA aux.user_version = 10;
   766         -    PRAGMA user_version = 11;
   767         -  }
   768         -} {}
   769         -do_test pragma-8.2.10 {
   770         -  execsql {
   771         -    PRAGMA aux.user_version;
   772         -  }
   773         -} {10}
   774         -do_test pragma-8.2.11 {
   775         -  execsql {
   776         -    PRAGMA main.user_version;
   777         -  }
   778         -} {11}
   779         -do_test pragma-8.2.12 {
   780         -  execsql {
   781         -    ROLLBACK;
   782         -    PRAGMA aux.user_version;
   783         -  }
   784         -} {3}
   785         -do_test pragma-8.2.13 {
   786         -  execsql {
   787         -    PRAGMA main.user_version;
   788         -  }
   789         -} {2}
          741  +
          742  +ifcapable attach {
          743  +  db eval {ATTACH 'test2.db' AS aux}
          744  +  
          745  +  # Check that the user-version in the auxilary database can be manipulated (
          746  +  # and that we aren't accidentally manipulating the same in the main db).
          747  +  do_test pragma-8.2.5 {
          748  +    execsql {
          749  +      PRAGMA aux.user_version;
          750  +    }
          751  +  } {0}
          752  +  do_test pragma-8.2.6 {
          753  +    execsql {
          754  +      PRAGMA aux.user_version = 3;
          755  +    }
          756  +  } {}
          757  +  do_test pragma-8.2.7 {
          758  +    execsql {
          759  +      PRAGMA aux.user_version;
          760  +    }
          761  +  } {3}
          762  +  do_test pragma-8.2.8 {
          763  +    execsql {
          764  +      PRAGMA main.user_version;
          765  +    }
          766  +  } {2}
          767  +  
          768  +  # Now check that a ROLLBACK resets the user-version if it has been modified
          769  +  # within a transaction.
          770  +  do_test pragma-8.2.9 {
          771  +    execsql {
          772  +      BEGIN;
          773  +      PRAGMA aux.user_version = 10;
          774  +      PRAGMA user_version = 11;
          775  +    }
          776  +  } {}
          777  +  do_test pragma-8.2.10 {
          778  +    execsql {
          779  +      PRAGMA aux.user_version;
          780  +    }
          781  +  } {10}
          782  +  do_test pragma-8.2.11 {
          783  +    execsql {
          784  +      PRAGMA main.user_version;
          785  +    }
          786  +  } {11}
          787  +  do_test pragma-8.2.12 {
          788  +    execsql {
          789  +      ROLLBACK;
          790  +      PRAGMA aux.user_version;
          791  +    }
          792  +  } {3}
          793  +  do_test pragma-8.2.13 {
          794  +    execsql {
          795  +      PRAGMA main.user_version;
          796  +    }
          797  +  } {2}
          798  +}
   790    799   
   791    800   # Try a negative value for the user-version
   792    801   do_test pragma-8.2.14 {
   793    802     execsql {
   794    803       PRAGMA user_version = -450;
   795    804     }
   796    805   } {}

Changes to test/pragma2.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file implements tests for the PRAGMA command.
    14     14   #
    15         -# $Id: pragma2.test,v 1.3 2007/09/12 17:01:45 danielk1977 Exp $
           15  +# $Id: pragma2.test,v 1.4 2007/10/09 08:29:33 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Test organization:
    21     21   #
    22     22   # pragma2-1.*: Test freelist_count pragma on the main database.
................................................................................
    60     60       PRAGMA main.freelist_count;
    61     61     }
    62     62   } {1}
    63     63   
    64     64   file delete -force test2.db
    65     65   file delete -force test2.db-journal
    66     66   
    67         -do_test pragma2-2.1 {
    68         -  execsql {
    69         -    ATTACH 'test2.db' AS aux;
    70         -    PRAGMA aux.auto_vacuum=OFF;
    71         -    PRAGMA aux.freelist_count;
    72         -  }
    73         -} {0}
    74         -do_test pragma2-2.2 {
    75         -  execsql {
    76         -    CREATE TABLE aux.abc(a, b, c);
    77         -    PRAGMA aux.freelist_count;
    78         -  }
    79         -} {0}
    80         -do_test pragma2-2.3 {
    81         -  set ::val [string repeat 0123456789 1000]
    82         -  execsql {
    83         -    INSERT INTO aux.abc VALUES(1, 2, $::val);
    84         -    PRAGMA aux.freelist_count;
    85         -  }
    86         -} {0}
    87         -do_test pragma2-2.4 {
    88         -  expr {[file size test2.db] / 1024}
    89         -} {11}
    90         -do_test pragma2-2.5 {
    91         -  execsql {
    92         -    DELETE FROM aux.abc;
    93         -    PRAGMA aux.freelist_count;
    94         -  }
    95         -} {9}
    96         -
    97         -do_test pragma2-3.1 {
    98         -  execsql {
    99         -    PRAGMA aux.freelist_count;
   100         -    PRAGMA main.freelist_count;
   101         -    PRAGMA freelist_count;
   102         -  }
   103         -} {9 1 1}
   104         -do_test pragma2-3.2 {
   105         -  execsql {
   106         -    PRAGMA freelist_count = 500;
   107         -    PRAGMA freelist_count;
   108         -  }
   109         -} {1 1}
   110         -do_test pragma2-3.3 {
   111         -  execsql {
   112         -    PRAGMA aux.freelist_count = 500;
   113         -    PRAGMA aux.freelist_count;
   114         -  }
   115         -} {9 9}
           67  +ifcapable attach {
           68  +  do_test pragma2-2.1 {
           69  +    execsql {
           70  +      ATTACH 'test2.db' AS aux;
           71  +      PRAGMA aux.auto_vacuum=OFF;
           72  +      PRAGMA aux.freelist_count;
           73  +    }
           74  +  } {0}
           75  +  do_test pragma2-2.2 {
           76  +    execsql {
           77  +      CREATE TABLE aux.abc(a, b, c);
           78  +      PRAGMA aux.freelist_count;
           79  +    }
           80  +  } {0}
           81  +  do_test pragma2-2.3 {
           82  +    set ::val [string repeat 0123456789 1000]
           83  +    execsql {
           84  +      INSERT INTO aux.abc VALUES(1, 2, $::val);
           85  +      PRAGMA aux.freelist_count;
           86  +    }
           87  +  } {0}
           88  +  do_test pragma2-2.4 {
           89  +    expr {[file size test2.db] / 1024}
           90  +  } {11}
           91  +  do_test pragma2-2.5 {
           92  +    execsql {
           93  +      DELETE FROM aux.abc;
           94  +      PRAGMA aux.freelist_count;
           95  +    }
           96  +  } {9}
           97  +  
           98  +  do_test pragma2-3.1 {
           99  +    execsql {
          100  +      PRAGMA aux.freelist_count;
          101  +      PRAGMA main.freelist_count;
          102  +      PRAGMA freelist_count;
          103  +    }
          104  +  } {9 1 1}
          105  +  do_test pragma2-3.2 {
          106  +    execsql {
          107  +      PRAGMA freelist_count = 500;
          108  +      PRAGMA freelist_count;
          109  +    }
          110  +  } {1 1}
          111  +  do_test pragma2-3.3 {
          112  +    execsql {
          113  +      PRAGMA aux.freelist_count = 500;
          114  +      PRAGMA aux.freelist_count;
          115  +    }
          116  +  } {9 9}
          117  +}
   116    118   
   117    119   finish_test

Changes to test/schema.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file tests the various conditions under which an SQLITE_SCHEMA
    14     14   # error should be returned.
    15     15   #
    16         -# $Id: schema.test,v 1.7 2007/08/13 15:28:35 danielk1977 Exp $
           16  +# $Id: schema.test,v 1.8 2007/10/09 08:29:33 danielk1977 Exp $
    17     17   
    18     18   #---------------------------------------------------------------------
    19     19   # When any of the following types of SQL statements or actions are 
    20     20   # executed, all pre-compiled statements are invalidated. An attempt
    21     21   # to execute an invalidated statement always returns SQLITE_SCHEMA.
    22     22   #
    23     23   # CREATE/DROP TABLE...................................schema-1.*
................................................................................
   137    137     sqlite3_finalize $::STMT
   138    138   } {SQLITE_SCHEMA}
   139    139   
   140    140   #---------------------------------------------------------------------
   141    141   # Tests 5.1 to 5.4 check that prepared statements are invalidated when
   142    142   # a database is DETACHed (but not when one is ATTACHed).
   143    143   #
   144         -do_test schema-5.1 {
   145         -  set sql {SELECT * FROM abc;}
   146         -  set ::STMT [sqlite3_prepare $::DB $sql -1 TAIL]
   147         -  execsql {
   148         -    ATTACH 'test2.db' AS aux;
   149         -  }
   150         -  sqlite3_step $::STMT
   151         -} {SQLITE_DONE}
   152         -do_test schema-5.2 {
   153         -  sqlite3_reset $::STMT
   154         -} {SQLITE_OK}
   155         -do_test schema-5.3 {
   156         -  execsql {
   157         -    DETACH aux;
   158         -  }
   159         -  sqlite3_step $::STMT
   160         -} {SQLITE_ERROR}
   161         -do_test schema-5.4 {
   162         -  sqlite3_finalize $::STMT
   163         -} {SQLITE_SCHEMA}
          144  +ifcapable attach {
          145  +  do_test schema-5.1 {
          146  +    set sql {SELECT * FROM abc;}
          147  +    set ::STMT [sqlite3_prepare $::DB $sql -1 TAIL]
          148  +    execsql {
          149  +      ATTACH 'test2.db' AS aux;
          150  +    }
          151  +    sqlite3_step $::STMT
          152  +  } {SQLITE_DONE}
          153  +  do_test schema-5.2 {
          154  +    sqlite3_reset $::STMT
          155  +  } {SQLITE_OK}
          156  +  do_test schema-5.3 {
          157  +    execsql {
          158  +      DETACH aux;
          159  +    }
          160  +    sqlite3_step $::STMT
          161  +  } {SQLITE_ERROR}
          162  +  do_test schema-5.4 {
          163  +    sqlite3_finalize $::STMT
          164  +  } {SQLITE_SCHEMA}
          165  +}
   164    166   
   165    167   #---------------------------------------------------------------------
   166    168   # Tests 6.* check that prepared statements are invalidated when
   167    169   # a user-function is deleted (but not when one is added).
   168    170   do_test schema-6.1 {
   169    171     set sql {SELECT * FROM abc;}
   170    172     set ::STMT [sqlite3_prepare $::DB $sql -1 TAIL]

Changes to test/schema2.test.

    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file tests the various conditions under which an SQLITE_SCHEMA
    14     14   # error should be returned.  This is a copy of schema.test that
    15     15   # has been altered to use sqlite3_prepare_v2 instead of sqlite3_prepare
    16     16   #
    17         -# $Id: schema2.test,v 1.2 2007/05/02 17:54:56 drh Exp $
           17  +# $Id: schema2.test,v 1.3 2007/10/09 08:29:33 danielk1977 Exp $
    18     18   
    19     19   #---------------------------------------------------------------------
    20     20   # When any of the following types of SQL statements or actions are 
    21     21   # executed, all pre-compiled statements are invalidated. An attempt
    22     22   # to execute an invalidated statement always returns SQLITE_SCHEMA.
    23     23   #
    24     24   # CREATE/DROP TABLE...................................schema2-1.*
................................................................................
   138    138     sqlite3_finalize $::STMT
   139    139   } {SQLITE_OK}
   140    140   
   141    141   #---------------------------------------------------------------------
   142    142   # Tests 5.1 to 5.4 check that prepared statements are invalidated when
   143    143   # a database is DETACHed (but not when one is ATTACHed).
   144    144   #
   145         -do_test schema2-5.1 {
   146         -  set sql {SELECT * FROM abc;}
   147         -  set ::STMT [sqlite3_prepare_v2 $::DB $sql -1 TAIL]
   148         -  execsql {
   149         -    ATTACH 'test2.db' AS aux;
   150         -  }
   151         -  sqlite3_step $::STMT
   152         -} {SQLITE_DONE}
   153         -do_test schema2-5.2 {
   154         -  sqlite3_reset $::STMT
   155         -} {SQLITE_OK}
   156         -do_test schema2-5.3 {
   157         -  execsql {
   158         -    DETACH aux;
   159         -  }
   160         -  sqlite3_step $::STMT
   161         -} {SQLITE_DONE}
   162         -do_test schema2-5.4 {
   163         -  sqlite3_finalize $::STMT
   164         -} {SQLITE_OK}
          145  +ifcapable attach {
          146  +  do_test schema2-5.1 {
          147  +    set sql {SELECT * FROM abc;}
          148  +    set ::STMT [sqlite3_prepare_v2 $::DB $sql -1 TAIL]
          149  +    execsql {
          150  +      ATTACH 'test2.db' AS aux;
          151  +    }
          152  +    sqlite3_step $::STMT
          153  +  } {SQLITE_DONE}
          154  +  do_test schema2-5.2 {
          155  +    sqlite3_reset $::STMT
          156  +  } {SQLITE_OK}
          157  +  do_test schema2-5.3 {
          158  +    execsql {
          159  +      DETACH aux;
          160  +    }
          161  +    sqlite3_step $::STMT
          162  +  } {SQLITE_DONE}
          163  +  do_test schema2-5.4 {
          164  +    sqlite3_finalize $::STMT
          165  +  } {SQLITE_OK}
          166  +}
   165    167   
   166    168   #---------------------------------------------------------------------
   167    169   # Tests 6.* check that prepared statements are invalidated when
   168    170   # a user-function is deleted (but not when one is added).
   169    171   do_test schema2-6.1 {
   170    172     set sql {SELECT * FROM abc;}
   171    173     set ::STMT [sqlite3_prepare_v2 $::DB $sql -1 TAIL]

Changes to test/shared.test.

     5      5   #
     6      6   #    May you do good and not evil.
     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12         -# $Id: shared.test,v 1.27 2007/09/12 17:01:45 danielk1977 Exp $
           12  +# $Id: shared.test,v 1.28 2007/10/09 08:29:33 danielk1977 Exp $
    13     13   
    14     14   set testdir [file dirname $argv0]
    15     15   source $testdir/tester.tcl
    16     16   db close
    17     17   
    18         -ifcapable !shared_cache {
           18  +# These tests cannot be run without the ATTACH command.
           19  +#
           20  +ifcapable !shared_cache||!attach {
    19     21     finish_test
    20     22     return
    21     23   }
    22     24   
    23     25   set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
    24     26   
    25     27   foreach av [list 0 1] {

Changes to test/speed3.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library. The 
    12     12   # focus of this script is testing that the overflow-page related
    13     13   # enhancements added after version 3.3.17 speed things up.
    14     14   #
    15         -# $Id: speed3.test,v 1.4 2007/09/12 17:01:45 danielk1977 Exp $
           15  +# $Id: speed3.test,v 1.5 2007/10/09 08:29:33 danielk1977 Exp $
    16     16   #
    17     17   
    18     18   #---------------------------------------------------------------------
    19     19   # Test plan:
    20     20   #
    21     21   # If auto-vacuum is enabled for the database, the following cases
    22     22   # should show performance improvement with respect to 3.3.17.
................................................................................
    31     31   #     page and the overflow page containing the value do not have
    32     32   #     to be read (test cases speed3-2.X).
    33     33   #
    34     34   
    35     35   set testdir [file dirname $argv0]
    36     36   source $testdir/tester.tcl
    37     37   
    38         -ifcapable !tclvar {
           38  +ifcapable !tclvar||!attach {
    39     39     finish_test
    40     40     return
    41     41   }
    42     42   
    43     43   speed_trial_init speed1
    44     44   
    45     45   # Set a uniform random seed

Changes to test/sqllimits1.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   # This file contains tests to verify that the limits defined in
    13     13   # sqlite source file limits.h are enforced.
    14     14   #
    15         -# $Id: sqllimits1.test,v 1.18 2007/09/06 23:39:37 drh Exp $
           15  +# $Id: sqllimits1.test,v 1.19 2007/10/09 08:29:33 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   # Test organization:
    21     21   #
    22     22   #     sqllimits-1.*:  SQLITE_MAX_LENGTH
................................................................................
   436    436     }
   437    437     catchsql "SELECT myfunc([join $vals ,])"
   438    438   } {1 {too many arguments on function myfunc}}
   439    439   
   440    440   #--------------------------------------------------------------------
   441    441   # Test cases sqllimits-8.*: Test the SQLITE_MAX_ATTACHED limit.
   442    442   #
   443         -# TODO
   444         -do_test sqllimits-1.8.1 {
   445         -  set max $::SQLITE_MAX_ATTACHED
   446         -  for {set i 0} {$i < ($max)} {incr i} {
   447         -    file delete -force test${i}.db test${i}.db-journal
   448         -  }
   449         -  for {set i 0} {$i < ($max)} {incr i} {
   450         -    execsql "ATTACH 'test${i}.db' AS aux${i}"
   451         -  }
   452         -  catchsql "ATTACH 'test${i}.db' AS aux${i}"
   453         -} "1 {too many attached databases - max $::SQLITE_MAX_ATTACHED}"
   454         -do_test sqllimits-1.8.2 {
   455         -  set max $::SQLITE_MAX_ATTACHED
   456         -  for {set i 0} {$i < ($max)} {incr i} {
   457         -    execsql "DETACH aux${i}"
   458         -  }
   459         -} {}
          443  +ifcapable attach {
          444  +  do_test sqllimits-1.8.1 {
          445  +    set max $::SQLITE_MAX_ATTACHED
          446  +    for {set i 0} {$i < ($max)} {incr i} {
          447  +      file delete -force test${i}.db test${i}.db-journal
          448  +    }
          449  +    for {set i 0} {$i < ($max)} {incr i} {
          450  +      execsql "ATTACH 'test${i}.db' AS aux${i}"
          451  +    }
          452  +    catchsql "ATTACH 'test${i}.db' AS aux${i}"
          453  +  } "1 {too many attached databases - max $::SQLITE_MAX_ATTACHED}"
          454  +  do_test sqllimits-1.8.2 {
          455  +    set max $::SQLITE_MAX_ATTACHED
          456  +    for {set i 0} {$i < ($max)} {incr i} {
          457  +      execsql "DETACH aux${i}"
          458  +    }
          459  +  } {}
          460  +}
   460    461   
   461    462   #--------------------------------------------------------------------
   462    463   # Test cases sqllimits-9.*: Check that the SQLITE_MAX_VARIABLE_NUMBER 
   463    464   # limit works.
   464    465   #
   465    466   do_test sqllimits-1.9.1 {
   466    467     set max $::SQLITE_MAX_VARIABLE_NUMBER

Changes to test/sync.test.

     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file implements tests to verify that fsync is disabled when
    14     14   # pragma synchronous=off even for multi-database commits.
    15     15   #
    16         -# $Id: sync.test,v 1.5 2006/02/11 01:25:51 drh Exp $
           16  +# $Id: sync.test,v 1.6 2007/10/09 08:29:33 danielk1977 Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
    21     21   #
    22     22   # These tests are only applicable on unix when pager pragma are
    23         -# enabled.
           23  +# enabled. Also, since every test uses an ATTACHed database, they
           24  +# are only run when ATTACH is enabled.
    24     25   #
    25     26   if {$::tcl_platform(platform)!="unix"} {
    26     27     finish_test
    27     28     return
    28     29   }
    29         -ifcapable !pager_pragmas {
           30  +ifcapable !pager_pragmas||!attach {
    30     31     finish_test
    31     32     return
    32     33   }
    33     34   
    34     35   do_test sync-1.1 {
    35     36     set sqlite_sync_count 0
    36     37     file delete -force test2.db

Changes to test/table.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing the CREATE TABLE statement.
    13     13   #
    14         -# $Id: table.test,v 1.47 2007/05/02 17:54:56 drh Exp $
           14  +# $Id: table.test,v 1.48 2007/10/09 08:29:33 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Create a basic table and verify it is added to sqlite_master
    20     20   #
    21     21   do_test table-1.1 {
................................................................................
   608    608         }
   609    609       } msg
   610    610     ]
   611    611     set result [list $rc $msg]
   612    612   } {0 {}}
   613    613   
   614    614   # Try to drop a table from within a callback:
   615         -do_test table-14.3 {
          615  +do_test table-14.2 {
   616    616     set rc [
   617    617       catch {
   618    618         db eval {SELECT * FROM tablet8 LIMIT 1} {} {
   619    619           db eval {DROP TABLE t9;}
   620    620         }
   621    621       } msg
   622    622     ] 
   623    623     set result [list $rc $msg]
   624    624   } {1 {database table is locked}}
   625    625   
   626         -# Now attach a database and ensure that a table can be created in the 
   627         -# attached database whilst in a callback from a query on the main database.
   628         -do_test table-14.4 {
   629         -  file delete -force test2.db
   630         -  file delete -force test2.db-journal
   631         -  execsql {
   632         -    attach 'test2.db' as aux;
   633         -  }
   634         -  db eval {SELECT * FROM tablet8 LIMIT 1} {} {
   635         -    db eval {CREATE TABLE aux.t1(a, b, c)}
   636         -  }
   637         -} {}
   638         -
   639         -# On the other hand, it should be impossible to drop a table when any VMs 
   640         -# are active. This is because VerifyCookie instructions may have already
   641         -# been executed, and btree root-pages may not move after this (which a
   642         -# delete table might do).
   643         -do_test table-14.4 {
   644         -  set rc [
   645         -    catch {
   646         -      db eval {SELECT * FROM tablet8 LIMIT 1} {} {
   647         -        db eval {DROP TABLE aux.t1;}
   648         -      }
   649         -    } msg
   650         -  ] 
   651         -  set result [list $rc $msg]
   652         -} {1 {database table is locked}}
          626  +ifcapable attach {
          627  +  # Now attach a database and ensure that a table can be created in the 
          628  +  # attached database whilst in a callback from a query on the main database.
          629  +  do_test table-14.3 {
          630  +    file delete -force test2.db
          631  +    file delete -force test2.db-journal
          632  +    execsql {
          633  +      ATTACH 'test2.db' as aux;
          634  +    }
          635  +    db eval {SELECT * FROM tablet8 LIMIT 1} {} {
          636  +      db eval {CREATE TABLE aux.t1(a, b, c)}
          637  +    }
          638  +  } {}
          639  +  
          640  +  # On the other hand, it should be impossible to drop a table when any VMs 
          641  +  # are active. This is because VerifyCookie instructions may have already
          642  +  # been executed, and btree root-pages may not move after this (which a
          643  +  # delete table might do).
          644  +  do_test table-14.4 {
          645  +    set rc [
          646  +      catch {
          647  +        db eval {SELECT * FROM tablet8 LIMIT 1} {} {
          648  +          db eval {DROP TABLE aux.t1;}
          649  +        }
          650  +      } msg
          651  +    ] 
          652  +    set result [list $rc $msg]
          653  +  } {1 {database table is locked}}
          654  +}
   653    655   
   654    656   # Create and drop 2000 tables. This is to check that the balance_shallow()
   655    657   # routine works correctly on the sqlite_master table. At one point it
   656    658   # contained a bug that would prevent the right-child pointer of the
   657    659   # child page from being copied to the root page.
   658    660   #
   659    661   do_test table-15.1 {

Changes to test/temptable.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file implements tests for temporary tables and indices.
    14     14   #
    15         -# $Id: temptable.test,v 1.18 2007/10/05 15:53:29 danielk1977 Exp $
           15  +# $Id: temptable.test,v 1.19 2007/10/09 08:29:33 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   ifcapable !tempdb {
    21     21     finish_test
    22     22     return
................................................................................
   400    400     sqlite3 db test.db
   401    401     catchsql {
   402    402       SELECT * FROM t8,t9;
   403    403     }
   404    404   } {1 {no such table: t9}}
   405    405   
   406    406   file delete -force test2.db test2.db-journal
   407         -do_test temptable-7.1 {
   408         -  catchsql {
   409         -    ATTACH 'test2.db' AS two;
   410         -    CREATE TEMP TABLE two.abc(x,y);
   411         -  }
   412         -} {1 {temporary table name must be unqualified}}
          407  +ifcapable attach {
          408  +  do_test temptable-7.1 {
          409  +    catchsql {
          410  +      ATTACH 'test2.db' AS two;
          411  +      CREATE TEMP TABLE two.abc(x,y);
          412  +    }
          413  +  } {1 {temporary table name must be unqualified}}
          414  +}
   413    415   
   414    416   # Need to do the following for tcl 8.5 on mac. On that configuration, the
   415    417   # -readonly flag is taken so seriously that a subsequent [file delete -force]
   416    418   # (required before the next test file can be executed) will fail.
   417    419   #
   418    420   catch {file attributes test.db -readonly 0}
   419    421   
   420    422   finish_test

Changes to test/thread002.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   #
    12     12   #   This test attempts to deadlock SQLite in shared-cache mode.
    13     13   #     
    14     14   #
    15         -# $Id: thread002.test,v 1.1 2007/09/10 10:53:02 danielk1977 Exp $
           15  +# $Id: thread002.test,v 1.2 2007/10/09 08:29:33 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   
    19     19   source $testdir/tester.tcl
    20     20   source $testdir/thread_common.tcl
    21     21   if {[info commands sqlthread] eq ""} {
           22  +  finish_test
           23  +  return
           24  +}
           25  +ifcapable !attach { 
           26  +  finish_test
    22     27     return
    23     28   }
    24     29   
    25     30   db close
    26     31   sqlite3_enable_shared_cache 1
    27     32   
    28     33   set ::NTHREAD 10

Changes to test/tkt1873.test.

    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13     13   # This file implements tests to verify that ticket #1873 has been
    14     14   # fixed.  
    15     15   #
    16     16   #
    17         -# $Id: tkt1873.test,v 1.1 2006/06/27 16:34:58 danielk1977 Exp $
           17  +# $Id: tkt1873.test,v 1.2 2007/10/09 08:29:33 danielk1977 Exp $
    18     18   
    19     19   set testdir [file dirname $argv0]
    20     20   source $testdir/tester.tcl
           21  +
           22  +ifcapable !attach {
           23  +  finish_test
           24  +  return
           25  +}
    21     26   
    22     27   file delete -force test2.db test2.db-journal
    23     28   
    24     29   do_test tkt1873-1.1 {
    25     30     execsql {
    26     31       CREATE TABLE t1(x, y);
    27     32       ATTACH 'test2.db' AS aux;

Changes to test/trigger1.test.

   528    528   # Ticket #764. At one stage TEMP triggers would fail to re-install when the
   529    529   # schema was reloaded. The following tests ensure that TEMP triggers are
   530    530   # correctly re-installed.
   531    531   #
   532    532   # Also verify that references within trigger programs are resolved at
   533    533   # statement compile time, not trigger installation time. This means, for
   534    534   # example, that you can drop and re-create tables referenced by triggers. 
   535         -ifcapable tempdb {
          535  +ifcapable tempdb&&attach {
   536    536     do_test trigger1-10.0 {
   537    537       file delete -force test2.db
   538    538       file delete -force test2.db-journal
   539    539       execsql {
   540    540         ATTACH 'test2.db' AS aux;
   541    541       }
   542    542     } {}

Changes to test/view.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing VIEW statements.
    13     13   #
    14         -# $Id: view.test,v 1.33 2006/09/11 23:45:50 drh Exp $
           14  +# $Id: view.test,v 1.34 2007/10/09 08:29:33 danielk1977 Exp $
    15     15   set testdir [file dirname $argv0]
    16     16   source $testdir/tester.tcl
    17     17   
    18     18   # Omit this entire file if the library is not configured with views enabled.
    19     19   ifcapable !view {
    20     20     finish_test
    21     21     return
................................................................................
   446    446   #
   447    447   do_test view-12.1 {
   448    448     catchsql {
   449    449       CREATE VIEW v12 AS SELECT a FROM t1 WHERE b=?
   450    450     }
   451    451   } {1 {parameters are not allowed in views}}
   452    452   
   453         -do_test view-13.1 {
   454         -  file delete -force test2.db
   455         -  catchsql {
   456         -    ATTACH 'test2.db' AS two;
   457         -    CREATE TABLE two.t2(x,y);
   458         -    CREATE VIEW v13 AS SELECT y FROM two.t2;
   459         -  }
   460         -} {1 {view v13 cannot reference objects in database two}}
          453  +ifcapable attach {
          454  +  do_test view-13.1 {
          455  +    file delete -force test2.db
          456  +    catchsql {
          457  +      ATTACH 'test2.db' AS two;
          458  +      CREATE TABLE two.t2(x,y);
          459  +      CREATE VIEW v13 AS SELECT y FROM two.t2;
          460  +    }
          461  +  } {1 {view v13 cannot reference objects in database two}}
          462  +}
   461    463   
   462    464   # Ticket #1658
   463    465   #
   464    466   do_test view-14.1 {
   465    467     catchsql {
   466    468       CREATE TEMP VIEW t1 AS SELECT a,b FROM t1;
   467    469       SELECT * FROM temp.t1;

Changes to test/vtab1.test.

     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is creating and dropping virtual tables.
    13     13   #
    14         -# $Id: vtab1.test,v 1.46 2007/09/03 15:03:21 danielk1977 Exp $
           14  +# $Id: vtab1.test,v 1.47 2007/10/09 08:29:33 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   ifcapable !vtab||!schema_pragmas {
    20     20     finish_test
    21     21     return
................................................................................
   758    758   } {31429}
   759    759   do_test vtab1.7-13 {
   760    760     execsql {
   761    761       SELECT rowid, a, b, c FROM real_abc
   762    762     }
   763    763   } {}
   764    764   
   765         -do_test vtab1.8-1 {
   766         -  set echo_module ""
   767         -  execsql {
   768         -    ATTACH 'test2.db' AS aux;
   769         -    CREATE VIRTUAL TABLE aux.e2 USING echo(real_abc);
   770         -  }
   771         -  set echo_module
   772         -} [list xCreate echo aux e2 real_abc   \
   773         -        xSync   echo(real_abc)         \
   774         -        xCommit echo(real_abc)         \
   775         -]
          765  +ifcapable attach {
          766  +  do_test vtab1.8-1 {
          767  +    set echo_module ""
          768  +    execsql {
          769  +      ATTACH 'test2.db' AS aux;
          770  +      CREATE VIRTUAL TABLE aux.e2 USING echo(real_abc);
          771  +    }
          772  +    set echo_module
          773  +  } [list xCreate echo aux e2 real_abc   \
          774  +          xSync   echo(real_abc)         \
          775  +          xCommit echo(real_abc)         \
          776  +  ]
          777  +}
   776    778   do_test vtab1.8-2 {
   777         -  execsql {
          779  +  catchsql {
   778    780       DROP TABLE aux.e2;
          781  +  }
          782  +  execsql {
   779    783       DROP TABLE treal;
   780    784       DROP TABLE techo;
   781    785       DROP TABLE echo_abc;
   782    786       DROP TABLE real_abc;
   783    787     }
   784    788   } {}
   785    789   

Changes to test/vtab7.test.

     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library. The focus
    12     12   # of this test is reading and writing to the database from within a
    13     13   # virtual table xSync() callback.
    14     14   #
    15         -# $Id: vtab7.test,v 1.2 2006/07/26 16:22:16 danielk1977 Exp $
           15  +# $Id: vtab7.test,v 1.3 2007/10/09 08:29:33 danielk1977 Exp $
    16     16   
    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   
    20     20   ifcapable !vtab {
    21     21     finish_test
    22     22     return
................................................................................
   121    121     execsql {
   122    122       INSERT INTO abc2 VALUES(1, 2, 3);
   123    123       SELECT name FROM sqlite_master ORDER BY name;
   124    124     }
   125    125   } {abc abc2 log}
   126    126   
   127    127   # Write to an attached database from xSync().
   128         -do_test vtab7-3.1 {
   129         -  file delete -force test2.db
   130         -  file delete -force test2.db-journal
   131         -  execsql {
   132         -    ATTACH 'test2.db' AS db2;
   133         -    CREATE TABLE db2.stuff(description, shape, color);
   134         -  }
   135         -  set ::callbacks(xSync,abc) {
   136         -    execsql { INSERT INTO db2.stuff VALUES('abc', 'square', 'green'); }
   137         -  }
   138         -  execsql {
   139         -    INSERT INTO abc2 VALUES(1, 2, 3);
   140         -    SELECT * from stuff;
   141         -  }
   142         -} {abc square green}
          128  +ifcapable attach {
          129  +  do_test vtab7-3.1 {
          130  +    file delete -force test2.db
          131  +    file delete -force test2.db-journal
          132  +    execsql {
          133  +      ATTACH 'test2.db' AS db2;
          134  +      CREATE TABLE db2.stuff(description, shape, color);
          135  +    }
          136  +    set ::callbacks(xSync,abc) {
          137  +      execsql { INSERT INTO db2.stuff VALUES('abc', 'square', 'green'); }
          138  +    }
          139  +    execsql {
          140  +      INSERT INTO abc2 VALUES(1, 2, 3);
          141  +      SELECT * from stuff;
          142  +    }
          143  +  } {abc square green}
          144  +}
   143    145   
   144    146   # UPDATE: The next test passes, but leaks memory. So leave it out.
   145    147   #
   146    148   # The following tests test that writing to the database from within
   147    149   # the xCommit callback causes a misuse error.
   148    150   # do_test vtab7-4.1 {
   149    151   #   unset -nocomplain ::callbacks(xSync,abc)