libgdamm Reference Documentation
Main Page   Namespaces   Book  

Gnome::Gda::Query Class Reference

Represents any kind of DML query. More...

Inheritance diagram for Gnome::Gda::Query:

Inheritance graph
[legend]

List of all members.

Public Member Functions

Glib::RefPtr<QueryFieldadd_field_from_sql (const Glib::ustring& field)
 Parses field and if it represents a valid SQL expression for a field, then add it to query.
bool add_join (const Glib::RefPtr<QueryJoin>& join)
 Add a join to query.
void add_param_source (const Glib::RefPtr<DataModel>& param_source)
 Tells query that param_source is a query which potentially will constraint the possible values of one or more of query's parameters.
void add_sub_query (const Glib::RefPtr<Query>& sub_query)
 Add sub_query to query.
bool add_target (const Glib::RefPtr<QueryTarget>& target)
 Adds a target to query.
void append_condition (const Glib::RefPtr<QueryCondition>& cond, bool append_as_and=true)
 Appends the cond object to query's condition.
void del_join (const Glib::RefPtr<QueryJoin>& join)
 Removes join from query.
void del_param_source (const Glib::RefPtr<DataModel>& param_source)
 Tells query that it should no longer take care of param_source.
void del_sub_query (const Glib::RefPtr<Query>& sub_query)
 Removes sub_query from query.
void del_target (const Glib::RefPtr<QueryTarget>& target)
 Removes target from query.
Glib::RefPtr<Objectexecute (const Glib::RefPtr<ParameterList>& params, bool iter_model_only_requested=false)
 Executes query and returns Gda::DataModel if query's execution yields to a data set, or a Gda::ParameterList object otherwise, or 0 if an error occurred.
Glib::SListHandle
<Glib::RefPtr<QueryField>> 
expand_all_field (const Glib::RefPtr<QueryTarget>& target)
 Converts each visible "target.*" (Gda::QueryFieldAll) field into its list of fields.
Glib::SListHandle
< Glib::RefPtr< const
QueryField > > 
get_all_fields () const
 Fetch a list of all the fields of query: the ones which are visible, and the ones which are not visible and are not internal query fields.
Glib::SListHandle
<Glib::RefPtr<QueryField>> 
get_all_fields ()
 Fetch a list of all the fields of query: the ones which are visible, and the ones which are not visible and are not internal query fields.
Glib::RefPtr< const
QueryCondition
get_condition () const
 Get the query's associated condition.
Glib::RefPtr<QueryConditionget_condition ()
 Get the query's associated condition.
Glib::RefPtr<const QueryFieldget_field_by_param_name (const Glib::ustring& param_name) const
Glib::RefPtr<QueryFieldget_field_by_param_name (const Glib::ustring& param_name)
Glib::RefPtr<const QueryFieldget_field_by_ref_field (const Glib::RefPtr<QueryTarget>& target, const Glib::RefPtr<EntityField>& field, QueryFieldState field_state) const
 Finds the first Gda::QueryField object in query which represents ref_field.
Glib::RefPtr<QueryFieldget_field_by_ref_field (const Glib::RefPtr<QueryTarget>& target, const Glib::RefPtr<EntityField>& ref_field, QueryFieldState field_state)
 Finds the first Gda::QueryField object in query which represents ref_field.
Glib::RefPtr<const QueryFieldget_field_by_sql_naming (const Glib::ustring& sql_name) const
Glib::RefPtr<QueryFieldget_field_by_sql_naming (const Glib::ustring& sql_name)
Glib::SListHandle
< Glib::RefPtr< const
QueryField > > 
get_fields_by_target (const Glib::RefPtr<QueryTarget>& target, bool visible_fields_only=true) const
 Get a list of all the Gda::QueryField objects in query which depent on the existance of target.
Glib::SListHandle
<Glib::RefPtr<QueryField>> 
get_fields_by_target (const Glib::RefPtr<QueryTarget>& target, bool visible_fields_only=true)
 Get a list of all the Gda::QueryField objects in query which depent on the existance of target.
Glib::RefPtr<const QueryFieldget_first_field_for_target (const Glib::RefPtr<QueryTarget>& target) const
 Finds the first occurence of a Gda::QueryFieldField object whose target is target in query.
Glib::RefPtr<QueryFieldget_first_field_for_target (const Glib::RefPtr<QueryTarget>& target)
 Finds the first occurence of a Gda::QueryFieldField object whose target is target in query.
Glib::RefPtr<const QueryJoinget_join_by_targets (const Glib::RefPtr<QueryTarget>& target1, const Glib::RefPtr<QueryTarget>& target2) const
 Find a join in query which joins the target1 and target2 targets.
