Re: [gnome-db] Drop Table... How to?



On 9/14/06, Daniel Espinosa <esodan gmail com> wrote:
Could any help me in the XML file required to DROP a table in the data base,
this is in order to implement gda_drop_table, a convenient function to drop
tables in a data base using just its name and a connection object as
arguments.


Here is how to proceed:
1) obtain a GdaServerOperation object using
gda_server_provider_create_operation()
2) Fill the values in that object
3) use gda_server_provider_perform_operation() to actually do the action

Now, the 1st and 3rd steps are very easy. The 2nd step is a bit more
difficult...
First for a global overview, please see the libgda's documentation
section "Data definition (DDL) queries" which gives an overview of the
GdaServerOperation usage.

At the moment the easiest way to set the values in the
GdaServerOperation object is to create an XML file and call
gda_server_operation_load_data_from_xml(). I plan to add a
gda_server_operation_set_value_at() ASAP which will enable the user to
set individual values by their name.

Now about the XML file, there is no documentation about it but there
is a DTD and the sytax is very simple. For example:
<?xml version="1.0"?>
<serv_op_data>
<op_data path="/TABLE_DESC_P/TABLE_NAME">mytable</op_data>
</serv_op_data>
will set the value named "/TABLE_DESC_P/TABLE_NAME" to the string
"mytable" which is what you will have to do for the DROP TABLE.

To have more examples of such XML files, use the
"testing/test-dyn-widgets -t 15" program in libgnomedb and click on
the "Dump" button.

Now about the values in a GdaServerOperation, the tables in libgda's
documentation mention, for each type of operation, what values are
required along with their name, but in the end it's each provider
which sets what values a GdaServerOperation will contain, and in
particular a provider may require more values (more information) than
the minimum listed in the doc. Just to illustrate this propos, I'll
take the example of the DROP DATABASE operation. The minimum required
information listed in the doc is the database name, but a provider
usually needs more information than that (such as the server name,
etc).

I hope this helps you get started, and if not don't hesitate to
ask/write better documentation.

Cheers,

vivien



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