Well, when I quiclky read the paragraph about types I understood that they were existing... In fact not, so I completly agree with your solution, It seems to be the best one to allow comparison or sum. I will save the 'cents' in integer and do multiplication and division and you said.
Thanks for your help, Simon. 2011/12/19 Simon Slavin <slav...@bigfraud.org> > > On 19 Dec 2011, at 7:18pm, Alexandre K wrote: > > > @Simon : Do you mean to store as integer or string whereas the Numeric > > (x,y) column type exists, in order to have a nice binding in C ? > > The numeric (x,y) column type does not exist. SQLite supports only the > following five types: > > <http://www.sqlite.org/datatype3.html> > > Any attempt to specify an (x,y) is ignored as you can see by the > 'DECIMAL(10,5)' example in section 2.2. > > I meant to multiply your numbers by a power of ten (in the case of Euros, > you would need to multiply by 100) then use the integer binding function to > bind them to an INTEGER column. So what you are actually storing is the > number of cents, not the number of euros. > > I have a GPS application which stored GPS coordinates to 5 digits. For > instance, -54.27462. It stores its values in a SQLite database as > integers, so that particular value is stored as -5427462. This allows me > to do various mathematics functions on them like min(lat) and max(lat), and > to find stored values in certain ranges. Though I have to remember to > multiply my comparison values by 100000. > > > It's sure that I want to have sum() and others operations on the column > and > > the 'good' type if possible. I guess it is impossible to bind with string > > type with a numeric column, maybe with bytes and void pointer > > (sqlite3_bind_blob or other) ? > > You could bind them as BLOBs. That solution hadn't occurred to me. But > then you would not be able to perform any maths on them so doing sum(price) > would not work. > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users