Glib::RefPtr<QueryJoinget_join_by_targets (const Glib::RefPtr<QueryTarget>& target1, const Glib::RefPtr<QueryTarget>& target2)
 Find a join in query which joins the target1 and target2 targets.
Glib::SListHandle
< Glib::RefPtr< const
QueryJoin > > 
get_joins () const
 Get a list of all the joins used in query.
Glib::SListHandle
<Glib::RefPtr<QueryJoin>> 
get_joins ()
 Get a list of all the joins used in query.
Glib::SListHandle
< Glib::RefPtr< const
QueryCondition > > 
get_main_conditions () const
 Makes a list of all the conditions (part of the WHERE clause) which are always verified by query when it is executed.
Glib::SListHandle
<Glib::RefPtr<QueryCondition>> 
get_main_conditions ()
 Makes a list of all the conditions (part of the WHERE clause) which are always verified by query when it is executed.
int get_order_by_field (const Glib::RefPtr<QueryField>& field, bool& ascendant) const
int get_order_by_field (const Glib::RefPtr<QueryField>& field) const
Glib::SListHandle
<Glib::RefPtr<const Query>> 
get_param_sources () const
 Get a list of the parameter source queries that are references as such by query.
Glib::RefPtr<const ParameterListget_parameter_list () const
 Like the get_parameters() method, get a list of parameters which the query accepts, except that the parameters are stored within a Gda::ParameterList object, and can be used as an argument to the execute() method.
Glib::RefPtr<ParameterListget_parameter_list ()
 Like the get_parameters() method, get a list of parameters which the query accepts, except that the parameters are stored within a Gda::ParameterList object, and can be used as an argument to the execute() method.
Glib::SListHandle
<Glib::RefPtr<Parameter>> 
get_parameters ()
 Get a list of parameters which the query accepts.
Glib::RefPtr<const Queryget_parent_query () const
 Get the parent query of query.
Glib::RefPtr<Queryget_parent_query ()
 Get the parent query of query.
QueryType get_query_type () const
 Get the type of a query.
Glib::ustring get_query_type_string () const
 Get the type of a query as a human readable string.
Glib::ustring get_sql_text () const
 Obtain a new string representing the SQL version of the query.
Glib::SListHandle
<Glib::RefPtr<Query>> 
get_sub_queries ()
 Get a list of all the sub-queries managed by query.
Glib::RefPtr<const QueryTargetget_target_by_alias (const Glib::ustring& alias_or_name) const
 Get a pointer to a Gda::QueryTarget (which must be within query) using its alias (if not found then alias_or_name is interpreted as the target name).
Glib::RefPtr<QueryTargetget_target_by_alias (const Glib::ustring& alias_or_name)
 Get a pointer to a Gda::QueryTarget (which must be within query) using its alias (if not found then alias_or_name is interpreted as the target name).
Glib::RefPtr<const QueryTargetget_target_by_xml_id (const Glib::ustring& xml_id) const
 Get a pointer to a Gda::QueryTarget (which must be within query) using its XML Id.
Glib::RefPtr<QueryTargetget_target_by_xml_id (const Glib::ustring& xml_id)
 Get a pointer to a Gda::QueryTarget (which must be within query) using its XML Id.
Glib::SListHandle
< Glib::RefPtr< const
QueryField > > 
get_target_pkfields (const Glib::RefPtr<QueryTarget>& target) const
 Makes a list of the Gda::QueryField objects which represent primary key fields of the entity represented by target.
Glib::SListHandle
<Glib::RefPtr<QueryField>> 
get_target_pkfields (const Glib::RefPtr<QueryTarget>& target)
 Makes a list of the Gda::QueryField objects which represent primary key fields of the entity represented by target.
Glib::SListHandle
< Glib::RefPtr< const
QueryTarget > > 
get_targets () const
 Get a list of all the targets used in query.
Glib::SListHandle
<Glib::RefPtr<QueryTarget>> 
get_targets ()
 Get a list of all the targets used in query.
const GdaQuery* gobj () const
 Provides access to the underlying C GObject.
GdaQuery* gobj ()
 Provides access to the underlying C GObject.
GdaQuery* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool is_delete_query () const
 Tells if query is a DELETE query.
bool is_insert_query () const
 Tells if query is a INSERT query.
bool is_modify_query () const
 Tells if query is a modification query (a simple UPDATE, DELETE, INSERT).
bool is_select_query () const
 Tells if query is a SELECTION query (a simple SELECT, UNION, INTERSECT or EXCEPT);.
bool is_update_query () const
 Tells if query is a UPDATE query.
bool is_well_formed (const Glib::RefPtr<ParameterList>& context) const
 Tells if query is well formed, and if context is not 0, also tells if rendering to SQL can be done without error.
