libgda: 0.8.193
postgres: 7.2.1
I am trying to run a simple parameterized (is there even a word like that?)
query and expected this to do the trick, however the GdaParameterList
argument to gda_connection_execute_single_command seem to be ignored
as model contains my full table after running this piece of code. Did I miss
something here?
// initialize db
// [...]
int id = 1;
GdaCommand *c = gda_command_new("select id, name from accounts", GDA_COMMAND_TYPE_SQL, GDA_COMMAND_OPTION_STOP_ON_ERRORS);
GdaValue *v = gda_value_new_integer(id);
GdaParameter *p = gda_parameter_new("id", GDA_VALUE_TYPE_INTEGER);
gda_parameter_set_value(p, v);
GdaParameterList *pl = gda_parameter_list_new();
gda_parameter_list_add_parameter(pl, p);
GdaDataModel *model = gda_connection_execute_single_command(db.get_connection(), c, pl);
Trial and error suggests that GdaParameterList takes ownership of GdaParameter
upon gda_parameter_list_add_parameter(), that should probably be documented in
libgda-gda-parameter.html.
It would also be nice if a paragraph on g_object_unref could be added to the
tutorial, most other objects have a free function while model is an exception
and use g_object_unref(). Perhaps a note could be added in the
libgda-gdadatamodel.html as well?
Btw, the latest revision of the html docs are really nice!
/Allan
--
Allan Wind
P.O. Box 2022
Woburn, MA 01888-0022
USA
Attachment:
pgp8DujwZqWNk.pgp
Description: PGP signature