Add the sqlite3_value_frombind() interface. Use that interface to
improve fts3_tokenizer(). FossilOrigin-Name: b3f2c3205a28dc21ea7080e5e1ba246ce9c9b90c1309262ca11d8e40943ed677
This commit is contained in:
@@ -86,11 +86,48 @@ do_test fts3atoken-1.5 {
|
||||
}
|
||||
} {{There was movement at the station}}
|
||||
|
||||
unset -nocomplain simple blah2name simplename
|
||||
set simplename "simple"
|
||||
set blah2name "blah2"
|
||||
set simple [db one {SELECT fts3_tokenizer('simple')}]
|
||||
sqlite3_db_config db SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 0
|
||||
do_catchsql_test 1.6 {
|
||||
SELECT fts3_tokenizer('blah', fts3_tokenizer('simple')) IS NULL;
|
||||
} {1 {fts3tokenize disabled}}
|
||||
do_test fts3atoken-1.7 {
|
||||
execsql {
|
||||
SELECT fts3_tokenizer('blah2', $simple) IS NULL;
|
||||
}
|
||||
} {1}
|
||||
|
||||
# With ENABLE_FTS3_TOKENIZER off, the fts3_tokenzer(1) function
|
||||
# returns NULL unless the first parameter is a bound parameter.
|
||||
# If the first parameter is a bound parameter, then fts3_tokenizer(1)
|
||||
# returns the actual pointer value as a BLOB.
|
||||
#
|
||||
do_test fts3atoken-1.8 {
|
||||
execsql {
|
||||
SELECT fts3_tokenizer($blah2name) == fts3_tokenizer($simplename),
|
||||
typeof(fts3_tokenizer($blah2name)),
|
||||
typeof(fts3_tokenizer('blah2')),
|
||||
typeof(fts3_tokenizer($simplename)),
|
||||
typeof(fts3_tokenizer('simple'));
|
||||
}
|
||||
} {1 blob null blob null}
|
||||
|
||||
# With ENABLE_FTS3_TOKENIZER on, fts3_tokenizer() always returns
|
||||
# the BLOB pointer, regardless the parameter
|
||||
#
|
||||
sqlite3_db_config db SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1
|
||||
do_test fts3atoken-1.9 {
|
||||
execsql {
|
||||
SELECT fts3_tokenizer('blah2') == fts3_tokenizer('simple'),
|
||||
typeof(fts3_tokenizer($blah2name)),
|
||||
typeof(fts3_tokenizer('blah2')),
|
||||
typeof(fts3_tokenizer($simplename)),
|
||||
typeof(fts3_tokenizer('simple'));
|
||||
}
|
||||
} {1 blob blob blob blob}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Test cases fts3atoken-2.* test error cases in the scalar function based
|
||||
|
||||
@@ -1391,4 +1391,32 @@ for {set i 65536} {$i<=0x10ffff} {incr i 139} {
|
||||
do_execsql_test func-31.1 {
|
||||
SELECT char(), length(char()), typeof(char())
|
||||
} {{} 0 text}
|
||||
|
||||
# sqlite3_value_frombind()
|
||||
#
|
||||
do_execsql_test func-32.100 {
|
||||
SELECT test_frombind(1,2,3,4);
|
||||
} {0}
|
||||
do_execsql_test func-32.110 {
|
||||
SELECT test_frombind(1,2,?,4);
|
||||
} {4}
|
||||
do_execsql_test func-32.120 {
|
||||
SELECT test_frombind(1,(?),4,?+7);
|
||||
} {2}
|
||||
do_execsql_test func-32.130 {
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1(a,b,c,e,f);
|
||||
INSERT INTO t1 VALUES(1,2.5,'xyz',x'e0c1b2a3',null);
|
||||
SELECT test_frombind(a,b,c,e,f,$xyz) FROM t1;
|
||||
} {32}
|
||||
do_execsql_test func-32.140 {
|
||||
SELECT test_frombind(a,b,c,e,f,$xyz+f) FROM t1;
|
||||
} {0}
|
||||
do_execsql_test func-32.150 {
|
||||
SELECT test_frombind(x.a,y.b,x.c,:123,y.e,x.f,$xyz+y.f) FROM t1 x, t1 y;
|
||||
} {8}
|
||||
|
||||
|
||||
|
||||
|
||||
finish_test
|
||||
|
||||
Reference in New Issue
Block a user