void order_fields_using_join_conds ()
 Re-orders the fields in query using the joins' conditions: for each join condition, the used query fields are grouped together near the 1st visible field.
void set_condition (const Glib::RefPtr<QueryCondition>& cond)
 Sets the query's associated condition; if there was already a query condition, then the old one is trashed first.
void set_order_by_field (const Glib::RefPtr<QueryField>& field, int order=0, bool ascendant=true)
 Sets field to be used in the ORDER BY clause (using the order and ascendant attributes) if order >= 0.
void set_query_type (QueryType type)
 Sets the type of query.
void set_sql_text (const Glib::ustring& sql)
 Defines query's contents from an SQL statement.
Glib::SignalProxy0<void> signal_condition_changed ()
Glib::SignalProxy1< void,
const Glib::RefPtr<QueryJoin >&> 
signal_join_added ()
Glib::SignalProxy1< void,
const Glib::RefPtr<QueryJoin >&> 
signal_join_removed ()
Glib::SignalProxy1< void,
const Glib::RefPtr<QueryJoin >&> 
signal_join_updated ()
Glib::SignalProxy1< void,
const Glib::RefPtr<Query >&> 
signal_sub_query_added ()
Glib::SignalProxy1< void,
const Glib::RefPtr<Query >&> 
signal_sub_query_removed ()
Glib::SignalProxy1< void,
const Glib::RefPtr<Query >&> 
signal_sub_query_updated ()
Glib::SignalProxy1< void,
const Glib::RefPtr
<QueryTarget >&> 
signal_target_added ()
Glib::SignalProxy1< void,
const Glib::RefPtr
<QueryTarget >&> 
signal_target_removed ()
Glib::SignalProxy1< void,
const Glib::RefPtr
<QueryTarget >&> 
signal_target_updated ()
Glib::SignalProxy0<void> signal_type_changed ()
virtual ~Query ()

Static Public Member Functions

static Glib::RefPtr<Querycreate (const Glib::RefPtr<Dict>& dict, QueryType type)
static Glib::RefPtr<Querycreate (const Glib::RefPtr<Dict>& dict)

Protected Member Functions

virtual void on_condition_changed ()
virtual void on_join_added (const Glib::RefPtr<QueryJoin>& join)
virtual void on_join_removed (const Glib::RefPtr<QueryJoin>& join)
virtual void on_join_updated (const Glib::RefPtr<QueryJoin>& join)
virtual void on_sub_query_added (const Glib::RefPtr<Query>& query)
virtual void on_sub_query_removed (const Glib::RefPtr<Query>& query)
virtual void on_sub_query_updated (const Glib::RefPtr<Query>& query)
virtual void on_target_added (const Glib::RefPtr<QueryTarget>& target)
virtual void on_target_removed (const Glib::RefPtr<QueryTarget>& target)
virtual void on_target_updated (const Glib::RefPtr<QueryTarget>& target)
virtual void on_type_changed ()
 Query (const Glib::RefPtr<Dict>& dict, QueryType type)
 Query (const Glib::RefPtr<Dict>& dict)

Related Functions

(Note that these are not member functions.)

Glib::RefPtr<Gnome::Gda::Querywrap (GdaQuery* object, bool take_copy=false)
 A Glib::wrap() method for this object.


Detailed Description

Represents any kind of DML query.

Constructor & Destructor Documentation

virtual Gnome::Gda::Query::~Query (  )  [virtual]

Gnome::Gda::Query::Query ( const Glib::RefPtr<Dict>&  dict  )  [explicit, protected]

Gnome::Gda::Query::Query ( const Glib::RefPtr<Dict>&  dict,
QueryType  type 
) [protected]


Member Function Documentation

Glib::RefPtr<QueryField> Gnome::Gda::Query::add_field_from_sql ( const Glib::ustring field  ) 

Parses field and if it represents a valid SQL expression for a field, then add it to query.

Parameters:
field A SQL expression.
Returns:
A new Gda::QueryField object, or 0.

bool Gnome::Gda::Query::add_join ( const Glib::RefPtr<QueryJoin>&  join  ) 

Add a join to query.

A join is defined by the two Gda::QueryTarget objects it joins and by a join condition which MUST ONLY make use of fields of the two entities represented by the targets.

For any given couple of Gda::QueryTarget objects, there can exist ONLY ONE Gda::QueryJoin which joins the two.

Parameters:
join A Gda::QueryJoin object.
Returns:
true on success, and false otherwise.

void Gnome::Gda::Query::add_param_source ( const Glib::RefPtr<DataModel>&  param_source  ) 

Tells query that param_source is a query which potentially will constraint the possible values of one or more of query's parameters.

This implies that query keeps a reference on param_source.

