[SQL] placeholders work for SQLite but not for mySQL

Kay C Lan lan.kc.macmail at gmail.com
Mon Aug 8 07:36:02 EDT 2016

On Sun, Aug 7, 2016 at 1:05 PM, Ludovic THEBAULT
<ludovic.thebault at laposte.net> wrote:
> If my variable is empty, i set it to null.
> (the mysql column accept null)
Hi Ludovic,

sorry for the slow reply but for some reason your email ended up in my
SPAM folder.

Thanks for the suggestion, but after this stupid attempt

put "null" into pValue  --rookie mistake

I eventually read the Dictionary to discover that 'null' is wisely an
LC predefined constant. Unfortunately:

put null into pValue

worked fine for SQLite, but I still got the exact same mySQL ERROR =
Incorrect integer value: '' for column 'postcode' at row 1

And again, if I don't use a placeholder and write it out longhand it works fine:

UPDATE players SET postcode = null, updated = '20160805155320' WHERE
playerid = '123'

Result = 1 --Row updated

There must be something screwy about my set-up because I can't believe
that this is the only mySQL/LC combo I have of using a placeholder to
pass empty to an integer column in mySQL. For the same DB it happily
accepts empty via a placeholder to varchar fields. I'll probably
resort to my usual backstop - completely rebuild from scratch.

More information about the use-livecode mailing list