Blob may be better if you need speed -- then no conversion is necessary inside 
your Pascal code to/from a string.
But if you want to be able to see and understand your database text is better 
(or you have to write a special Pascal program to decode your database to look 
at any problems).

And...no conversion is performed if you declare the field as text and insert as 
text.

sqlite> create table tab1 (a int,c text);
sqlite> insert into tab1 values 
(1,'24395734857634756.92384729847239842398423964294298473927');
sqlite> select * from tab1;
1|24395734857634756.92384729847239842398423964294298473927


Michael D. Black
Senior Scientist
NG Information Systems
Advanced Analytics Directorate



________________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of LacaK [la...@users.sourceforge.net]
Sent: Wednesday, March 23, 2011 2:20 AM
To: sqlite-users@sqlite.org
Subject: EXT :Re: [sqlite] storing big numbers into NUMERIC, DECIMAL columns

> Here are two options which will let you get the contents back to the original 
> precision:

> A) Store the values as BLOBs.
> B) Store the value as TEXT, but add a non-digit to the beginning of each 
> number value, for example

> X24395734857634756.92384729847239842398423964294298473927

> Both methods will prevent SQLite from trying to see the value as a number.  
> Oh and since nobody seems to have pointed it out yet, SQLite doesn't have a 
> NUMERIC or a DECIMAL column type.  The types can be found here:

 <http://www.sqlite.org/datatype3.html>
Hi all,
thank you all for your answers, advices.

So conclusion is:
A) use sqlite3_bind_blob() then no conversion is performed
B) use sqlite3_bind_text() but with some hack, which "invalidates" numbers

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

Reply via email to