Parameters:
param_source A Gda::DataModel object.

void Gnome::Gda::Query::add_sub_query ( const Glib::RefPtr<Query>&  sub_query  ) 

Add sub_query to query.

Sub queries are managed by their parent query, and as such they are destroyed when their parent query is destroyed.

Parameters:
sub_query A Gda::Query object.

bool Gnome::Gda::Query::add_target ( const Glib::RefPtr<QueryTarget>&  target  ) 

Adds a target to query.

A target represents a entity (it can actually be a table, a view, or another query) which query will use.

For a SELECT query, the targets appear after the FROM clause. The targets can be joined two by two using Gda::QueryJoin objects

For UPDATE, DELETE or INSERT queries, there can be only ONE Gda::QueryTarget object which is the one where the data modifications are performed.

For UNION and INTERSECT queries, there is no possible Gda::QueryTarget object.

Parameters:
target A Gda::QueryTarget to add to query.
Returns:
true if no error occurred.

void Gnome::Gda::Query::append_condition ( const Glib::RefPtr<QueryCondition>&  cond,
bool  append_as_and = true 
)

Appends the cond object to query's condition.

If query does not yet have any condition, then the result is the same as set_condition(); otherwise, cond is added to query's condition, using the AND operator if append_as_and is true, and an OR operator if append_as_and is false.

Parameters:
cond A Gda::QueryCondition object.
append_as_and Mode of append if there is already a query condition.

static Glib::RefPtr<Query> Gnome::Gda::Query::create ( const Glib::RefPtr<Dict>&  dict,
QueryType  type 
) [static]

static Glib::RefPtr<Query> Gnome::Gda::Query::create ( const Glib::RefPtr<Dict>&  dict  )  [static]

void Gnome::Gda::Query::del_join ( const Glib::RefPtr<QueryJoin>&  join  ) 

Removes join from query.

join MUST be present within query.

Parameters:
join A Gda::QueryJoin object.

void Gnome::Gda::Query::del_param_source ( const Glib::RefPtr<DataModel>&  param_source  ) 

Tells query that it should no longer take care of param_source.

The parameters which depend on param_source will still depend on it, though.

Parameters:
param_source A Gda::DataModel object.

void Gnome::Gda::Query::del_sub_query ( const Glib::RefPtr<Query>&  sub_query  ) 

Removes sub_query from query.

sub_query MUST be present within query.

Parameters:
sub_query A Gda::Query object.

void Gnome::Gda::Query::del_target ( const Glib::RefPtr<QueryTarget>&  target  ) 

Removes target from query.

target MUST be present within query. Warning: All the joins and fields which depended on target are also removed.

Parameters:
target A Gda::QueryTarget object.

Glib::RefPtr<Object> Gnome::Gda::Query::execute ( const Glib::RefPtr<ParameterList>&  params,
bool  iter_model_only_requested = false 
)

Executes query and returns Gda::DataModel if query's execution yields to a data set, or a Gda::ParameterList object otherwise, or 0 if an error occurred.

You can test the return value using GObject's introscpection features such as GDA_IS_DATA_MODEL() or GDA_IS_PARAMETER_LIST().

For more information about the returned value, see Gda::ServerProvider::execute_command().

Parameters:
params A Gda::ParameterList object obtained using get_parameter_list().
iter_model_only_requested Set to true if the returned data model will only be accessed using an iterator.
Returns:
A Gda::DataModel, a Gda::ParameterList or 0.

Glib::SListHandle<Glib::RefPtr<QueryField> > Gnome::Gda::Query::expand_all_field ( const Glib::RefPtr<QueryTarget>&  target  ) 

Converts each visible "target.*" (Gda::QueryFieldAll) field into its list of fields.

For example "t1.*" becomes "t1.a, t1.b" if table t1 is composed of fields "a" and "b". The original GdaQueryFieldAll field is not removed, but simply rendered non visible.

The returned list must be free'd by the caller using Glib::slist_free().

Parameters:
target A Gda::QueryTarget, or 0.
Returns:
A new list of the Gda::QueryField objects which have been created.

Glib::SListHandle<Glib::RefPtr<const QueryField> > Gnome::Gda::Query::get_all_fields (  )  const

Fetch a list of all the fields of query: the ones which are visible, and the ones which are not visible and are not internal query fields.

Returns:
A new list of fields.

Glib::SListHandle<Glib::RefPtr<QueryField> > Gnome::Gda::Query::get_all_fields (  ) 

Fetch a list of all the fields of query: the ones which are visible, and the ones which are not visible and are not internal query fields.

Returns:
A new list of fields.

Glib::RefPtr<const QueryCondition> Gnome::Gda::Query::get_condition (  )  const

Get the query's associated condition.

