SQLite

Check-in [72e1680904]
Login

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

Overview
Comment:Adjust the rowhash.test module so that it recovers gracefully in the rare event of a rowid collision. (CVS 6531)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 72e1680904a354811cd2956bd57769ee2482c8bb
User & Date: drh 2009-04-21 17:13:38.000
Context
2009-04-21
17:23
Fix a segfault that followed a malloc failure introduced by (6527). (CVS 6532) (check-in: 08e71b1140 user: danielk1977 tags: trunk)
17:13
Adjust the rowhash.test module so that it recovers gracefully in the rare event of a rowid collision. (CVS 6531) (check-in: 72e1680904 user: drh tags: trunk)
16:15
Allocate the initial RowHash object using lookaside. (CVS 6530) (check-in: 9b30ab7199 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/rowhash.test.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This file implements regression tests for SQLite library.  The
# focus of this file is the code in rowhash.c.
#
# $Id: rowhash.test,v 1.1 2009/04/21 09:02:47 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_test rowhash-1.1 {
  execsql {
    CREATE TABLE t1(id INTEGER PRIMARY KEY, a, b, c);
    CREATE INDEX i1 ON t1(a);
    CREATE INDEX i2 ON t1(b);
    CREATE INDEX i3 ON t1(c);
  }
} {}

proc do_keyset_test {name lKey} {
  db transaction {
    execsql { DELETE FROM t1 }
    foreach key $lKey {
      execsql { INSERT INTO t1 VALUES($key, 'a', 'b', 'c') }
    }
  }
  do_test $name {
    lsort -integer [execsql {
      SELECT id FROM t1 WHERE a = 'a' OR b = 'b' OR c = 'c';
    }]
  } [lsort -integer $lKey]
}

do_keyset_test rowhash-2.1 {1 2 3}
do_keyset_test rowhash-2.2 {0 1 2 3}
do_keyset_test rowhash-2.3 {62 125 188}

for {set i 4} {$i < 10} {incr i} {
  for {set j 0} {$j < 5000} {incr j} {
    lappend L [expr int(rand()*10000000000)]
  }
  do_keyset_test rowhash-2.$i $L
}

finish_test







|

















|












>








8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#    May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This file implements regression tests for SQLite library.  The
# focus of this file is the code in rowhash.c.
#
# $Id: rowhash.test,v 1.2 2009/04/21 17:13:38 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_test rowhash-1.1 {
  execsql {
    CREATE TABLE t1(id INTEGER PRIMARY KEY, a, b, c);
    CREATE INDEX i1 ON t1(a);
    CREATE INDEX i2 ON t1(b);
    CREATE INDEX i3 ON t1(c);
  }
} {}

proc do_keyset_test {name lKey} {
  db transaction {
    execsql { DELETE FROM t1 }
    foreach key $lKey {
      execsql { INSERT OR IGNORE INTO t1 VALUES($key, 'a', 'b', 'c') }
    }
  }
  do_test $name {
    lsort -integer [execsql {
      SELECT id FROM t1 WHERE a = 'a' OR b = 'b' OR c = 'c';
    }]
  } [lsort -integer $lKey]
}

do_keyset_test rowhash-2.1 {1 2 3}
do_keyset_test rowhash-2.2 {0 1 2 3}
do_keyset_test rowhash-2.3 {62 125 188}
expr srand(1)
for {set i 4} {$i < 10} {incr i} {
  for {set j 0} {$j < 5000} {incr j} {
    lappend L [expr int(rand()*10000000000)]
  }
  do_keyset_test rowhash-2.$i $L
}

finish_test