Re: [gnome-db] Row Inserting: How to?





2006/9/15, Vivien Malerba <vmalerba gmail com>:
On 9/15/06, Daniel Espinosa <esodan gmail com> wrote:
> I'm try to insert a row in a table I used the following code in an SQLite
> provider and it doesn't work:
>
> 1. Add a row using gda_data_model_append_row
>
> 2. Set each column's value using the returned row using
> gda_data_model_set_value_at (But says it isn't implemented)
>
>
> Then, how can I add a row to a GdaDataModel, using a procedures supported by
> *all* the prividers?

Use a GdaDataModelQuery data model (see extra/gnome-db-browser.c,
function table_view_contents()). Note that I'm currently improving it
so that it'll create the modifications queries when they are easy to
create.

>
> If I use the gda_data_model_append_values, the GList must be sorted to allow
> the procedure finds the correct value for the column's number?

Yes.

I have created a funtion gda_row_insert(GdaDataModel*, GError*, ...)

It can recive the *name* of the column and its *value* as strings; it sort the values and fill the ones missing as a GValue (a unset value created by g_new0(GValue, 1) ). I can print all the values and could check it sorts them in the correct way to call gda_data_model_append_values, but it *doesn't work*, it don't return an error or -1 and  if I print to the consol the content of the table afected the row doesn't exist!!
 
Do I miss understand the way to insert a row using the API? exist another way? I'm using the following procedure:

1- create a GList with the values (or an unset GValue representing a NULL one)
2. call gda_data_model_append_values, using that GList




--
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (entrámite, pero para los cuates: LIBRE)

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