/ Check-in [e48b9f24]
Login

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

Overview
Comment:Open windows files in binary mode. (CVS 193)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:e48b9f24faeee606aa2bda1666016d8a00b430a7
User & Date: drh 2001-03-20 12:55:13
Context
2001-03-20
12:55
Open windows files in binary mode. (CVS 1717) check-in: 3adf884b user: drh tags: trunk
12:55
Open windows files in binary mode. (CVS 193) check-in: e48b9f24 user: drh tags: trunk
2001-03-15
18:30
Version 1.0.25 (CVS 478) check-in: 7564b223 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to VERSION.

     1         -1.0.25
            1  +1.0.26

Changes to doc/report1.txt.

     1         -The SQL database used for ACD contains 113 tables and indices implemented
            1  +The SQL database used for ACD contains 105 tables and indices implemented
     2      2   in GDBM.  The following are statistics on the sizes of keys and data
     3      3   within these tables and indices.
     4      4   
     5         -Entries:      962080
     6         -Size:         45573853
            5  +Entries:      967089
            6  +Size:         45896104
     7      7   Avg Size:     48
     8         -Key Size:     11045299
            8  +Key Size:     11112265
     9      9   Avg Key Size: 12
    10     10   Max Key Size: 99
    11     11   
    12         -    0..8            266    0%
    13         -    9..12          5485    0%
    14         -   13..16         73633    8%
    15         -   17..24        180918   27%
    16         -   25..32        209823   48%
    17         -   33..40        148995   64%
    18         -   41..48         76304   72%
    19         -   49..56         14346   73%
    20         -   57..64         15725   75%
    21         -   65..80         44916   80%
    22         -   81..96        127815   93%
    23         -   97..112        34769   96%
    24         -  113..128        13314   98%
    25         -  129..144         8098   99%
    26         -  145..160         3355   99%
    27         -  161..176         1159   99%
    28         -  177..192          629   99%
    29         -  193..208          221   99%
    30         -  209..224          210   99%
    31         -  225..240          129   99%
    32         -  241..256           57   99%
    33         -  257..288          496   99%
    34         -  289..320           60   99%
    35         -  321..352           37   99%
    36         -  353..384           46   99%
    37         -  385..416           22   99%
           12  +    0..8            263    0%
           13  +    9..12          5560    0%
           14  +   13..16         71394    7%
           15  +   17..24        180717   26%
           16  +   25..32        215442   48%
           17  +   33..40        151118   64%
           18  +   41..48         77479   72%
           19  +   49..56         13983   74%
           20  +   57..64         14481   75%
           21  +   65..80         41342   79%
           22  +   81..96        127098   92%
           23  +   97..112        38054   96%
           24  +  113..128        14197   98%
           25  +  129..144         8208   99%
           26  +  145..160         3326   99%
           27  +  161..176         1242   99%
           28  +  177..192          604   99%
           29  +  193..208          222   99%
           30  +  209..224          213   99%
           31  +  225..240          132   99%
           32  +  241..256           58   99%
           33  +  257..288          515   99%
           34  +  289..320           64   99%
           35  +  321..352           39   99%
           36  +  353..384           44   99%
           37  +  385..416           25   99%
    38     38     417..448           24   99%
    39     39     449..480           26   99%
    40     40     481..512           27   99%
    41         -  513..1024         471   99%
    42         - 1025..2048         389   99%
    43         - 2049..4096         182   99%
    44         - 4097..8192          74   99%
    45         - 8193..16384         34   99%
           41  +  513..1024         470   99%
           42  + 1025..2048         396   99%
           43  + 2049..4096         187   99%
           44  + 4097..8192          78   99%
           45  + 8193..16384         35   99%
           46  +16385..32768         17   99%
           47  +32769..65536          6   99%
           48  +65537..65541          3  100%
           49  +
           50  +If the indices are omitted, the statistics for the 49 tables
           51  +become the following:
           52  +
           53  +Entries:      451103
           54  +Size:         30930282
           55  +Avg Size:     69
           56  +Key Size:     1804412
           57  +Avg Key Size: 4
           58  +Max Key Size: 4
           59  +
           60  +    0..24            89    0%
           61  +   25..32          9417    2%
           62  +   33..40        119162   28%
           63  +   41..48         68710   43%
           64  +   49..56          9539   45%
           65  +   57..64         12435   48%
           66  +   65..80         38650   57%
           67  +   81..96        126877   85%
           68  +   97..112        38030   93%
           69  +  113..128        14183   96%
           70  +  129..144         7668   98%
           71  +  145..160         3302   99%
           72  +  161..176         1238   99%
           73  +  177..192          597   99%
           74  +  193..208          217   99%
           75  +  209..224          211   99%
           76  +  225..240          130   99%
           77  +  241..256           57   99%
           78  +  257..288          100   99%
           79  +  289..320           62   99%
           80  +  321..352           34   99%
           81  +  353..384           43   99%
           82  +  385..416           24   99%
           83  +  417..448           24   99%
           84  +  449..480           25   99%
           85  +  481..512           27   99%
           86  +  513..1024         153   99%
           87  + 1025..2048          92   99%
           88  + 2049..4096           7  100%
           89  +
           90  +The 56 indices have these statistics:
           91  +
           92  +Entries:      512422
           93  +Size:         14879828
           94  +Avg Size:     30
           95  +Key Size:     9253204
           96  +Avg Key Size: 19
           97  +Max Key Size: 99
           98  +
           99  +    0..8            246    0%
          100  +    9..12          5486    1%
          101  +   13..16         70717   14%
          102  +   17..24        178246   49%
          103  +   25..32        205722   89%
          104  +   33..40         31951   96%
          105  +   41..48          8768   97%
          106  +   49..56          4444   98%
          107  +   57..64          2046   99%
          108  +   65..80          2691   99%
          109  +   81..96           202   99%
          110  +   97..112           11   99%
          111  +  113..144          527   99%
          112  +  145..160           20   99%
          113  +  161..288          406   99%
          114  +  289..1024         316   99%
          115  + 1025..2048         304   99%
          116  + 2049..4096         180   99%
          117  + 4097..8192          78   99%
          118  + 8193..16384         35   99%
    46    119   16385..32768         17   99%
    47         -32769..65536          5   99%
    48         -65537..131073         3  100%
          120  +32769..65536          6   99%
          121  +65537..65541          3  100%

