Re: [gnome-db] GdaSqlBuiler: JOIN AS

Murray Cumming <[email protected]>
Newsgroups gmane.comp.gnome.db
Message-ID <1274478355.22247.3.camel@murrayc-x61>
On Fri, 2010-05-21 at 16:32 +0200, Murray Cumming wrote:
> On Thu, 2010-05-20 at 13:48 +0200, Murray Cumming wrote:
> > Yes, when I specify the alias in my call to
> > gda_sql_builder_select_add_target() and then use the returned ID as
> > the
> > target (instead of the table) when calling
> > gda_sql_builder_select_join_targets() then it works fine. 
> 
> However, I am now hitting this code in gda-sql-builder.c, 
> in gda_sql_builder_select_join_targets():
> 
> 	if (left_pos > right_pos) {
> 		TO_IMPLEMENT;
> 	}
> 
> 
> I don't understand why that's an issue. It happens in this (C++) code:
> 
> const Glib::ustring alias_name = "examplealias";
> const guint to_target_id = 
>   builder->select_add_target(to_table, alias_name);
> 
> builder->select_join_targets(
>   builder->select_add_target(m_relationship->get_from_table()),
>   to_target_id,
>   Gnome::Gda::SQL_SELECT_JOIN_LEFT,
>   builder->add_cond(
>     Gnome::Gda::SQL_OPERATOR_TYPE_EQ,
>     builder->add_id("\"" + from_table + "\".\"" + from_field + "\""),
>     builder->add_id("\"" + alias_name + "\".\"" + to_field + "\"") ) );

I also notice that calling gda_builder_select_add_target() with the same
table name repeatedly (which I do because it's generic code) on the same
GdaSqlBuilder instance results in errors such as this:
  Internal error (Database): table name "albums" specified more than
once

I can probably find a way to avoid doing this, but it would be nice if
this function (and others, I guess) just returned the ID of existing
parts where possible. 


-- 
[email protected]
www.murrayc.com
www.openismus.com
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.