As the script got removed, here it is:
package require sqlite3
proc main {} {
puts "sqlite3 version: [
exec sqlite3 -version
]"
sqlite3 db :memory:
puts "libsqlite3 version: [
db version
]"
db eval {
CREATE TABLE test (
id INTEGER PRIMARY KEY,
b BOOLEAN NOT NULL DEFAULT false
);
}
db2 eval {
INSERT INTO test (b) VALUES (true);
}
display
db2 eval {
INSERT INTO test (b) VALUES (:tvalue);
}
display
db2 eval "
INSERT INTO test (b) VALUES (false);
"
display
db2 eval {UPDATE test SET b = :fvalue WHERE id = 2}
display
db2 eval {UPDATE test SET b = false WHERE id = 2}
display
}
proc display {} {
db eval {
SELECT * FROM test;
} values {
array unset values {\*}
parray values
puts ""
}
puts ""
}
proc db2 {action req} {
set tvalue true
set fvalue false
puts [string trim $req]
db $action $req
}
main
2019-07-19 17:02 +02:00, [email protected] :
>
> Hello,
>
> If I run the attached script (results I see in attached text), one can see a
> problem with true and false in variables. If I write true or false directly,
> no problem, sqlite store a 1 or a 0.
>
> But if a put them in a variable, sqlite always store them as strings "true"
> or "false".
>
> How to achieve a correct result with a $value or :value without prefiltering
> values “true” or “false”?
>
> Thank you,
>
> Gilles.
>
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> *Pièces jointes:*
> * results.txt
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users