Re: [gnome-db] libgda-ui read-write





On 1 February 2012 14:12, Kirill Scherba <kiriushka gmail com> wrote:
Hi,

I have try to use libgda-ui read-write form.
I have an error in function 'gda_data_select_compute_modification_statements': Can't get the prepared statement's actual statement. My SQL table is simple and my code is simmilar to the  gdaui-demo-5.0 sample.
What's wrong?

Could be a bug in the database provider, which one are you using? It would help if could send me the part of your code which deals with this so I can reproduce it myself.
 

I have looked to the gda_data_select_set_modification_statement () and can't understand how to write SQL request for mod_stmt parameter - what format etc...   ??


The doc is not very good on this, I obviously need to improved on that point... Anyway, the rule when creatin an INSERT, UPDATE or DELETE statement is to use variables named "[+-]<column_number>" where the "+" will be mapped to new value in the data model at column <column_number> and the "-" will be mapped to existing values.

For example the "+1" variable will be set to the new value of the second column (since numbering start at 0), and "-3" will be set to the existing value of the 4th column.

For example an INSERT will look like "INSERT INTO mytable (id, name, when) VALUES (##+0::int, ##+1::string, 'now')" and the DELETE will be like "DELETE from mytable WHERE id=##-0::int" (assuming for example that the "mytable" table has a PK defined as the ID column).
 
When the INSERT, UPDATE and DELETE statements are defined, the data model is made writable and everytime it is modified, the corresponding statement is executed.

You can use gda_data_select_set_modification_statement_sql() or gda_data_select_set_modification_statement() to set an UPDATE, DELETE or INSERT statement.

To study it I have used libgda documentation at the http://developer.gnome.org/libgda/5.0/, and examples from the libgda-5.0.2 sources pacage. Is there any other documentation and some examples about my questions??

Not that I know of.

Regards,

Vivien


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