Re: [sqlite] Storing amount?

2014-05-08 Thread RSmith
On 2014/05/08 16:06, Werner Kleiner wrote: Hmm, but would it not be better to store the value 5 as 5.0 , which would be correct for the decimal point instead of 5000.0 ? I think the other replies to your post missed the fact that the value is different by an order of magnitude. That's

Re: [sqlite] Storing amount?

2014-05-08 Thread Simon Slavin
On 8 May 2014, at 3:06pm, Werner Kleiner wrote: > Hmm, but would it not be better to store the value 5 as > 5.0 , which would be correct for the decimal point > instead of > 5000.0 ? Numeric values in numeric fields are not really stored as text, they're stored as binary representation

Re: [sqlite] Storing amount?

2014-05-08 Thread Igor Tandetnik
On 5/8/2014 7:13 AM, Kleiner Werner wrote: a PHP script stores an amount into a SQLite table column "salary" which is defined as float(10,0) I a user fill in 5 into a textfield, this value is stored as 5000.0 Why this? why not 5 ? sqlite> create table t(x float(10,0)); sqlite> insert

Re: [sqlite] Storing amount?

2014-05-08 Thread Werner Kleiner
Hmm, but would it not be better to store the value 5 as 5.0 , which would be correct for the decimal point instead of 5000.0 ? -- View this message in context: http://sqlite.1065341.n5.nabble.com/Storing-amount-tp75527p75539.html Sent from the SQLite mailing list archive at Nabble.com.

Re: [sqlite] Storing amount?

2014-05-08 Thread Keith Medcalf
ginal Message- >From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- >boun...@sqlite.org] On Behalf Of Werner Kleiner >Sent: Thursday, 8 May, 2014 07:01 >To: sqlite-users@sqlite.org >Subject: Re: [sqlite] Storing amount? > >>SQLite does not understand column types like

Re: [sqlite] Storing amount?

2014-05-08 Thread Werner Kleiner
>SQLite does not understand column types like "numeric(10,0)". It has only two number types: INTEGER and >REAL. So if the column is datatype REAL and you will store amount 5, SQLite results in 5000.0 ? Why not 5.0 ? And if the columns datatype is REAL, you need a helper tool or script wh

Re: [sqlite] Storing amount?

2014-05-08 Thread Simon Slavin
On 8 May 2014, at 12:41pm, Werner Kleiner wrote: > I use the PDO library. > The typeOf results in "real" > > If I change the "swsalary" column to "numeric(10,0) it results in integer > and then the value of > 5 ist stored correct without . (dot). > > So is it better to take datatype "numer

Re: [sqlite] Storing amount?

2014-05-08 Thread Hick Gunter
3% will result in a change of the stored type. -Ursprüngliche Nachricht- Von: Werner Kleiner [mailto:sqliteh...@web.de] Gesendet: Donnerstag, 08. Mai 2014 13:42 An: sqlite-users@sqlite.org Betreff: Re: [sqlite] Storing amount? Hello Simon, thanks for help. I use the PDO library. The typ

Re: [sqlite] Storing amount?

2014-05-08 Thread Werner Kleiner
Hello Simon, thanks for help. I use the PDO library. The typeOf results in "real" If I change the "swsalary" column to "numeric(10,0) it results in integer and then the value of 5 ist stored correct without . (dot). So is it better to take datatype "numeric" for storing amounts without dots

Re: [sqlite] Storing amount?

2014-05-08 Thread Simon Slavin
On 8 May 2014, at 12:13pm, Kleiner Werner wrote: > a PHP script stores an amount into a SQLite table column "salary" which is > defined as float(10,0) > I a user fill in 5 into a textfield, this value is stored as 5000.0 Which way of accessing SQLite are you using ? The PDO library or the

[sqlite] Storing amount?

2014-05-08 Thread Kleiner Werner
Hello, a PHP script stores an amount into a SQLite table column "salary" which is defined as float(10,0) I a user fill in 5 into a textfield, this value is stored as 5000.0   Why this? why not 5 ?   If I do the same in MySQL, where the column is defined as decimal(10,0) it is stored corr