Re: [gnome-db] Last insert feature request



2007/11/28, Murray Cumming <murrayc murrayc com>:
>
> On Tue, 2007-11-27 at 18:36 -0600, Daniel Espinosa wrote:
> > For today gda_server_provider_get_last_insert_id () returns a gchar*,
> > but what about to return a GdaParameter?
>
> Why not just return a GValue* ?
>

Becouse a GValue doesn't have a "name" property, that could be set to
the field's name used to get the value from. With this name the
developer will know how create the SQL to get the last inserted value,
for example in PostgreSQL:

SELECT * FROM table WHERE oid = 123456;

in other DBMS the field is diferent, then the query must be created
using that field.

>
> > If you return a GdaParameter the implementator will know the data type
> > to return and will set the correct GType and GValue pair to the
> > returned object.
> >
> > Then the developer could use this GdaParameter to find the a value in
> > the database using a query like:
> >
> > SELECT * FROM ## /* name=parameter_name type = parameter_type */ = ##
> > /* name=parameter_value type=parameter_type */
> >
> > This could help when the program insert values in the DB and needs to
> > use it inmediately, and will avoid a DBMS specific hack for each one.
> >
> > Even could exist a
> >
> > GdaDataModel* gda_connection_get_last_inserted
> >
> > This function will use the GdaParameter returned by the
> > gda_server_provider_get_last_insert_id function to return a
> > GdaDataModel with just one row with the last inserted row in the DB.
> >
> > The new function could be called:
> >
> > GdaParameter* gda_server_provider_get_last_inserted_id
> > (GdaServerProvider* provider)
> >
> > in order to avoid API break in the 3.x series.
> >
> --
> murrayc murrayc com
> www.murrayc.com
> www.openismus.com
>
>


-- 
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]