Re: [gnome-db] GdaSqlStatementSelect->where_cond

Vivien Malerba <[email protected]>
Newsgroups gmane.comp.gnome.db
Message-ID <[email protected]>
On 26 February 2010 15:59, Piotr Pokora <[email protected]> wrote:
> Vivien Malerba pisze:
>
> Hi!
>
>>> I am looking at GdsSqlStatementSelect diagram and hardly find how to set
>>> multiple where conditions to Statement structure.
>>
>> You can only specify one GdaSqlExpr as the WHERE condition (the
>> GdaSqlStatementSelect::where_cond), so if you need several condition,
>> you need to create a GdaSqlExpr which acts as the "top level" AND or
>> OR operation. There are various example in Libgda's code which
>> illustrate how to set this up.
>
> What about expr->value of type string? Should I quote it explicitly?
> gda_sql_identifier_add_quotes add double quotes, so I assume I should
> take care of strings and quote them before setting expression value.

You don't need to quote anything, but you need to to:
expr->value_is_ident = (gpointer) 0x1;
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

BTW, you should not use gda_sql_identifier_add_quotes() as it's marked
as deprecated.

Vivien
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.