Gnome::Gda::Query Class Reference

Represents any kind of DML query. More...

#include <query.h>

Inheritance diagram for Gnome::Gda::Query:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual ~Query ()
GdaQuery* gobj ()
 Provides access to the underlying C GObject.
const GdaQuery* gobj () const
 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.
void set_query_type (QueryType type)
 Sets the type 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.
bool is_select_query () const
 Tells if query is a SELECTION query (a simple SELECT, UNION, INTERSECT or EXCEPT);.
bool is_insert_query () const
 Tells if query is a INSERT query.
bool is_update_query () const
 Tells if query is a UPDATE query.
bool is_delete_query () const
 Tells if query is a DELETE query.
bool is_modify_query () const
 Tells if query is a modification query (a simple UPDATE, DELETE, INSERT).
void set_sql_text (const Glib::ustring& sql, std::auto_ptr<Glib::Error>& error)
 Defines query 's contents from an SQL statement.
Glib::ustring get_sql_text () const
 Obtain a new string representing the SQL version of the query.
Glib::SListHandle< Glib::RefPtr<
Parameter > > 
get_parameters ()
 Get a list of parameters which the query accepts.
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::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<Objectexecute (const Glib::RefPtr<ParameterList>& params, bool iter_model_only_requested, std::auto_ptr<Glib::Error>& error)
 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::RefPtr<Queryget_parent_query ()
 Get the parent query of query.
Glib::RefPtr<const Queryget_parent_query () const
 Get the parent query of query.
Glib::SListHandle< Glib::RefPtr<
Query > > 
get_sub_queries ()
 Get a list of all the sub-queries managed by 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 del_param_source (const Glib::RefPtr<DataModel>& param_source)
 Tells query that it should no longer take care of param_source .
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 .
void add_sub_query (const Glib::RefPtr<Query>& sub_query)
 Add sub_query to query .
void del_sub_query (const Glib::RefPtr<Query>& sub_query)
 Removes sub_query from query .
bool add_target (const Glib::RefPtr<QueryTarget>& target, std::auto_ptr<Glib::Error>& error)
 Adds a target to query .
void del_target (const Glib::RefPtr<QueryTarget>& target)
 Removes target from query .
Glib::SListHandle< Glib::RefPtr<
QueryTarget > > 
get_targets ()
 Get a list of all the targets used in query.
Glib::SListHandle< Glib::RefPtr<
const QueryTarget > > 
get_targets () const
 Get a list of all the targets used in query.
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::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_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_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::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 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::RefPtr<QueryConditionget_condition ()
 Get the query's associated condition.
Glib::RefPtr<const QueryConditionget_condition () const
 Get the query's associated condition.
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.
int get_order_by_field (const Glib::RefPtr<QueryField>& field) const
int get_order_by_field (const Glib::RefPtr<QueryField>& field, bool& ascendant) const
Glib::RefPtr<QueryFieldadd_field_from_sql (const Glib::ustring& field, std::auto_ptr<Glib::Error>& error)
 Parses field and if it represents a valid SQL expression for a field, then add it to query .
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::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::RefPtr<QueryFieldget_field_by_sql_naming (const Glib::ustring& sql_name)
Glib::RefPtr<const QueryFieldget_field_by_sql_naming (const Glib::ustring& sql_name) const
Glib::RefPtr<QueryFieldget_field_by_param_name (const Glib::ustring& param_name)
Glib::RefPtr<const QueryFieldget_field_by_param_name (const Glib::ustring& param_name) const
Glib::RefPtr<QueryFieldget_field_by_ref_field (const Glib::RefPtr<QueryTarget>& target, const Glib::RefPtr<EntityField>& field, QueryFieldState field_state)
 Finds the first Gda::QueryField object in query which represents ref_field .
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_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 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::SListHandle< Glib::RefPtr<
QueryField > > 
expand_all_field (const Glib::RefPtr<QueryTarget>& target)
 Converts each visible "target.*" (Gda::QueryFieldAll) field into its list of fields.
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.
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::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 .

Static Public Member Functions

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

Protected Member Functions

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

Related Functions

(Note that these are not member functions.)

Glib::RefPtr<Gnome::Gda::Querywrap (GdaQuery* object, bool take_copy=false)

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,
std::auto_ptr< Glib::Error > &  error 
)

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

Parameters:
field A SQL expression.
error Place to store the error, or 0.
Returns:
A new Gda::QueryField object, or 0.

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,
std::auto_ptr< Glib::Error > &  error 
)

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 .
error Location to store error, or 0.
Returns:
true if no error occurred.

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_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,
std::auto_ptr< Glib::Error > &  error 
)

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.
error A place to store errors, or 0.
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>&  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.

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.

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

Provides access to the underlying C GObject.

Reimplemented from Gnome::Gda::Entity.

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.

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,
std::auto_ptr< Glib::Error > &  error 
)

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.
error Location to store parsing error, or 0.


Friends And Related Function Documentation

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

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 on Sat Feb 10 20:06:40 2007 for libgdamm by  doxygen 1.4.7