Re: [gnome-db] What about GdaQuery?



On 3/23/06, Daniel Espinosa <esodan gmail com> wrote:
> I'm trying to create a simple example to a Tutorial in the Wiki, and now I'm
> following the next steps:
>
>  1. Open a GnomeDbLoginDialog, then the user select the Data Source (in the
> Tutorial, the SalesTest default source), the username and the password (in
> SalesTest is leaving with out blanck by the user).
>
>  2. Uses the data from the point 1, to open the connection:
>      a) Create a Client
>      b) Creae a Connection with that client, using the DSN, username and
> password from the GnomeDbLoginDialog
>      c) Check if the connection is opened
>
>  3. Load the XML dict file and update it:

You can create a dictionary using gda_dict_new() and tell it which
connection to use with gda_dict_set_connection(). Then you can load
the dictionary file using a simple gda_dict_load(); no need to try to
figure out the dictionary name.

>      a) Try to open the default XML file: $HOME/.gda/DICT_<data source
> name>_default.xml
>          For SalesTest will be:
> $HOME/.gda/DICT_SalesTest_default.xml
>      b) If the load fails, set the file name using:
> gda_dict_set_xml_filename
>      c) Update the XML dict (in the example, to ensure the integrity of the
> data, before show any data the program updates the Dict)
>          Use the gda_dict_update_dmbs_data
>
>  4. Create a Query:
>      a) Create a Query with a SQL command using: gda_query_new_from_sql

At the moment you need to:
-> if necessary get and fill the parameters to execute the query
-> get the SQL for your query using gda_renderer_render_as_sql(query)
-> create a GdaCommand with that SQL
-> use gda_connection_execute_command() to get a list of GdaDataModel
(or gda_connection_execute_single_command() to get only one model).
-> use the returned data model in a GnomeDbGrid.

It's a bit complex though and I plan to simplify this a bit using a
gda_connection_execute_query() function.

Cheers,

Vivien



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