Returns:
The Gda::QueryCondition object.

Glib::RefPtr<QueryCondition> Gnome::Gda::Query::get_condition (  ) 

Get the query's associated condition.

Returns:
The Gda::QueryCondition object.

Glib::RefPtr<const QueryField> Gnome::Gda::Query::get_field_by_param_name ( const Glib::ustring param_name  )  const

Glib::RefPtr<QueryField> Gnome::Gda::Query::get_field_by_param_name ( const Glib::ustring param_name  ) 

Glib::RefPtr<const QueryField> Gnome::Gda::Query::get_field_by_ref_field ( const Glib::RefPtr<QueryTarget>&  target,
const Glib::RefPtr<EntityField>&  field,
QueryFieldState  field_state 
) const

Finds the first Gda::QueryField object in query which represents ref_field.

The returned object will be a Gda::QueryFieldField object which represents ref_field.

If target is specified, then the returned field will be linked to that Gda::QueryTarget object.

Parameters:
target A Gda::QueryTarget, or 0.
ref_field A Gda::EntityField object.
field_state Tells about the status of the requested field, see Gda::QueryFieldState.
Returns:
A Gda::QueryFieldField object or 0.

Glib::RefPtr<QueryField> Gnome::Gda::Query::get_field_by_ref_field ( const Glib::RefPtr<QueryTarget>&  target,
const Glib::RefPtr<EntityField>&  ref_field,
QueryFieldState  field_state 
)

Finds the first Gda::QueryField object in query which represents ref_field.

The returned object will be a Gda::QueryFieldField object which represents ref_field.

If target is specified, then the returned field will be linked to that Gda::QueryTarget object.

Parameters:
target A Gda::QueryTarget, or 0.
ref_field A Gda::EntityField object.
field_state Tells about the status of the requested field, see Gda::QueryFieldState.
Returns:
A Gda::QueryFieldField object or 0.

Glib::RefPtr<const QueryField> Gnome::Gda::Query::get_field_by_sql_naming ( const Glib::ustring sql_name  )  const

Parameters:
sql_name The SQL naming for the requested field.

Glib::RefPtr<QueryField> Gnome::Gda::Query::get_field_by_sql_naming ( const Glib::ustring sql_name  ) 

Parameters:
sql_name The SQL naming for the requested field.

Glib::SListHandle<Glib::RefPtr<const QueryField> > Gnome::Gda::Query::get_fields_by_target ( const Glib::RefPtr<QueryTarget>&  target,
bool  visible_fields_only = true 
) const

Get a list of all the Gda::QueryField objects in query which depent on the existance of target.

Parameters:
target A Gda::QueryTarget object representing a target in query.
Returns:
A new list of Gda::QueryField objects.

Glib::SListHandle<Glib::RefPtr<QueryField> > Gnome::Gda::Query::get_fields_by_target ( const Glib::RefPtr<QueryTarget>&  target,
bool  visible_fields_only = true 
)

Get a list of all the Gda::QueryField objects in query which depent on the existance of target.

Parameters:
target A Gda::QueryTarget object representing a target in query.
Returns:
A new list of Gda::QueryField objects.

Glib::RefPtr<const QueryField> Gnome::Gda::Query::get_first_field_for_target ( const Glib::RefPtr<QueryTarget>&  target  )  const

Finds the first occurence of a Gda::QueryFieldField object whose target is target in query.

Returns:
The requested field, or 0.

Glib::RefPtr<QueryField> Gnome::Gda::Query::get_first_field_for_target ( const Glib::RefPtr<QueryTarget>&  target  ) 

Finds the first occurence of a Gda::QueryFieldField object whose target is target in query.

Returns:
The requested field, or 0.

Glib::RefPtr<const QueryJoin> Gnome::Gda::Query::get_join_by_targets ( const Glib::RefPtr<QueryTarget>&  target1,
const Glib::RefPtr<QueryTarget>&  target2 
) const

Find a join in query which joins the target1 and target2 targets.

Parameters:
target1 A Gda::QueryTarget object.
target2 A Gda::QueryTarget object.
Returns:
The Gda::QueryJoin object, or 0.

Glib::RefPtr<QueryJoin> Gnome::Gda::Query::get_join_by_targets ( const Glib::RefPtr<QueryTarget>&  target1,
const Glib::RefPtr<QueryTarget>&  target2 
)

Find a join in query which joins the target1 and target2 targets.

Parameters:
target1 A Gda::QueryTarget object.
target2 A Gda::QueryTarget object.
Returns:
The Gda::QueryJoin object, or 0.

Glib::SListHandle<Glib::RefPtr<const QueryJoin> > Gnome::Gda::Query::get_joins (  )  const

Get a list of all the joins used in query.

Returns:
A new list of the joins.

