Re: [gnome-db] GdaSqlStatementSelect->where_cond



Vivien Malerba pisze:

Hi!

> You don't need to quote anything, but you need to to:
> expr->value_is_ident = (gpointer) 0x1;

It throws:
CRITICAL **: gda_sql_identifier_split: assertion `id && *id' failed

Code is more or less:

GValue val = {0, };
g_value_init (&val, G_TYPE_STRING);
g_value_set_string (&val, "2010-01-01 00:00:00");
expr->value = gda_value_new (G_VALUE_TYPE (&val));
g_value_copy (&val , expr->value);
expr->value_is_ident = (gpointer) 0x1;
g_value_unset (&val);
cond->operands = g_slist_append (cond->operands, expr);

g_value_init (&val, G_TYPE_STRING);
g_value_set_string (&val, "");
expr->value = gda_value_new (G_VALUE_TYPE (&val));
g_value_copy (&val , expr->value);
expr->value_is_ident = (gpointer) 0x1;
g_value_unset (&val);
cond->operands = g_slist_append (cond->operands, expr);


Without value_is_ident, sql is generated:

WHERE ( FieldA = 2010-01-01 00:00:00) AND (FieldB = )

> to specify that the GdaSqlExpr holds an SQL identifier.
> See gda_sql_builder_add_id() in
> http://git.gnome.org/browse/libgda/tree/libgda/gda-sql-builder.c

I am not sure we are talking about the same expression value.
I mean vale which is not field name, but value used in condition.


Piotras


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