Storing and retrieving data from a SQL database

Paul Dupuis paul at researchware.com
Wed May 18 20:16:17 EDT 2016


Does anyone have some really good (comprehensive) routines to escape and
unescape text data for storing in a SQL database (like SQLite or MySQL)

basics like:
replace cr with "\n" in pText -- replace any cr with "\n" for new line
replace tab with "\t" in pText-- replace tabs with "\t"
replace "'" with "\'" in pText-- replace single quotes with an escaped
single quote
replace quote with backslash&quote in pText-- replace double quote with
escaped double quote


but I expect I am missing some characters that SQL manuals say should be
escaped. What about slash itself? And do you unescaped them in the same
order you escape them or reverse order or does the order matter?

I could Google the manuals, write some code, test it and revise until
I've found all the characters and got the order to escape and unescape
down correctly, but I figure someone else may have already done this
comprehensively and be willing to share their code?









More information about the use-livecode mailing list