Glib::SListHandle<Glib::RefPtr<QueryJoin> > Gnome::Gda::Query::get_joins (  ) 

Get a list of all the joins used in query.

Returns:
A new list of the joins.

Glib::SListHandle<Glib::RefPtr<const QueryCondition> > Gnome::Gda::Query::get_main_conditions (  )  const

Makes a list of all the conditions (part of the WHERE clause) which are always verified by query when it is executed.

Examples: if the WHERE clause is: --> "A and B" then the list will contains {A, B} --> "A and (B or C)" it will contain {A, B or C} --> "A and (B and not C)", it will contain {A, B, not C}

Returns:
A new list of Gda::QueryCondition objects.

Glib::SListHandle<Glib::RefPtr<QueryCondition> > Gnome::Gda::Query::get_main_conditions (  ) 

Makes a list of all the conditions (part of the WHERE clause) which are always verified by query when it is executed.

Examples: if the WHERE clause is: --> "A and B" then the list will contains {A, B} --> "A and (B or C)" it will contain {A, B or C} --> "A and (B and not C)", it will contain {A, B, not C}

Returns:
A new list of Gda::QueryCondition objects.

int Gnome::Gda::Query::get_order_by_field ( const Glib::RefPtr<QueryField>&  field,
bool &  ascendant 
) const

int Gnome::Gda::Query::get_order_by_field ( const Glib::RefPtr<QueryField>&  field  )  const

Glib::SListHandle<Glib::RefPtr<const Query> > Gnome::Gda::Query::get_param_sources (  )  const

Get a list of the parameter source queries that are references as such by query.

Returns:
The list of Gda::Query objects.

Glib::RefPtr<const ParameterList> Gnome::Gda::Query::get_parameter_list (  )  const

Like the get_parameters() method, get a list of parameters which the query accepts, except that the parameters are stored within a Gda::ParameterList object, and can be used as an argument to the execute() method.

Returns:
A new Gda::ParameterList object, or 0 if query does not accept any parameter.

Glib::RefPtr<ParameterList> Gnome::Gda::Query::get_parameter_list (  ) 

Like the get_parameters() method, get a list of parameters which the query accepts, except that the parameters are stored within a Gda::ParameterList object, and can be used as an argument to the execute() method.

Returns:
A new Gda::ParameterList object, or 0 if query does not accept any parameter.

Glib::SListHandle<Glib::RefPtr<Parameter> > Gnome::Gda::Query::get_parameters (  ) 

Get a list of parameters which the query accepts.

Returns:
A list of Gda::Parameter objects (the list and objects must be freed by the caller).

Glib::RefPtr<const Query> Gnome::Gda::Query::get_parent_query (  )  const

Get the parent query of query.

Returns:
The parent query, or 0 if query does not have any parent.

Glib::RefPtr<Query> Gnome::Gda::Query::get_parent_query (  ) 

Get the parent query of query.

Returns:
The parent query, or 0 if query does not have any parent.

QueryType Gnome::Gda::Query::get_query_type (  )  const

Get the type of a query.

Returns:
The type of query.

Glib::ustring Gnome::Gda::Query::get_query_type_string (  )  const

Get the type of a query as a human readable string.

Returns:
A string for the type of query.

Glib::ustring Gnome::Gda::Query::get_sql_text (  )  const

Obtain a new string representing the SQL version of the query.

WARNING: the returned SQL statement may contain some extensions which allow for the definition of variables (see the introduction to the Gda::Query for more information). As such the returned SQL cannot be executed as it may provoque errors. To get an executable statement, use the Gda::Renderer interface's methods.

Returns:
The new string.

Glib::SListHandle<Glib::RefPtr<Query> > Gnome::Gda::Query::get_sub_queries (  ) 

Get a list of all the sub-queries managed by query.

Returns:
A new list of the sub-queries.

Glib::RefPtr<const QueryTarget> Gnome::Gda::Query::get_target_by_alias ( const Glib::ustring alias_or_name  )  const

Get a pointer to a Gda::QueryTarget (which must be within query) using its alias (if not found then alias_or_name is interpreted as the target name).

Parameters:
alias_or_name The alias or name.
Returns:
The Gda::QueryTarget object, or 0 if not found.

Glib::RefPtr<QueryTarget> Gnome::Gda::Query::get_target_by_alias ( const Glib::ustring alias_or_name  ) 

Get a pointer to a Gda::QueryTarget (which must be within query) using its alias (if not found then alias_or_name is interpreted as the target name).

Parameters:
alias_or_name The alias or name.
Returns:
The Gda::QueryTarget object, or 0 if not found.

Glib::RefPtr<const QueryTarget> Gnome::Gda::Query::get_target_by_xml_id ( const Glib::ustring xml_id  )  const

