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



At moment most of the functionality is already present in GDA a la GObject, even the Gda# bindings use similar sintaxis to work in a table (a GdaDataModel). API needs some convenient functions to allow new developers to use GDA and GnomeDb in a easiest way.

At moment I'm testing the following function:

gboolean               gda_create_table            (GdaConnection *cnn, const gchar *table_name, gint num_columns, GError **error, ...);

inside it is creating the XML file required by the server operation and performs the operation; returns TRUE if sucessfull, FALSE instead.

The convenient functions will be a way to allow new developers to use GDA as they use in other languages frameworks like PHP or others (consider that GDA is in C, if the corresponding binding is present, you'll have the oportunity to use this functions and the GDA's API directly in you prefered language).

The complate list of convenient functions are (work in process):

GdaConnection*         gda_open_connection         (const gchar *dsn,
                                                    const gchar *username,
                                                    const gchar *password,
                                                    GdaConnectionOptions options,
                                                    GError **error);
GdaDataModel*          gda_execute_select_command  (GdaConnection *cnn, const gchar *sql, GError **error);
gint                   gda_execute_sql_command     (GdaConnection *cnn, const gchar *sql, GError **error);

gboolean               gda_create_table            (GdaConnection *cnn, const gchar *table_name, gint num_columns, GError **error, ...);
gboolean               gda_drop_table              (GdaConnection *cnn, const gchar *table_name, GError** error);
                                                       
const GValue*          gda_get_value               (GdaDataModel *model, const gchar *column_name, long row);
gboolean               gda_update_value            (GdaDataModel *model, const gchar *column_name, long row, const GValue *new_value, GError **error);

gboolean               gda_insert_row               (GdaDataModel *model, GError **error, ...);
#define gda_remove_row(model, row, error) (gda_data_model_remove_row (model, row, error))

Status:

gda_open_connection                  WORKING
gda_execute_select_command    WORKING
gda_execute_sql_command        IMPLEMENTING
gda_create_table                       TESTING
gda_drop_table                          IMPLEMENTING
gda_get_value                           WORKING
gda_update_value                      IMPLEMENTING
gda_insert_row                          IMPLEMENTING
gda_remove_row                       (macro)


2006/9/15, Vivien Malerba < vmalerba gmail com>:
On 9/15/06, Diego Zuccato < diego otello alma unibo it> wrote:
> Vivien Malerba wrote:
> > Now about the XML file, there is no documentation about it but there
> > is a DTD and the sytax is very simple. For example:
> What I really don't understand is "why XML?".

As I mentionned it's a convenient way of doing things till there I
implement the proper API to do it more easily (which I'm currently
doing BTW). XML is just a convenient way to storing and loading data
in a GdaServerOperation object.

> IMVHO converting some binary data structure to text, then back to binary
> is quite an inefficient way to comunicate inside a library.
>
> I'd prefer a lot something based on GObject, so I can handle directly
> the objects. Like in Gtk when you have to build a treeview, just to give
> an idea of what I mean.
>
> In pseudo-OO:
>
> db=new Db(provider, host, port, ...);
> newtable=db.table.new ("tablename");
> newtable.column.new("col1", G_TYPE_INT); // auto-conversion from gtypes
> newtable.column.new("col2", "sequence"); // user-supplied type
> newtable.index.new ("idx", "col1", "col2", -1);
> newtable.commit(); // Actually execute "CREATE TABLE"

Yes, I agree with that, Daniel?

Cheers,

Vivien
_______________________________________________
gnome-db-list mailing list
gnome-db-list gnome org
http://mail.gnome.org/mailman/listinfo/gnome-db-list



--
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (entrámite, pero para los cuates: LIBRE)

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