GNOME Data Access manual |
---|
As we have said before, data is obtained as data models. We can consider it as a representation of the table.
We can access the table at row level or table level. We will focus on row level because it is the most similar to the old version.
As you can see in the example, the access is made with the C style using a for to obtain data from rows and columns.
We talk about table access only saying that the access is made in a very similar way. The only difference is that gda_data_model_get_value_at () returns a const and we have not to free it.
As you can see viewing GdaDataModel class, it has not a free method, so we have to free it using g_object_unref.
Theoretically, you could modify data models and dump changes over the database, but it is not recommended because you might make changes using SQL, so we consider data models not to be modifiable.
There is not exist a function to access columns directly using the column name, but you can obtain its index using gda_data_model_get_column_position (), as you can see in this example:
value=gda_row_get_value(row, gda_data_model_get_column_position(data_model,"id_product"));
<<< Executing commands | Managing errors >>> |