database write error

Len Morgan len-morgan at crcom.net
Tue Jan 31 07:32:21 EST 2012


Apostrophe is a reserved character in SQL so you'll have to escape it.  
If you take the part of your INSERT statement that has the field with 
the apostrophe in it and "expand" the variable (i.e., write it in with 
the *contents *of the variable instead (e.g., INSERT 
.....,'[[globaldata] ]' becomes INSERT ..., 'your's') you can see that 
the parser has no way to tell which apostrophe is real and which is part 
of the field data.

What I usually do is is replace all the apostrophes in my DATA with 
backticks (`) when I write the data and then do the reverse when I read 
it back.  This fools SQL into doing what you want but still looks right 
when you manually look at the data in the database.

HTH

len morgan


  On 1/31/2012 1:50 AM, Mark Smith wrote:
> Hi, I have some code that works fine until I put an apostrophe into a field
> and then it errors out on storing the data. Any suggestions on dealing with
> this problem?
>




More information about the use-livecode mailing list