Is zero the same as empty?
Peter Haworth
pete at lcsql.com
Mon Oct 27 17:38:45 EDT 2014
I ran across one situation involving zero/empty a while back that I
reported as a bug, not sure if it's been fixed or not.
If you INSERT a row into an SQL database and leave out some of the columns,
those columns end up as NULL in the database (assuming they don't have a
default value assigned in the schema). If you then issue a SELECT
including one of those columns and it has a numeric data type in the
schema, it comes back as zero, not empty or NULL. That made it impossible
to distinguish between an "uninitialized" value for the column and a zero
value.
Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
On Mon, Oct 27, 2014 at 12:58 PM, FlexibleLearning.com <
admin at flexiblelearning.com> wrote:
> As Jacque has pointed out, 'empty' and 'zero' depend on context. When doing
> math calculations, I always force a math evaluation...
>
> If t1 + 0 = 0 then ...
>
> If t1 is empty it will then always evaluate to zero.
>
> Might help in your situation.
>
> Best regards,
>
> Hugh Senior
> FLCo
>
>
> _______________________________________________
> 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