On 23 Sep 2012, at 11:37am, Baruch Burstein <bmburst...@gmail.com> wrote:

> I am curious about the usefulness of sqlite's "unique" type handling, and
> so would like to know if anyone has ever actually found any practical use
> for it/used it in some project? I am referring to the typeless handling,

I use it in a project where a number could be missing for a number of different 
reasons, each of which have to be handled differently.  So I have just one 
column in and test for NULL and several string values before I treat any other 
value as a number.  But had SQLite not had typeless handling I would just have 
made two columns: one with a text value and one with a number, and the number 
would be valid only if the text column had, say, 'valid' in.  It would have 
just meant writing my code a little differently.

Another time was not in everyday working code, but when I imported a huge set 
of data from a spreadsheet which sometimes had weird values in the cells.  
Normally this requires a lot of clicking going backwards and forwards between 
two documents.  A normal SQL engine would have just left many cells blank, but 
with SQLite it was possible to import the entire spreadsheet in one go, then I 
didn't have to work with the spreadsheet any more and could just do things like

SELECT * FROM deposits WHERE typeof(amount) IS NOT 'integer'

to find the cells with weird values and bit by bit convert them to something 
useful.  In that case, once the data was all in a form I was happy with, I no 
longer needed the typeless nature of SQLite: my everyday code assumed that that 
column was integer or NULL.

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

Reply via email to