Hi all,
Just a note to say that from what I see in this source code, this would
also work with MS SQL Server (doubling single quotes instead of using
backslashes as escape).
Cheers,
Jerome
On Thu, 2007-06-21 at 14:31 +0300, Papadopoulos Georgios wrote:
Hello Henning
I just needed something quick and dirty so I just added the following
function and used it instead of escape_common. This works fine with
Oracle.
int sql_escape(char *dst, char *src, int src_len)
{
int i, j;
if(dst==0 || src==0 || src_len<=0)
return 0;
j = 0;
for(i=0; i<src_len; i++)
{
switch(src[i])
{
case '\'':
dst[j++] = '\'';
dst[j++] = src[i];
break;
default:
dst[j++] = src[i];
}
}
return j;
}
It would be nice to add this as a configuration parameter in the future.