how to destroy ptr?

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Dec 16 21:32:50 CST 2003


on 12/16/03 8:51 PM, Sidney at activeducation at comcast.net wrote:

> Ruslan,
> According to VCSDK_Core.h :
> 
> /** Escape specifed string.
>    If inForRegEx = 1, then escape all symbols used by regex.
>    if inForRegEx = 0, then escape only single quotes.
>    You need destroy returned string. */   <----------- this is my question
> 
> C_EXP const char*    Valentina_EscapeString(
> const char* inStr,
> int inForRegEx );
> 
> Question:
> How should I destroy the returned char ptr? With free() ?
> The compiler complains about freeing a const char *, is this ok?
> I ask because I started have a ptr access problems (first chance
> exceptions) after doing this.

Ops,

This is mistake in docs.
In the C SDK there is no need delete returned strings,
But you must copy them into own buffer immediately.


> Question:
> If I use inForRegEx = 1, is this ok for use in SELECT statements too?

Yes, but note.

You should escape ONLY string constants.

        WHERE fld = 'string to be escaped'
        
There is no need escape the whole sql query string


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list