Hi Ross,

On Sun, Aug 30, 2009 at 05:45:39PM -0700, Ross McFarland wrote:
> a follow up to this portion after some more experimenting.
> 
> it actually doesn't seem to be possible to reuse result objects b/c of
> this issue. when i create a result with drizzle_result_create i can't
> call drizzle_result free on it between calls to drizzle_query_str with
> it or else the object i'm using goes away. there doesn't seem to be a
> way get rid of the reference in the connection object without getting
> rid of the result object itself. how would language bindings handle
> this:
> 
> {
>     DrizzleConnection con;
>     DrizzleResult r;
> 
>     ...
> 
>     con.query("select foo", r);
>     ...
>     // there doesn't seem to be anything i can call here to get the reference 
> to
>     // the underlying c object in r to be removed from the object under con's
>     // list
>     con.query("select bar", r);
>     ...
> 
>     // con goes out of scope and double free's result
> }

Just put a drizzle_result_free() in between? You could add a higher
level function:

r.reset();

Which would do any high level cleanup and call drizzle_result_free. If
you want this to not be required, you could do a bit more magic and
in con.query() detect if r is already initialized, and if so, call
drizzle_result_free there. Not clean, but requires nothing extra in
the higher level language.

-Eric

_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to