Anomoly when storing empty values into SQLite integer fields

Bob Sneidar bobs at twft.com
Thu Feb 23 11:51:25 EST 2012


I know I repeat myself, but I did the same think Mark was doing only with mySQL and I used MySQLWorkbench and avoided LC. I got the same results. It seems that if you use an empty string "" on a numeric column, SQL interprets that as zero 0. It begs the question however, why in the world you would pass a string value to a numeric column? I am not sure what happens in sqLite when you pass NULL (notice that is not "NULL"). With mySQL it works as expected. The value of NULL (not the string but NULL) is inserted/updated as you would expect. 

I see no difference between the results using an SQL editor and LC in this regard, at least when using mySQL. So although the results might not be what some would expect, it is not LC's doing. 

Bob


On Feb 22, 2012, at 9:59 PM, Mark Smith wrote:

> 
> slylabs13 wrote
>> 
>> It may be a small distinction, but NULL is ASCII 0. An empty string is
>> nothing at all, so far as I know. To a human this is splitting hairs, but
>> to a computer all hairs must be split. 
>> 
>> 
> 
> The scenario seems to be (1) if you create a new empty record all the
> undefined values are null. (2) If you try to store an undefined field (LC
> field), LC puts an empty string. It does this for any SQLite field type. (3)
> When you read it back, if the SQlite field  is an integer LC displays a
> zero, if the SQLite field is text, then LC leaves it as an empty string. 
> 
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Anomoly-when-storing-empty-values-into-SQLite-integer-fields-tp4408942p4412919.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list