Re: [gnome-db] GdaSqlQuery: sub-queries



On Mon, 2010-05-17 at 16:38 +0200, Murray Cumming wrote:
> > It's possible using gda_sql_builder_select_add_target_id() with a
> > minor correction I've made,
> > see http://git.gnome.org/browse/libgda/commit/?id=9b8778a08ffad208d8da159643b38d0f61482c6b
> 
> Thanks. Should it work like this?
> 
> GdaSqlBuilder* builder =
>   gda_sql_builder_new (GDA_SQL_STATEMENT_SELECT);
> const guint target_id =
>   gda_sql_builder_add_sub_select(builder, 0,  
>     inner_builder->get_sql_statement());
> gda_sql_builder_select_add_target_id(builder, 
>   target_id);
> gda_sql_builder_add_function(builder, "COUNT", 
>   gda_sql_builder_add_id(builder, "*"));

Ah, I need to call gda_sql_builder_add_field_id() with the result of 
gda_sql_builder_add_function(). It works now. I'll add a hint to the
documentation.

> I'm getting these errors from that, though I haven't tried a simple C
> test case yet:
> "SELECT does not contain any expression"



-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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