Re: [gnome-db] libgda samples not ajour
- From: "Vivien Malerba" <vmalerba gmail com>
- To: "Stian Skjelstad" <stian nixia no>
- Cc: gnome-db list <gnome-db-list gnome org>
- Subject: Re: [gnome-db] libgda samples not ajour
- Date: Tue, 21 Nov 2006 09:03:43 +0100
On 11/20/06, Stian Skjelstad <stian nixia no> wrote:
On Mon, 2006-11-20 at 08:53 +0100, Vivien Malerba wrote:
> -> the gda_client_prepare_create_database() call won't work because
> the second argument must be a provider name (for example "Firebird"),
> not a connection string,
How can you tell the name of the database you want to create? (and
parameters?)
As a general note, for any operation, the required/possible parameters
for the action are all listed as named parameters in a
GdaServerOperation (the one you can get with
gda_client_prepare_create_database() or
gda_server_provider_create_operation()).
Parameters in a GdaServerOperation are organized hirearchically and
each has a name which is represented as a path, similar to a UNIX
path. For example, for a CREATE DATABASE operation, you'll always have
a "/DB_DEF_P/DB_NAME" named parameter which contains the name of the
database to create (see libgda's doc about DDL queries). You can then
use gda_server_operation_set_value_at(server_op, value, &error,
"/DB_DEF_P/DB_NAME") to set its value.
The first part of the "/DB_DEF_P/DB_NAME" path is "/DB_DEF_P" which is
the path for a GdaParameterList object which, in this case, contains
the "DB_NAME" GdaParameter parameter object, so you can also set the
name of the database to create using gda_parameter_set_value(param)
where param is obtained using gda_parameter_list_find_param(plist,
"DB_NAME"), and the pointer to the GdaParaleterList object can be
obtained using gda_server_operation_get_node_info(server_op,
"/DB_DEF_P")->plist.
Another way to set the database name is to use gda_parameter_set_value
(gda_server_operation_get_node_info(server_op,
"/DB_DEF_P/DB_NAME")->param, value).
Now to get all the required/optional named parameters in a
GdaServerOperation object, you need to start from the "root" paths
(same as if you did "ls /" on a UNIX file system) using
gda_server_operation_get_root_nodes(), and then explore the paths tree
using gda_server_operation_get_node_info() or
gda_server_operation_get_node_type() in a recursive way. For an
example, look at the extra/demos/ddl_queries.c file in libgnomedb.
If you find the documentation about the GdaServerOperation or about
DDL queries is not complete/easy to understand/whatever, please tell
me or correct it.
Cheers,
Vivien
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]