1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix problems with types and the recognition of BLOB as having no affinity. (CVS 1418)

FossilOrigin-Name: 8411718f0ac17e9c2376fdf8b5fa0cc5fc88be9b
This commit is contained in:
drh
2004-05-20 12:41:19 +00:00
parent 1ad3b9e61a
commit e2ea40d36d
6 changed files with 34 additions and 45 deletions

View File

@ -12,7 +12,7 @@
# it tests that the different storage classes (integer, real, text etc.)
# all work correctly.
#
# $Id: types.test,v 1.4 2004/05/18 10:06:26 danielk1977 Exp $
# $Id: types.test,v 1.5 2004/05/20 12:41:20 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -41,7 +41,7 @@ source $testdir/tester.tcl
# Create a table with one column for each type of affinity
do_test types-1.1.0 {
execsql {
CREATE TABLE t1(i integer, n numeric, t text, o);
CREATE TABLE t1(i integer, n numeric, t text, o blob);
}
} {}
@ -51,16 +51,16 @@ do_test types-1.1.0 {
# four value are the storage classes that would be used if the
# literal were inserted into a column with affinity INTEGER, NUMERIC, TEXT
# or NONE, respectively.
set values [list \
[list 5.0 INTEGER REAL TEXT REAL] \
[list 5 INTEGER INTEGER TEXT INTEGER] \
[list '5.0' INTEGER REAL TEXT TEXT] \
[list '-5.0' INTEGER REAL TEXT TEXT] \
[list '-5.0' INTEGER REAL TEXT TEXT] \
[list '5' INTEGER INTEGER TEXT TEXT] \
[list 'abc' TEXT TEXT TEXT TEXT] \
[list NULL NULL NULL NULL NULL] \
]
set values {
{ 5.0 INTEGER REAL TEXT REAL }
{ 5 INTEGER INTEGER TEXT INTEGER }
{ '5.0' INTEGER REAL TEXT TEXT }
{ '-5.0' INTEGER REAL TEXT TEXT }
{ '-5.0' INTEGER REAL TEXT TEXT }
{ '5' INTEGER INTEGER TEXT TEXT }
{ 'abc' TEXT TEXT TEXT TEXT }
{ NULL NULL NULL NULL NULL }
}
# This code tests that the storage classes specified above (in the $values
# table) are correctly assigned when values are inserted using a statement
@ -291,4 +291,3 @@ do_test types-2.5.3 {
} [list {} $string10 4000 $string500 4000 {} 4000 {} $string500000]
finish_test

View File

@ -12,7 +12,7 @@
# of this file is testing the interaction of manifest types, type affinity
# and comparison expressions.
#
# $Id: types2.test,v 1.2 2004/05/17 10:48:58 danielk1977 Exp $
# $Id: types2.test,v 1.3 2004/05/20 12:41:20 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -40,8 +40,8 @@ execsql {
n2 NUMERIC,
t1 TEXT,
t2 TEXT,
o1,
o2
o1 BLOB,
o2 BLOB
);
INSERT INTO t1 VALUES(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
}
@ -99,7 +99,7 @@ set vals [list 10 10.0 '10' '10.0' 20 20.0 '20' '20.0' 30 30.0 '30' '30.0']
# 1 2 3 4 5 6 7 8 9 10 11 12
execsql {
CREATE TABLE t2(i INTEGER, n NUMERIC, t TEXT, o);
CREATE TABLE t2(i INTEGER, n NUMERIC, t TEXT, o XBLOBY);
CREATE INDEX t2i1 ON t2(i);
CREATE INDEX t2i2 ON t2(n);
CREATE INDEX t2i3 ON t2(t);
@ -247,7 +247,7 @@ test_boolset types2-6.9 {rowid IN (1, 6, 10)} {1 6 10}
# Tests types2-7.* concentrate on expressions of the form
# "x IN (SELECT...)" with no index.
execsql {
CREATE TABLE t3(i INTEGER, n NUMERIC, t TEXT, o);
CREATE TABLE t3(i INTEGER, n NUMERIC, t TEXT, o BLOB);
INSERT INTO t3 VALUES(1, 1, 1, 1);
INSERT INTO t3 VALUES(2, 2, 2, 2);
INSERT INTO t3 VALUES(3, 3, 3, 3);
@ -282,7 +282,7 @@ test_bool types2-7.15 {o1='2'} {o1 IN (SELECT o||'' FROM t3)} 1
# set vals [list 10 10.0 '10' '10.0' 20 20.0 '20' '20.0' 30 30.0 '30' '30.0']
# 1 2 3 4 5 6 7 8 9 10 11 12
execsql {
CREATE TABLE t4(i INTEGER, n NUMERIC, t TEXT, o);
CREATE TABLE t4(i INTEGER, n NUMERIC, t VARCHAR(20), o LARGE BLOB);
INSERT INTO t4 VALUES(10, 20, 20, 30);
}
test_boolset types2-8.1 {i IN (SELECT i FROM t4)} {1 2 3 4}
@ -299,10 +299,3 @@ test_boolset types2-8.7 {t IN (SELECT o FROM t4)} {9 11}
test_boolset types2-8.8 {o IN (SELECT o FROM t4)} {9 10}
finish_test