• Welcome to SQLitening Support Forum. Please login.
 
May 23, 2022, 11:47:30 PM

News:

Welcome to the SQLitening support forums!


slBuildInsertOrUpdate question

Started by D. Wilson, January 21, 2011, 06:25:08 PM

Previous topic - Next topic

D. Wilson

I use the slBuildInsertOrUpdate function.
The question I have is embedded single quotes. Will the slBuildInsertOrUpdate function already handle embedded single quotes or do I need to 'double' them myself.
If my understanding is correct I only need to 'double' the single quote is when I am writing my own sql statement.

Fred Meier

January 21, 2011, 07:45:20 PM #1 Last Edit: January 21, 2011, 09:03:13 PM by Fred Meier
Yes, slBuildInsertOrUpdate will handle embedded single quotes:
QuoteAlpha values will have all embedded single quotes changed to two single quotes and they will be enclosed within single quotes.  If an alpha value is already enclosed in single quotes then it will NOT be modified.

Bern Ertl

Hmm.... Has anyone tested this lately?  I'm using a slBuildInsertOrUpdate call that builds the parameters using a few string variables.  One of them contained a string with an embedded single quote and it did not get escaped/doubled.  It caused the resulting SQL statement to be FUBARed.

Bern Ertl

Oh heck.  Nevermind.  The problem wasn't in slBuildInsertOrUpdate.  I was calling slSelStr after my insert and I need to manually escape the single quotes in that call.