os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt1567.test
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
# 2005 December 19 2005
sl@0
     2
#
sl@0
     3
# The author disclaims copyright to this source code.  In place of
sl@0
     4
# a legal notice, here is a blessing:
sl@0
     5
#
sl@0
     6
#    May you do good and not evil.
sl@0
     7
#    May you find forgiveness for yourself and forgive others.
sl@0
     8
#    May you share freely, never taking more than you give.
sl@0
     9
#
sl@0
    10
#***********************************************************************
sl@0
    11
# This file implements regression tests for SQLite library.
sl@0
    12
#
sl@0
    13
# This file implements tests to verify that ticket #1567 is
sl@0
    14
# fixed.  
sl@0
    15
#
sl@0
    16
sl@0
    17
set testdir [file dirname $argv0]
sl@0
    18
source $testdir/tester.tcl
sl@0
    19
sl@0
    20
do_test tkt1567-1.1 {
sl@0
    21
  execsql {
sl@0
    22
    CREATE TABLE t1(a TEXT PRIMARY KEY);
sl@0
    23
  }
sl@0
    24
  set bigstr abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
sl@0
    25
  for {set i 0} {$i<100} {incr i} {
sl@0
    26
    set x [format %5d [expr $i*2]]
sl@0
    27
    set sql "INSERT INTO t1 VALUES('$x-$bigstr')"
sl@0
    28
    execsql $sql
sl@0
    29
  }
sl@0
    30
} {}
sl@0
    31
integrity_check tkt1567-1.2
sl@0
    32
sl@0
    33
do_test tkt1567-1.3 {
sl@0
    34
  execsql {
sl@0
    35
    BEGIN;
sl@0
    36
    UPDATE t1 SET a = a||'x' WHERE rowid%2==0;
sl@0
    37
  }
sl@0
    38
} {}
sl@0
    39
do_test tkt1567-1.4 {
sl@0
    40
  catchsql {
sl@0
    41
    UPDATE t1 SET a = CASE WHEN rowid<90 THEN substr(a,1,10) ELSE '9999' END;
sl@0
    42
  }
sl@0
    43
} {1 {column a is not unique}}
sl@0
    44
do_test tkt1567-1.5 {
sl@0
    45
  execsql {
sl@0
    46
    COMMIT;
sl@0
    47
  }
sl@0
    48
} {}
sl@0
    49
integrity_check tkt1567-1.6
sl@0
    50
sl@0
    51
finish_test