I can’t reproduce the problem,
http://sqlite.org/datatype3.html#type_affinity
“When text data is inserted into a NUMERIC column, the storage class of the
text is converted to INTEGER or REAL (in order of preference) if such
conversion is lossless and reversible”
So after “create table test (foo REAL)”. Foo field have “REAL” type affinity.
INSERT INTO test VALUES(62.027393); or
INSERT INTO test VALUES(“62.027393”);
Or after prepare “ INSERT INTO test VALUES(?) “
Bind_text “62.027393”
Bind_double 62.027393
In all the four situation, the value insert into foo field is binary
identical, it’s a 8-bytes REAL value.
#include <stdio.h>
#include <sqlite3.h>
int main() {
sqlite3* db;
sqlite3_stmt* stmt;
sqlite3_open("double.sqlite", &db);
sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS test(foo REAL);", 0, 0, 0);
sqlite3_prepare(db, "INSERT INTO test VALUES(?)", -1, &stmt, 0);
sqlite3_bind_text(stmt, 1, "62.027393", -1, SQLITE_STATIC);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
sqlite3_prepare(db, "INSERT INTO test VALUES(62.027393)", -1, &stmt, 0);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
sqlite3_close(db);
}
e:\Nana>sqlite3 double.sqlite
sqlite> select typeof(foo) from test;
real
real
sqlite> select * from test a cross join test b where a.foo=b.foo;
62.027393|62.027393
62.027393|62.027393
62.027393|62.027393
62.027393|62.027393
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users