Re: Q: gda-clnt/gda-recordset.c



Stephan Heinze wrote:

> hi,
>
> in gda-clnt/gda-recordset.c there is following part of code:
>
> [line 798 and following]
> [----snip-----]
>   rs->corba_rs = GDA_Command_open(cmd->command, corba_parameters,
>               cursor_type, lock_type, &affected, &ev);
>   error_list = gda_errors_from_exception(&ev);
>   if (error_list)
>     {
>       rs->corba_rs = 0;
>       gda_connection_add_errorlist(rs->cnc, error_list);
>       return -1;
>     }
>
>   rs->field_attributes = GDA_Recordset_describe(rs->corba_rs, &ev);
> [----snip-----]
>
> if GDA_Command_open was called with a insert or a delete-statement there
> will be no recordset to deliver and also no error to let us leave the
> function. rs->corba_rs is NULL.
>
> in GDA_Recordset_describe there's no validation for a NULL recordset
> (and the application crashes).
> my question: do I have to deliver an empty recordset in the
> implementation of the server specific command_open method or should
> there be a
> validation in the client function?
>

You should always return a recordset, even if empty. For example, in the
postgres server, when it is a SELECT statement, I fill all the structure
members, but when it is another command, I just return the
Gda_POSTGRES_Recordset with the Postgres API-specific recordset pointer filled
in. The rest should be NULL.

The GDA_Recordset_describe function resides in the gda-stubs.c file, which is
one of the ORBit generated files. So, we should ask for this check to be added
in the ORBit list. (I am sending an email right now).



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]