/ So only solution is use TEXT columns (with TEXT affinity) ? There is no
/>>/ way how to use DECIMAL columns (with NUMERIC affinity) ?
/>>/ My goal is store numeric values with big precision (as declared per
/>>/ column DECIMAL(30,7)).
/
SQLite happily ignores those numbers in parentheses. There is no arbitrary 
precision floating point data type in SQLite. You get to choose between text, 
64-bit integers, 64-bit IEEE doubles, and blobs.

/ I do not want any conversion to floating-point values ... because such
/>>/ conversion loses digits and is not reversible to original value.
/>>/ What I will expect is: If supplied value can not be "reversibly"
/>>/ converted to floating-point representation (REAL storage class), then
/>>/ store it as text with TEXT storage class
/
Use affinity of NONE (don't specify any type), and figure out in your program 
for each value whether to store as a floating point number or as text. Use 
sqlite3_bind_double or sqlite3_bind_text accordingly.

/ But on this page http://www.sqlite.org/datatype3.html is written:
/>>/ "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. For conversions between TEXT
/>>/ and REAL storage classes, SQLite considers the conversion to be lossless
/>>/ and reversible if the first 15 significant decimal digits of the number
/>>/ are preserved. *If the lossless conversion of TEXT to INTEGER or REAL is
/>>/ not possible then the value is stored using the TEXT storage class*."
/
In the examples you've shown, the first 15 significant digits are indeed 
preserved. SQLite appears to behave as documented. What again seems to be the 
problem?

Yes you are right , it seemes so.
So once if I define column as DECIMAL,NUMERIC then there is no chance store in 
such column numeric values out of range of 64bit integers or 64bit floating 
point values, right ?
My guess, hope was, that if I use sqlite3_bind_text with for example 
'123456789123456789.12345' then sqlite3 stores such value as string and do not 
convert them to floating point.
(equal as when I insert non numeric value for example 'abcd' then 'abcd' is 
stored)
Thanks for your assistance
Laco.



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to