Get a pointer to a Gda::QueryTarget (which must be within query) using its XML Id.

Parameters:
xml_id The XML Id of the requested Gda::QueryTarget object.
Returns:
The Gda::QueryTarget object, or 0 if not found.

Glib::RefPtr<QueryTarget> Gnome::Gda::Query::get_target_by_xml_id ( const Glib::ustring xml_id  ) 

Get a pointer to a Gda::QueryTarget (which must be within query) using its XML Id.

Parameters:
xml_id The XML Id of the requested Gda::QueryTarget object.
Returns:
The Gda::QueryTarget object, or 0 if not found.

Glib::SListHandle<Glib::RefPtr<const QueryField> > Gnome::Gda::Query::get_target_pkfields ( const Glib::RefPtr<QueryTarget>&  target  )  const

Makes a list of the Gda::QueryField objects which represent primary key fields of the entity represented by target.

If the entity represented by target does not have any primary key, or if the primary key's fields are not present in query, then the returned value is 0.

Parameters:
target A Gda::QueryTarget object.
Returns:
A new GSList, or 0.

Glib::SListHandle<Glib::RefPtr<QueryField> > Gnome::Gda::Query::get_target_pkfields ( const Glib::RefPtr<QueryTarget>&  target  ) 

Makes a list of the Gda::QueryField objects which represent primary key fields of the entity represented by target.

If the entity represented by target does not have any primary key, or if the primary key's fields are not present in query, then the returned value is 0.

Parameters:
target A Gda::QueryTarget object.
Returns:
A new GSList, or 0.

Glib::SListHandle<Glib::RefPtr<const QueryTarget> > Gnome::Gda::Query::get_targets (  )  const

Get a list of all the targets used in query.

Returns:
A new list of the targets.

Glib::SListHandle<Glib::RefPtr<QueryTarget> > Gnome::Gda::Query::get_targets (  ) 

Get a list of all the targets used in query.

Returns:
A new list of the targets.

const GdaQuery* Gnome::Gda::Query::gobj (  )  const [inline]

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::Entity.

References Glib::ValueBase::gobject_.

GdaQuery* Gnome::Gda::Query::gobj (  )  [inline]

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::Entity.

References Glib::ValueBase::gobject_.

GdaQuery* Gnome::Gda::Query::gobj_copy (  ) 

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gnome::Gda::QueryObject.

bool Gnome::Gda::Query::is_delete_query (  )  const

Tells if query is a DELETE query.

Returns:
true if query is an delete query.

bool Gnome::Gda::Query::is_insert_query (  )  const

Tells if query is a INSERT query.

Returns:
true if query is an insertion query.

bool Gnome::Gda::Query::is_modify_query (  )  const

Tells if query is a modification query (a simple UPDATE, DELETE, INSERT).

; pure SQL queries are not handled and will always return false.

Returns:
true if query is a modification query.

bool Gnome::Gda::Query::is_select_query (  )  const

Tells if query is a SELECTION query (a simple SELECT, UNION, INTERSECT or EXCEPT);.

Returns:
true if query is a selection query.

bool Gnome::Gda::Query::is_update_query (  )  const

Tells if query is a UPDATE query.

Returns:
true if query is an update query.

bool Gnome::Gda::Query::is_well_formed ( const Glib::RefPtr<ParameterList>&  context  )  const

Tells if query is well formed, and if context is not 0, also tells if rendering to SQL can be done without error.

Parameters:
context A Gda::ParameterList obtained using get_parameter_list(), or 0.
Returns:
false if query is not well formed.

virtual void Gnome::Gda::Query::on_condition_changed (  )  [protected, virtual]

virtual void Gnome::Gda::Query::on_join_added ( const Glib::RefPtr<QueryJoin>&  join  )  [protected, virtual]

virtual void Gnome::Gda::Query::on_join_removed ( const Glib::RefPtr<QueryJoin>&  join  )  [protected, virtual]

virtual void Gnome::Gda::Query::on_join_updated ( const Glib::RefPtr<QueryJoin>&  join  )  [protected, virtual]

virtual void Gnome::Gda::Query::on_sub_query_added ( const Glib::RefPtr<Query>&  query  )  [protected, virtual]

virtual void Gnome::Gda::Query::on_sub_query_removed ( const Glib::RefPtr<Query>&  query  )  [protected, virtual]

virtual void Gnome::Gda::Query::on_sub_query_updated ( const Glib::RefPtr<Query>&  query  )  [protected, virtual]

virtual void Gnome::Gda::Query::on_target_added ( const Glib::RefPtr<QueryTarget>&  target  )  [protected, virtual]