Changes to src/dbbe.c.

    26     26   ** sqlite and the code that does the actually reading and writing
    27     27   ** of information to the disk.
    28     28   **
    29     29   ** This file uses GDBM as the database backend.  It should be
    30     30   ** relatively simple to convert to a different database such
    31     31   ** as NDBM, SDBM, or BerkeleyDB.
    32     32   **
    33         -** $Id: dbbe.c,v 1.23 2001/01/15 22:51:10 drh Exp $
           33  +** $Id: dbbe.c,v 1.24 2001/03/20 12:55:14 drh Exp $
    34     34   */
    35     35   #include "sqliteInt.h"
    36     36   #include <unistd.h>
    37     37   
    38     38   /*
    39     39   ** This routine opens a new database.  It looks at the first
    40     40   ** few characters of the database name to try to determine what
................................................................................
    94     94     zFile = 0;
    95     95     do{
    96     96       sqliteRandomName(zBuf, "/_temp_file_");
    97     97       sqliteFree(zFile);
    98     98       zFile = 0;
    99     99       sqliteSetString(&zFile, zDir, zBuf, 0);
   100    100     }while( access(zFile,0)==0 && limit-- >= 0 );
          101  +#if OS_WIN
          102  +  *ppFile = pBe->apTemp[i] = fopen(zFile, "w+b");
          103  +#else
   101    104     *ppFile = pBe->apTemp[i] = fopen(zFile, "w+");
          105  +#endif
   102    106     if( pBe->apTemp[i]==0 ){
   103    107       rc = SQLITE_ERROR;
   104    108       sqliteFree(zFile);
   105    109       pBe->azTemp[i] = 0;
   106    110     }else{
   107    111       pBe->azTemp[i] = zFile;
   108    112     }

Changes to src/dbbemem.c.

    24     24   ** This file contains code to implement the database backend (DBBE)
    25     25   ** for sqlite.  The database backend is the interface between
    26     26   ** sqlite and the code that does the actually reading and writing
    27     27   ** of information to the disk.
    28     28   **
    29     29   ** This file uses an in-memory hash table as the database backend. 
    30     30   **
    31         -** $Id: dbbemem.c,v 1.8 2001/02/19 23:48:17 drh Exp $
           31  +** $Id: dbbemem.c,v 1.9 2001/03/20 12:55:14 drh Exp $
    32     32   */
    33     33   #include "sqliteInt.h"
    34     34   #include <sys/stat.h>
    35     35   #include <unistd.h>
    36     36   #include <ctype.h>
    37     37   #include <time.h>
    38     38   
