/ Check-in [3ac4a212]
Login

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

Overview
Comment:Minor changes to help build and test SSE. (CVS 2487)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3ac4a212bd70abb94d24830c73f7121df51125c7
User & Date: danielk1977 2005-05-27 09:41:13
Context
2005-05-29
14:23
Omit a couple of test cases if the library is compiled without subqueries. (CVS 2488) check-in: 6bc37297 user: danielk1977 tags: trunk
2005-05-27
09:41
Minor changes to help build and test SSE. (CVS 2487) check-in: 3ac4a212 user: danielk1977 tags: trunk
2005-05-26
16:23
Add an experimental sqlite3_get_autocommit() API used to test whether or not changes are committed automatically. (CVS 2486) check-in: 4a7f1275 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test1.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Code for testing the printf() interface to SQLite.  This code
    13     13   ** is not included in the SQLite library.  It is used for automated
    14     14   ** testing of the SQLite library.
    15     15   **
    16         -** $Id: test1.c,v 1.139 2005/05/26 16:23:34 drh Exp $
           16  +** $Id: test1.c,v 1.140 2005/05/27 09:41:13 danielk1977 Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "tcl.h"
    20     20   #include "os.h"
    21     21   #include <stdlib.h>
    22     22   #include <string.h>
    23     23   
................................................................................
  2403   2403     if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
  2404   2404     if( Tcl_GetIntFromObj(interp, objv[2], &col) ) return TCL_ERROR;
  2405   2405   
  2406   2406     Tcl_SetObjResult(interp, Tcl_NewIntObj(xFunc(pStmt, col)));
  2407   2407     return TCL_OK;
  2408   2408   }
  2409   2409   
         2410  +#ifndef SQLITE_OMIT_DISKIO
  2410   2411   /*
  2411   2412   ** Usage:  sqlite3OsOpenReadWrite <filename>
  2412   2413   */
  2413   2414   static int test_sqlite3OsOpenReadWrite(
  2414   2415     void * clientData,
  2415   2416     Tcl_Interp *interp,
  2416   2417     int objc,
................................................................................
  2562   2563     if( rc!=SQLITE_OK ){
  2563   2564       Tcl_SetResult(interp, (char *)errorName(rc), TCL_STATIC);
  2564   2565       return TCL_ERROR;
  2565   2566     }
  2566   2567     Tcl_AppendResult(interp, zFile, 0);
  2567   2568     return TCL_OK;
  2568   2569   }
         2570  +#endif
  2569   2571   
  2570   2572   /*
  2571   2573   ** Usage:  sqlite_set_magic  DB  MAGIC-NUMBER
  2572   2574   **
  2573   2575   ** Set the db->magic value.  This is used to test error recovery logic.
  2574   2576   */
  2575   2577   static int sqlite_set_magic(
................................................................................
  3045   3047        { "sqlite3_column_text16",     test_stmt_utf16, sqlite3_column_text16    },
  3046   3048        { "sqlite3_column_decltype16", test_stmt_utf16, sqlite3_column_decltype16},
  3047   3049        { "sqlite3_column_name16",     test_stmt_utf16, sqlite3_column_name16    },
  3048   3050   #endif
  3049   3051        { "sqlite3_global_recover",    test_global_recover, 0   },
  3050   3052   
  3051   3053        /* Functions from os.h */
         3054  +#ifndef SQLITE_OMIT_DISKIO
  3052   3055        { "sqlite3OsOpenReadWrite",test_sqlite3OsOpenReadWrite, 0 },
  3053   3056        { "sqlite3OsClose",        test_sqlite3OsClose, 0 },
  3054   3057        { "sqlite3OsLock",         test_sqlite3OsLock, 0 },
  3055   3058        { "sqlite3OsTempFileName", test_sqlite3OsTempFileName, 0 },
  3056   3059      
  3057   3060        /* Custom test interfaces */
  3058   3061        { "sqlite3OsUnlock",         test_sqlite3OsUnlock, 0    },
         3062  +#endif
  3059   3063   #ifndef SQLITE_OMIT_UTF16
  3060   3064        { "add_test_collate",        test_collate, 0            },
  3061   3065        { "add_test_collate_needed", test_collate_needed, 0     },
  3062   3066        { "add_test_function",       test_function, 0           },
  3063   3067   #endif
  3064   3068        { "sqlite3_crashparams",     sqlite3_crashparams, 0     },
  3065   3069        { "sqlite3_test_errstr",     test_errstr, 0             },

Changes to src/test2.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Code for testing the pager.c module in SQLite.  This code
    13     13   ** is not included in the SQLite library.  It is used for automated
    14     14   ** testing of the SQLite library.
    15     15   **
    16         -** $Id: test2.c,v 1.29 2005/02/06 02:45:43 drh Exp $
           16  +** $Id: test2.c,v 1.30 2005/05/27 09:41:13 danielk1977 Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   #include "os.h"
    20     20   #include "pager.h"
    21     21   #include "tcl.h"
    22     22   #include <stdlib.h>
    23     23   #include <string.h>
................................................................................
   504    504       return TCL_ERROR;
   505    505     }
   506    506     strncpy((char*)pPage, argv[2], test_pagesize-1);
   507    507     ((char*)pPage)[test_pagesize-1] = 0;
   508    508     return TCL_OK;
   509    509   }
   510    510   
          511  +#ifndef SQLITE_OMIT_DISKIO
   511    512   /*
   512    513   ** Usage:   fake_big_file  N  FILENAME
   513    514   **
   514    515   ** Write a few bytes at the N megabyte point of FILENAME.  This will
   515    516   ** create a large file.  If the file was a valid SQLite database, then
   516    517   ** the next time the database is opened, SQLite will begin allocating
   517    518   ** new pages after N.  If N is 2096 or bigger, this will test the
................................................................................
   551    552     sqlite3OsClose(&fd);
   552    553     if( rc ){
   553    554       Tcl_AppendResult(interp, "write failed: ", errorName(rc), 0);
   554    555       return TCL_ERROR;
   555    556     }
   556    557     return TCL_OK;
   557    558   }
          559  +#endif
   558    560   
   559    561   /*
   560    562   ** Register commands with the TCL interpreter.
   561    563   */
   562    564   int Sqlitetest2_Init(Tcl_Interp *interp){
   563    565     extern int sqlite3_io_error_pending;
   564    566     extern int sqlite3_diskfull_pending;
................................................................................
   578    580       { "page_get",                (Tcl_CmdProc*)page_get            },
   579    581       { "page_lookup",             (Tcl_CmdProc*)page_lookup         },
   580    582       { "page_unref",              (Tcl_CmdProc*)page_unref          },
   581    583       { "page_read",               (Tcl_CmdProc*)page_read           },
   582    584       { "page_write",              (Tcl_CmdProc*)page_write          },
   583    585       { "page_number",             (Tcl_CmdProc*)page_number         },
   584    586       { "pager_truncate",          (Tcl_CmdProc*)pager_truncate      },
          587  +#ifndef SQLITE_OMIT_DISKIO
   585    588       { "fake_big_file",           (Tcl_CmdProc*)fake_big_file       },
          589  +#endif
   586    590     };
   587    591     int i;
   588    592     for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){
   589    593       Tcl_CreateCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0);
   590    594     }
   591    595     Tcl_LinkVar(interp, "sqlite_io_error_pending",
   592    596        (char*)&sqlite3_io_error_pending, TCL_LINK_INT);
   593    597     Tcl_LinkVar(interp, "sqlite_diskfull_pending",
   594    598        (char*)&sqlite3_diskfull_pending, TCL_LINK_INT);
   595    599     Tcl_LinkVar(interp, "pager_pagesize",
   596    600        (char*)&test_pagesize, TCL_LINK_INT);
   597    601     return TCL_OK;
   598    602   }

