Re: [gnome-db] Database widget

> Hi,
> I need a widget like a gtk table that gets filled with
> data from an SQL database (postgresql), and has update/delete/add
> buttons on each row that can update the database after changing
> any data in the table cells (gtk entry or gtk label or gtk combobox).
> Is libmergeant suitable for this?

Yes, the MgWorkGrid widget does this. You just need to give it a MgQuery
object representing the SELECT query you use in the mg_work_grid_new() ,
and it will do all the work by itself.

The widget must the be "run" (where it will actually run the select query)
using the mg_work_widget_run() function (MgWorkGrid implements the
MgWorkWidget interface). The "mode" argument is an OR'ed list of
attributes which can be found in the mg-enums file.

There may still be some bugs, and so it's wiser if you put
MG_ACTION_ASK_CONFIRM_DELETE in the "mode" argument of
mg_work_widget_run(), so it will ask a confirmation of every query to be
sent to the DBMS before it is actually sent.

You can look in the extra/mg-db-browser.c file for smoe example.

Make sure you use the libmergeant sources which are included in the
mergeant CVS module, and not directly the liblergeant CVS module which is
out-dated and should be removed.



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