virtual void Gnome::Gda::Query::on_target_removed ( const Glib::RefPtr<QueryTarget>&  target  )  [protected, virtual]

virtual void Gnome::Gda::Query::on_target_updated ( const Glib::RefPtr<QueryTarget>&  target  )  [protected, virtual]

virtual void Gnome::Gda::Query::on_type_changed (  )  [protected, virtual]

void Gnome::Gda::Query::order_fields_using_join_conds (  ) 

Re-orders the fields in query using the joins' conditions: for each join condition, the used query fields are grouped together near the 1st visible field.

void Gnome::Gda::Query::set_condition ( const Glib::RefPtr<QueryCondition>&  cond  ) 

Sets the query's associated condition; if there was already a query condition, then the old one is trashed first.

Pass 0 as the cond argument to remove any query condition

Parameters:
cond A Gda::QueryCondition object, or 0 to remove condition.

void Gnome::Gda::Query::set_order_by_field ( const Glib::RefPtr<QueryField>&  field,
int  order = 0,
bool  ascendant = true 
)

Sets field to be used in the ORDER BY clause (using the order and ascendant attributes) if order >= 0.

If order < 0, then field will not be used in the ORDER BY clause.

Parameters:
field A Gda::QueryField which is in query.
order The order in the list of ORDER BY fields (starts at 0), or -1.
ascendant true to sort ascending.

void Gnome::Gda::Query::set_query_type ( QueryType  type  ) 

Sets the type of query.

Parameters:
type The new type of query.

void Gnome::Gda::Query::set_sql_text ( const Glib::ustring sql  ) 

Defines query's contents from an SQL statement.

The SQL text is parsed and the internal query structured is built from that; the query type is also set. If the SQL text cannot be parsed, then the internal structure of the query is emptied and the query type is set to GDA_QUERY_TYPE_NON_PARSED_SQL.

To be parsed successfully, the expected SQL must respect the SQL standard; some extensions have been added to be able to define variables within the SQL statement. See the introduction to the Gda::Query for more information.

Parameters:
sql The SQL statement.

Glib::SignalProxy0< void > Gnome::Gda::Query::signal_condition_changed (  ) 

Prototype:
void on_my_condition_changed()

Glib::SignalProxy1<void,const Glib::RefPtr<QueryJoin>&> Gnome::Gda::Query::signal_join_added (  ) 

Prototype:
void on_my_join_added(const Glib::RefPtr<QueryJoin>& join)

Glib::SignalProxy1<void,const Glib::RefPtr<QueryJoin>&> Gnome::Gda::Query::signal_join_removed (  ) 

Prototype:
void on_my_join_removed(const Glib::RefPtr<QueryJoin>& join)

Glib::SignalProxy1<void,const Glib::RefPtr<QueryJoin>&> Gnome::Gda::Query::signal_join_updated (  ) 

Prototype:
void on_my_join_updated(const Glib::RefPtr<QueryJoin>& join)

Glib::SignalProxy1<void,const Glib::RefPtr<Query>&> Gnome::Gda::Query::signal_sub_query_added (  ) 

Prototype:
void on_my_sub_query_added(const Glib::RefPtr<Query>& query)

Glib::SignalProxy1<void,const Glib::RefPtr<Query>&> Gnome::Gda::Query::signal_sub_query_removed (  ) 

Prototype:
void on_my_sub_query_removed(const Glib::RefPtr<Query>& query)

Glib::SignalProxy1<void,const Glib::RefPtr<Query>&> Gnome::Gda::Query::signal_sub_query_updated (  ) 

Prototype:
void on_my_sub_query_updated(const Glib::RefPtr<Query>& query)

Glib::SignalProxy1<void,const Glib::RefPtr<QueryTarget>&> Gnome::Gda::Query::signal_target_added (  ) 

Prototype:
void on_my_target_added(const Glib::RefPtr<QueryTarget>& target)

Glib::SignalProxy1<void,const Glib::RefPtr<QueryTarget>&> Gnome::Gda::Query::signal_target_removed (  ) 

Prototype:
void on_my_target_removed(const Glib::RefPtr<QueryTarget>& target)

Glib::SignalProxy1<void,const Glib::RefPtr<QueryTarget>&> Gnome::Gda::Query::signal_target_updated (  ) 

Prototype:
void on_my_target_updated(const Glib::RefPtr<QueryTarget>& target)

Glib::SignalProxy0< void > Gnome::Gda::Query::signal_type_changed (  ) 

Prototype:
void on_my_type_changed()


Friends And Related Function Documentation

Glib::RefPtr<Gnome::Gda::Query> wrap ( GdaQuery *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
object The C instance.
take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.


The documentation for this class was generated from the following file:

Generated for libgdamm by Doxygen 1.5.5 © 1997-2001