[OpenSER-Users] RE: [Users] unixodbc: use_escape_common
Jerome Martin
jmartin at longphone.fr
Thu Jun 21 13:55:10 CEST 2007
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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/users/attachments/20070621/b12bd75d/attachment.htm
More information about the Users
mailing list