Re: [gnome-db] GdaDataModel statement type



On 15 March 2010 11:54, Piotr Pokora <piotrek pokora gmail com> wrote:
> Vivien Malerba pisze:
>
> Hi!
>
>>> Is it possible to change GdaDataModel's statement type?
>>> I have model created by gda_connection_statement_execute_select, and
>>> want to set values and reuse it with update statement.
>>
>> You have to set the update statement using
>> gda_data_select_set_modification_statement(), but maybe I understand
>> wrongly your needs (if that is the case, can you explain it using for
>> exampe pseudo code?)
>
> 1. GdaDataModel model = gda_connection_statement_execute_select(...)
>
> /* User level actions which reads/writes model data, as it is used as
> underlying data storage */
> 2. gda_data_model_set_value_at (model, n, y, NULL);
>
> 3. update or delete or nothing
>
> gda_data_select_set_modification_statement would do the trick, but in
> such scenario I need to set values which are held by model before I
> actually may create particular GdaStatement.
>
> In other words. GdaDataModel is used as persistent (in memory) data
> storage, so I avoid duplicating its values when user needs read/write.
>
> Copying DataModel is not an option cause it's real performance bottleneck.

For a GdaDataModel issued by the execution of a SELECT statement (a
GdaDataSelect):
* you can call gda_data_model_set_value_at() only if a modification
statement has been defined for it (using
gda_data_select_set_modification_statement() or similar), otherwise
you'll get an error
* when modified, the modifications are done synchronously: the
modification statement is executed when one calls
gda_data_model_set_value_at()

If you need some behaviour which cannot be done using these rules,
then you may have to implement your own GdaDataModel (it's actually
only an interface) to suit your needs, or handle the INSERT, UPDATE or
DELETE operations yourself and not modify the GdaDataSelect.

Vivien


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