Re: [gnome-db] Holder names
- From: Vivien Malerba <vmalerba gmail com>
- To: Johannes Schmid <jhs jsschmid de>
- Cc: gnome-db-list <gnome-db-list gnome org>
- Subject: Re: [gnome-db] Holder names
- Date: Fri, 23 Jan 2009 21:08:06 +0100
2009/1/23 Johannes Schmid
<jhs jsschmid de>
Hi!
Consider this query:
INSERT INTO "contacts" (contact_id, name_first, name_middle, name_last,
name_title, address_street, address_town, address_state,
address_country, address_postcode, date_of_birth, comments, name_full,
picture, email, website, tel_home, tel_work, tel_mobile, tel_fax) VALUES
(##param0::GdaNumeric, ##param1::gchararray, ##param2::gchararray,
##param3::gchararray, ##param4::gchararray, ##param5::gchararray,
##param6::gchararray, ##param7::gchararray, ##param8::gchararray,
##param9::gchararray, ##param10::GDate, ##param11::gchararray,
##param12::gchararray, ##param13::GdaBinary, ##param14::gchararray,
##param15::gchararray, ##param16::gchararray, ##param17::gchararray,
##param18::gchararray, ##param19::gchararray)
According to my understanding get_parameters() should give me the
GdaHolders named "param0" to "param19" but it seems it gives me the
holders contact_id, name_first, name_middle, etc.
You should normally have parameters with param0 to param19 IDs. This is what I get from the code attached:
Holder param0
Holder param1
Holder param2
Holder param3
Holder param4
Holder param5
Holder param6
Holder param7
Holder param8
Holder param9
Holder param10
Holder param11
Holder param12
Holder param13
Holder param14
Holder param15
Holder param16
Holder param17
Holder param18
Holder param19
Do you have some code which shows the problem?
Cheers,
Vivien
#include <libgda/libgda.h>
#include <sql-parser/gda-sql-parser.h>
int main()
{
gda_init();
GdaSqlParser *parser = gda_sql_parser_new ();
GdaStatement *stmt;
const gchar *remain = NULL;
stmt = gda_sql_parser_parse_string (parser, "INSERT INTO \"contacts\" (contact_id, name_first, name_middle, name_last, name_title, address_street, address_town, address_state, address_country, address_postcode, date_of_birth, comments, name_full, picture, email, website, tel_home, tel_work, tel_mobile, tel_fax) VALUES (##param0::GdaNumeric, ##param1::gchararray, ##param2::gchararray, ##param3::gchararray, ##param4::gchararray, ##param5::gchararray, ##param6::gchararray, ##param7::gchararray, ##param8::gchararray, ##param9::gchararray, ##param10::GDate, ##param11::gchararray, ##param12::gchararray, ##param13::GdaBinary, ##param14::gchararray, ##param15::gchararray, ##param16::gchararray, ##param17::gchararray, ##param18::gchararray, ##param19::gchararray)", &remain, NULL);
g_assert (stmt);
g_assert (!remain);
g_object_unref (parser);
GdaSet *params;
g_assert (gda_statement_get_parameters (stmt, ¶ms, NULL));
g_object_unref (stmt);
GSList *list;
for (list = params->holders; list; list = list->next) {
GdaHolder *holder = GDA_HOLDER (list->data);
g_print ("Holder %s\n", gda_holder_get_id (holder));
}
g_object_unref (params);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]