UPDATE SQL-DB maker Errors
Sarah Reichelt
sarah.reichelt at gmail.com
Sun Feb 4 16:42:00 EST 2007
> I´m Using RR 2.7.4 and MySQL 4.1
>
> I try to update an existing record with
> put "UPDATE post SET Mail_body =" & Mail_text & "' where lfdnr = " &
> Mail_Number into SQL_Befehl
> revexecute DB_ID SQL_Befehl
>
>
> Sometimes it works, sometimes not. So I found out, if the Mail_Text includes
> one " or ' the datas will not be Updated. OK, But, and that´s the question,
> How to solve the problem without changing the data to base64, because that
> seems to be a global problem an it makes no sense to convert all fields in
> my DB.
>
You need to "escape" the quotes in your text before using them in the
UPDATE. This should work:
replace quote with "\" & quote in Mail_text
replace "'" with "\'" in Mail_text
Then do your UPDATE as above and SQL will handle the single & double
quotes without any problem.
Cheers,
Sarah
More information about the use-livecode
mailing list