Changes to src/vdbeaux.c.

  1106   1106       }
  1107   1107     }
  1108   1108   
  1109   1109     /* The complex case - There is a multi-file write-transaction active.
  1110   1110     ** This requires a master journal file to ensure the transaction is
  1111   1111     ** committed atomicly.
  1112   1112     */
         1113  +#ifndef SQLITE_OMIT_DISKIO
  1113   1114     else{
  1114   1115       char *zMaster = 0;   /* File-name for the master journal */
  1115   1116       char const *zMainFile = sqlite3BtreeGetFilename(db->aDb[0].pBt);
  1116   1117       OsFile master;
  1117   1118   
  1118   1119       /* Select a master journal file name */
  1119   1120       do {
................................................................................
  1222   1223       for(i=0; i<db->nDb; i++){ 
  1223   1224         Btree *pBt = db->aDb[i].pBt;
  1224   1225         if( pBt ){
  1225   1226           sqlite3BtreeCommit(pBt);
  1226   1227         }
  1227   1228       }
  1228   1229     }
         1230  +#endif
  1229   1231   
  1230   1232     return rc;
  1231   1233   }
  1232   1234   
  1233   1235   /*
  1234   1236   ** Find every active VM other than pVdbe and change its status to
  1235   1237   ** aborted.  This happens when one VM causes a rollback due to an

Changes to test/delete.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 DELETE FROM statement.
    13     13   #
    14         -# $Id: delete.test,v 1.18 2004/11/04 04:42:28 drh Exp $
           14  +# $Id: delete.test,v 1.19 2005/05/27 09:41:13 danielk1977 Exp $
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   
    19     19   # Try to delete from a non-existant table.
    20     20   #
    21     21   do_test delete-1.1 {
................................................................................
   270    270       INSERT INTO t3 VALUES(123);
   271    271       SELECT * FROM t3;
   272    272     }
   273    273   } {123}
   274    274   db close
   275    275   catch {file attributes test.db -permissions 0444}
   276    276   catch {file attributes test.db -readonly 1}
   277         -sqlite3 db test.db
          277  +set ::DB [sqlite3 db test.db]
   278    278   do_test delete-8.1 {
   279    279     catchsql {
   280    280       DELETE FROM t3;
   281    281     }
   282    282   } {1 {attempt to write a readonly database}}
   283    283   do_test delete-8.2 {
   284    284     execsql {SELECT * FROM t3}