................................................................................
   717    717   }
   718    718   
   719    719   /*
   720    720   ** Open a temporary file.  The file is located in the current working
   721    721   ** directory.
   722    722   */
   723    723   static int sqliteMemOpenTempFile(Dbbe *pDbbe, FILE **ppFile){
          724  +#if OS_UNIX
   724    725     const char *zTemps[] = { "/usr/tmp", "/var/tmp", "/tmp", "/temp", 0};
          726  +#endif
          727  +#if OS_WIN
          728  +  const char *zTemps[] = { "c:/temp", "c:", 0};
          729  +#endif
   725    730     const char *zDir;
   726    731     int i;
   727    732     struct stat statbuf;
   728    733     for(i=0; zTemps[i]; i++){
   729    734       zDir = zTemps[i];
   730    735       if( stat(zDir, &statbuf)==0 && S_ISDIR(statbuf.st_mode) 
   731    736         && access(zDir, W_OK|X_OK)==0 ){

Changes to test/dbbe.test.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements regression tests for SQLite library.  The
    24     24   # focus of this file is exercising the code in dbbe.c.
    25     25   #
    26         -# $Id: dbbe.test,v 1.5 2001/01/31 13:28:09 drh Exp $
           26  +# $Id: dbbe.test,v 1.6 2001/03/20 12:55:14 drh Exp $
    27     27   
    28     28   set testdir [file dirname $argv0]
    29     29   source $testdir/tester.tcl
    30     30   
    31     31   # Try to open a database that does not exist.
    32     32   #
    33     33   do_test dbbe-1.1 {
................................................................................
    61     61     forcedelete testdb
    62     62     set fd [open testdb w]
    63     63     puts $fd hi!
    64     64     close $fd
    65     65     set v [catch {sqlite db testdb 0666} msg]
    66     66     lappend v $msg
    67     67   } {1 {not a directory: "testdb"}}
           68  +
           69  +if {$::tcl_platform(platform)!="windows"} {
    68     70   
    69     71   # Access permission denied on the directory.
    70     72   #
    71     73   do_test dbbe-1.5 {
    72     74     catch {db close}
    73     75     forcedelete testdb
    74     76     file mkdir testdb
................................................................................
    95     97     sqlite db testdb 0666
    96     98     execsql {CREATE TABLE t1(x int)}
    97     99     db close
    98    100     file attributes testdb/sqlite_master.tbl -permission 0444
    99    101     set v [catch {sqlite db testdb 0444} msg]
   100    102     lappend v $msg
   101    103   } {0 {}}
          104  +
          105  +} ;# End of if( platform!=windows )
   102    106   
   103    107   # Make sure a table can be accessed by either uppercase or lowercase
   104    108   # names
   105    109   #
   106    110   do_test dbbe-2.1 {
   107    111     catch {db close}
   108    112     forcedelete testdb

Changes to test/delete.test.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements regression tests for SQLite library.  The
    24     24   # focus of this file is testing the DELETE FROM statement.
    25     25   #
    26         -# $Id: delete.test,v 1.6 2000/06/21 13:59:13 drh Exp $
           26  +# $Id: delete.test,v 1.7 2001/03/20 12:55:14 drh Exp $
    27     27   
    28     28   set testdir [file dirname $argv0]
    29     29   source $testdir/tester.tcl
    30     30   
    31     31   # Try to delete from a non-existant table.
    32     32   #
    33     33   do_test delete-1.1 {
................................................................................
    74     74     lappend v $msg
    75     75   } {1 {no such column: f3}}
    76     76   
    77     77   do_test delete-4.2 {
    78     78     set v [catch {execsql {DELETE FROM table2 WHERE xyzzy(f1+4)}} msg]
    79     79     lappend v $msg
    80     80   } {1 {no such function: xyzzy}}
           81  +
           82  +# Lots of deletes
           83  +#
           84  +do_test delete-5.1 {
           85  +  execsql {DELETE FROM table1}
           86  +  execsql {SELECT count(*) FROM table1}
           87  +} {}
           88  +do_test delete-5.2 {
           89  +  for {set i 1} {$i<=200} {incr i} {
           90  +     execsql "INSERT INTO table1 VALUES($i,[expr {$i*$i}])"
           91  +  }
           92  +  execsql {SELECT count(*) FROM table1}
           93  +} {200}
           94  +do_test delete-5.3 {
           95  +  for {set i 1} {$i<=200} {incr i 4} {
           96  +     execsql "DELETE FROM table1 WHERE f1==$i"
           97  +  }
           98  +  execsql {SELECT count(*) FROM table1}
           99  +} {150}
          100  +do_test delete-5.4 {
          101  +  execsql "DELETE FROM table1 WHERE f1>50"
          102  +  execsql {SELECT count(*) FROM table1}
          103  +} {37}
          104  +do_test delete-5.5 {
          105  +  for {set i 1} {$i<=70} {incr i 3} {
          106  +     execsql "DELETE FROM table1 WHERE f1==$i"
          107  +  }
          108  +  execsql {SELECT f1 FROM table1 ORDER BY f1}
          109  +} {2 3 6 8 11 12 14 15 18 20 23 24 26 27 30 32 35 36 38 39 42 44 47 48 50}
          110  +do_test delete-5.6 {
          111  +  for {set i 1} {$i<40} {incr i} {
          112  +     execsql "DELETE FROM table1 WHERE f1==$i"
          113  +  }
          114  +  execsql {SELECT f1 FROM table1 ORDER BY f1}
          115  +} {42 44 47 48 50}
          116  +do_test delete-5.7 {
          117  +  execsql "DELETE FROM table1 WHERE f1!=48"
          118  +  execsql {SELECT f1 FROM table1 ORDER BY f1}
          119  +} {48}
    81    120   
    82    121   finish_test

Changes to test/lock.test.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements regression tests for SQLite library.  The
    24     24   # focus of this script is database locks.
    25     25   #
    26         -# $Id: lock.test,v 1.6 2001/03/15 18:21:22 drh Exp $
           26  +# $Id: lock.test,v 1.7 2001/03/20 12:55:14 drh Exp $
    27     27   
    28         -if {$dbprefix=="gdbm:"} {
           28  +if {$dbprefix=="gdbm:" && $::tcl_platform(platform)!="windows"} {
    29     29   
    30     30   set testdir [file dirname $argv0]
    31     31   source $testdir/tester.tcl
    32     32   
    33     33   # Create a largish table
    34     34   #
    35     35   do_test lock-1.0 {

Changes to test/main.test.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements regression tests for SQLite library.  The
    24     24   # focus of this file is exercising the code in main.c.
    25     25   #
    26         -# $Id: main.test,v 1.4 2000/12/10 18:23:52 drh Exp $
           26  +# $Id: main.test,v 1.5 2001/03/20 12:55:14 drh Exp $
    27     27   
    28     28   set testdir [file dirname $argv0]
    29     29   source $testdir/tester.tcl
    30     30   
    31     31   # Tests of the sqlite_complete() function.
    32     32   #
    33     33   do_test main-1.1 {
................................................................................
    77     77     }
    78     78   } {1}
    79     79   
    80     80   # Try to open a database with a corrupt master file.
    81     81   #
    82     82   do_test main-2.0 {
    83     83     catch {db close}
           84  +  foreach f [glob -nocomplain testdb/*] {file delete -force $f}
    84     85     file delete -force testdb
    85     86     file mkdir testdb
    86     87     set fd [open testdb/sqlite_master.tbl w]
    87     88     puts $fd hi!
    88     89     close $fd
    89     90     set v [catch {sqlite db testdb} msg]
    90     91     lappend v $msg
    91     92   } {0 {}}
    92     93   
    93     94   # Here are some tests for tokenize.c.  
    94     95   #
    95     96   do_test main-3.1 {
    96     97     catch {db close}
           98  +  foreach f [glob -nocomplain testdb/*] {file delete -force $f}
    97     99     file delete -force testdb
    98    100     sqlite db testdb
    99    101     set v [catch {execsql {SELECT * from T1 where x!!5}} msg]
   100    102     lappend v $msg
   101    103   } {1 {unrecognized token: "!!"}}
   102    104   do_test main-3.2 {
   103    105     catch {db close}
          106  +  foreach f [glob -nocomplain testdb/*] {file delete -force $f}
   104    107     file delete -force testdb
   105    108     sqlite db testdb
   106    109     set v [catch {execsql {SELECT * from T1 where ~x}} msg]
   107    110     lappend v $msg
   108    111   } {1 {unrecognized token: "~"}}
   109    112   do_test main-3.3 {
   110    113     catch {db close}
          114  +  foreach f [glob -nocomplain testdb/*] {file delete -force $f}
   111    115     file delete -force testdb
   112    116     sqlite db testdb
   113    117     set v [catch {execsql {SELECT a|b from T1 where x}} msg]
   114    118     lappend v $msg
   115    119   } {1 {unrecognized token: "|"}}
   116    120   
   117    121   do_test main-3.3 {
   118    122     catch {db close}
          123  +  foreach f [glob -nocomplain testdb/*] {file delete -force $f}
   119    124     file delete -force testdb
   120    125     sqlite db testdb
   121    126     execsql {
   122    127       create table T1(X REAL);
   123    128       insert into T1 values(.5);
   124    129       insert into T1 values(0.5e2);
   125    130       insert into T1 values(0.5e-002);

Changes to test/tester.tcl.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements some common TCL routines used for regression
    24     24   # testing the SQLite library
    25     25   #
    26         -# $Id: tester.tcl,v 1.11 2001/03/15 18:21:22 drh Exp $
           26  +# $Id: tester.tcl,v 1.12 2001/03/20 12:55:14 drh Exp $
    27     27   
    28     28   # Create a test database
    29     29   #
    30     30   if {![info exists dbprefix]} {
    31     31     if {[info exists env(SQLITE_PREFIX)]} {
    32     32       set dbprefix $env(SQLITE_PREFIX):
    33     33     } else {
    34     34       set dbprefix "gdbm:"
    35     35     }
    36     36   }
    37     37   switch $dbprefix {
    38     38     gdbm: {
           39  +   foreach f [glob -nocomplain testdb/*] {
           40  +     catch {file delete -force $f}
           41  +   }
    39     42      if {[catch {file delete -force testdb}]} {
    40     43        exec rm -rf testdb
    41     44      }
    42     45      file mkdir testdb
    43     46     }
    44     47     memory: {
    45     48      # do nothing

Changes to test/vacuum.test.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements regression tests for SQLite library.  The
    24     24   # focus of this file is testing the VACUUM statement.
    25     25   #
    26         -# $Id: vacuum.test,v 1.2 2000/10/19 14:10:10 drh Exp $
           26  +# $Id: vacuum.test,v 1.3 2001/03/20 12:55:14 drh Exp $
    27     27   
    28     28   set testdir [file dirname $argv0]
    29     29   source $testdir/tester.tcl
    30     30   
    31     31   # Try to vacuum a non-existant table.
    32     32   #
    33     33   do_test vacuum-1.1 {
................................................................................
    61     61     after 1000
    62     62     execsql {VACUUM test1}
    63     63     set a1 [file mtime testdb/test1.tbl]
    64     64     set a2 [file mtime testdb/test2.tbl]
    65     65     set a3 [file mtime testdb/index1.tbl]
    66     66     expr {$a1>$b1 && $a2==$b2 && $a3==$b3}
    67     67   } {1}
           68  +if {$::tcl_platform(platform)!="windows"} {
    68     69   testif gdbm:
    69     70   do_test vacuum-1.4 {
    70     71     set b1 [file mtime testdb/test1.tbl]
    71     72     set b2 [file mtime testdb/test2.tbl]
    72     73     set b3 [file mtime testdb/index1.tbl]
    73     74     after 1000
    74     75     execsql {VACUUM}
    75     76     set a1 [file mtime testdb/test1.tbl]
    76     77     set a2 [file mtime testdb/test2.tbl]
    77     78     set a3 [file mtime testdb/index1.tbl]
    78     79     expr {$a1>$b1 && $a2>$b2 && $a3>$b3}
    79     80   } {1}
    80         -
           81  +} ;# End if( platform!=windows )
    81     82   
    82     83   finish_test

Changes to www/changes.tcl.

    12     12   }
    13     13   
    14     14   
    15     15   proc chng {date desc} {
    16     16     puts "<DT><B>$date</B></DT>"
    17     17     puts "<DD><P><UL>$desc</UL></P></DD>"
    18     18   }
           19  +
           20  +chng {2001 Mar 20 (1.0.26)} {
           21  +<li>A serious bug fixed on Windows.  Windows users should upgrade.
           22  +    No impact to Unix.</li>
           23  +}
    19     24   
    20     25   chng {2001 Mar 15 (1.0.25)} {
    21     26   <li>Modify the test scripts to identify tests that depend on system
    22     27       load and processor speed and
    23     28       to warn the user that a failure of one of those (rare) tests does
    24     29       not necessarily mean the library is malfunctioning.  No changes to
    25     30       code.