![]() |
![]() |
![]() |
GNOME Data Access 3.0 manual | ![]() |
---|---|---|---|---|
GdaQueryJoin; enum GdaQueryJoinType; GdaQueryJoin* gda_query_join_new_with_targets (GdaQuery *query, GdaQueryTarget *target_1, GdaQueryTarget *target_2); GdaQueryJoin* gda_query_join_new_with_xml_ids (GdaQuery *query, const gchar *target_1_xml_id, const gchar *target_2_xml_id); GdaQueryJoin* gda_query_join_new_copy (GdaQueryJoin *orig, GHashTable *replacements); void gda_query_join_set_join_type (GdaQueryJoin *join, GdaQueryJoinType type); GdaQueryJoinType gda_query_join_get_join_type (GdaQueryJoin *join); GdaQuery* gda_query_join_get_query (GdaQueryJoin *join); GdaQueryTarget* gda_query_join_get_target_1 (GdaQueryJoin *join); GdaQueryTarget* gda_query_join_get_target_2 (GdaQueryJoin *join); void gda_query_join_swap_targets (GdaQueryJoin *join); gboolean gda_query_join_set_condition_from_fkcons (GdaQueryJoin *join); gboolean gda_query_join_set_condition_from_sql (GdaQueryJoin *join, const gchar *cond, GError **error); gboolean gda_query_join_set_condition (GdaQueryJoin *join, GdaQueryCondition *cond); GdaQueryCondition* gda_query_join_get_condition (GdaQueryJoin *join); const gchar* gda_query_join_render_type (GdaQueryJoin *join);
"query" GdaQuery* : Read / Write / Construct Only "target1" GdaQueryTarget* : Read / Write "target1-id" gchar* : Write "target2" GdaQueryTarget* : Read / Write "target2-id" gchar* : Write
This object is a join, within a SELECT query, between two different entities participating in the query; the entoties are themselves represented by GdaQueryTarget objects. It is important to specify joinning conditions as joins and not simply as WHERE conditions because the joins carry more information than a simple condition and because some features of Libmergeant rely on the joins analysis.
It implements the GdaXmlStorage and GdaReferer interfaces.
typedef enum { GDA_QUERY_JOIN_TYPE_INNER, GDA_QUERY_JOIN_TYPE_LEFT_OUTER, GDA_QUERY_JOIN_TYPE_RIGHT_OUTER, GDA_QUERY_JOIN_TYPE_FULL_OUTER, GDA_QUERY_JOIN_TYPE_CROSS, GDA_QUERY_JOIN_TYPE_LAST } GdaQueryJoinType;
GdaQueryJoin* gda_query_join_new_with_targets (GdaQuery *query, GdaQueryTarget *target_1, GdaQueryTarget *target_2);
Creates a new GdaQueryJoin object. Note: the GdaQueryTarget ranks (1st and 2nd) does not matter, but is necessary since the join may not be symetrical (LEFT or RIGHT join). Also, the GdaQueryJoin object may decide to swap the two if necessary.
|
a GdaQuery object in which the join will occur |
|
the 1st GdaQueryTarget object participating in the join |
|
the 2nd GdaQueryTarget object participating in the join |
Returns : |
the new object |
GdaQueryJoin* gda_query_join_new_with_xml_ids (GdaQuery *query, const gchar *target_1_xml_id, const gchar *target_2_xml_id);
Creates a new GdaQueryJoin object. Note: the GdaQueryTarget ranks (1st and 2nd) does not matter, but is necessary since the join may not be symetrical (LEFT or RIGHT join). Also, the GdaQueryJoin object may decide to swap the two if necessary.
|
a GdaQuery object in which the join will occur |
|
the 1st GdaQueryTarget object's XML id participating in the join |
|
the 2nd GdaQueryTarget object's XML id participating in the join |
Returns : |
the new object |
GdaQueryJoin* gda_query_join_new_copy (GdaQueryJoin *orig, GHashTable *replacements);
Copy constructor
|
a GdaQueryJoin to make a copy of |
|
a hash table to store replacements, or NULL
|
Returns : |
a the new copy of orig
|
void gda_query_join_set_join_type (GdaQueryJoin *join, GdaQueryJoinType type);
Sets the type of join
|
a GdaQueryJoin object |
|
the new type of join |
GdaQueryJoinType gda_query_join_get_join_type (GdaQueryJoin *join);
Get the type of a join
|
a GdaQueryJoin object |
Returns : |
the type of join
|
GdaQuery* gda_query_join_get_query (GdaQueryJoin *join);
Get the GdaQuery to which join
is attached to
|
a GdaQueryJoin object |
Returns : |
the GdaQuery |
GdaQueryTarget* gda_query_join_get_target_1 (GdaQueryJoin *join);
Get the 1st GdaQueryTarget participating in the join
|
a GdaQueryJoin object |
Returns : |
the GdaQueryTarget |
GdaQueryTarget* gda_query_join_get_target_2 (GdaQueryJoin *join);
Get the 2nd GdaQueryTarget participating in the join
|
a GdaQueryJoin object |
Returns : |
the GdaQueryTarget |
void gda_query_join_swap_targets (GdaQueryJoin *join);
Changes the relative roles of the two GdaQueryTarget objects. It does not change the join condition itself, and is usefull only for the internals of the GdaQuery object
|
a GdaQueryJoin object |
gboolean gda_query_join_set_condition_from_fkcons (GdaQueryJoin *join);
Creates a GdaQueryCondition for join
using the foreign key constraints
present in the database if the two targets join
joins are database tables
(GdaDictTable objects).
If there is more than one FK constraint between the database tables, then no join is created, and the call returns FALSE.
|
a GdaQueryJoin object |
Returns : |
TRUE if suitable foreign keys were found and a join condition has been created |
gboolean gda_query_join_set_condition_from_sql (GdaQueryJoin *join, const gchar *cond, GError **error);
Parses cond
and if it represents a valid SQL expression to be join
's
condition, then set it to be join
's condition.
|
a GdaQueryJoin object |
|
a SQL expression |
|
place to store the error, or NULL
|
Returns : |
a TRUE on success |
gboolean gda_query_join_set_condition (GdaQueryJoin *join, GdaQueryCondition *cond);
Sets cond
to be join
's condition. This is possible only if cond
uses
query fields which are either of type GdaQueryFieldField and reference one of the two
targets which join
uses, or any other query field type.
|
a GdaQueryJoin object |
|
a GdaQueryCondition object, or NULL to remove the join's condition
|
Returns : |
TRUE if no error occurred |
GdaQueryCondition* gda_query_join_get_condition (GdaQueryJoin *join);
Get the join's associated condition
|
a GdaQueryJoin object |
Returns : |
the GdaQueryCondition object |
const gchar* gda_query_join_render_type (GdaQueryJoin *join);
Get the SQL version of the join type ("INNER JOIN", "LEFT JOIN", etc)
|
a GdaQueryJoin object |
Returns : |
the type as a const string |
"condition-changed"
signalvoid user_function (GdaQueryJoin *gdaqueryjoin, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"type-changed"
signalvoid user_function (GdaQueryJoin *gdaqueryjoin, gpointer user_data) : Run First
|
the object which received the signal. |
|
user data set when the signal handler was connected. |