Re: [gnome-db] API Break Request for gda_insert_row_into_table





2009/1/5 Daniel Espinosa <esodan gmail com>


2009/1/5 Vivien Malerba <vmalerba gmail com>



2008/12/30 Daniel Espinosa <esodan gmail com>
Ok work done (before the next year!!! :-)


Hope the:

gda_repetitive_statement_append_list_values

is Ok, if not feel free to rename it.

Cheers.

And Happy new Year for All!!!

Happy new year to you too!

The INSERT function is Ok for me, but the UPDATE ande DELETE are too limited: you can't specify a different condition for each row you want to update/delete.

I can convert the fix functions parameters to be a GdaHolder parameters, then you can change the condition value for different statements, then I can change the API to:

GdaRepetitiveStatement*
gda_prepare_update_row (const gchar *table_name,

                                            const gchar *condition_column_name,
                                            GType condition_column_type,
                                            GError **error, ...)

Then when you want to change the condition value you will set a GdaHolder named '0+' , and then the values in the .... list GValues. When call gda_*_append_list_values you will need to pass the ConditionValue as the first value in the list and then the values to set.

This is the actual behavor for gda_prepare_delete_row, where (see the documentation at the patch) you will change the '0+' named parameter in order to set the value for the condidition to use.

Or
 


Considering that these functions are convenience functions (this means less functionnality but more easy to use), it looks like the current API is easier to use.

Here is what I propose:
* for the INSERT operation, keep the API as it is now (and remove gda_insert_row_into_table_from_string() function)
* for the UPDATE operation:
gboolean gda_update_table_row (const gchar *table_name,
                                    const gchar *condition_column_name,
                                    const GValue *condition,
                                    GError **error, ...);
where the ... is a list of (column name as string, column's new value as a GValue).
* for the DELETE operation: same as now.

This functions will execute one and only one statement, I can change to this, but may I need to add a

gda_insert_row (GdaConnection *cnc,
                          const gchar *table_name,
                          const gchar *condition_column_name,
                          const GValue, GError **error, ...)

and add the GdaConnection *cnc to the actual functions in the patch, prepare a new one and send it back.

 


If you want to create an API to prepare the execution of several INSERT/UPDATE/DELETE statements (prepare them and execute them all at once), then IMO this should be another set of API (even a more global Libgda API).

This will be a convination of the above options, if so where could be this new API?
 

Sorry for taking so long to stabilize on an API, but it's important the API be the best possible.

Thanks for all,

Vivien

 




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

Hope this isn't too quickly, but I finish my first option (change the gda_insert_row behaivor) find the patch attached to this mail. The patch is the same as the first one, but with the change the the above function.


Cheers.

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

Attachment: PATCH-FlexibleConditionParamenters-Complete.diff.tar.bz2
Description: BZip2 compressed data



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