database write error

Bob Sneidar bobs at twft.com
Tue Jan 31 12:00:10 EST 2012


Escape your data first. I am sure someone has written an SQL escape library. Another way might be to encode your data before inserting/updating and decode it in your select statements. sqlYoga automagically escapes your data for you if you use the commands and functions provided. (I should get some kind of retainer from Trevor. ;-)

Bob


On Jan 30, 2012, at 11:50 PM, 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?
> 
> The code I am using looks like this:
> 
> put "INSERT INTO master (delivery_date, mothers_name, mothers_phin,
> mothers_mhsc, mothers_dob, care_provider, note)" & \
> merge("VALUES ('[[globaldate]]', '[[tmaternalname]]', '[[tmaternalphin]]',
> '[[tmaternalmhsc]]', " & \
>           "'[[tmaternaldob]]', [[tcareprovider]]', '[[tnote]]')") into tCmd
> revExecuteSQL gConnectID, tCmd
> 
> Thanks
> -- Mark
> 
> 
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/database-write-error-tp4343759p4343759.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