Gnome::Gda::SqlBuilder Class Reference

Inherits Glib::Object.

Collaboration diagram for Gnome::Gda::SqlBuilder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~SqlBuilder ()
GdaSqlBuilder* gobj ()
 Provides access to the underlying C GObject.
const GdaSqlBuilder* gobj () const
 Provides access to the underlying C GObject.
GdaSqlBuilder* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< Statementget_statement () const
SqlStatement get_sql_statement () const
guint add_id (const Glib::ustring&string)
 Defines an expression which may be reused to build other parts of a statement.
template<class ValueType >
guint add_expr (const Glib::RefPtr< DataHandler >& dh, const ValueType&value)
 Defines an expression in Builder which may be reused to build other parts of a statement.
guint add_expr_as_value (const Glib::RefPtr< DataHandler >& dh, const Value&value)
 Defines an expression in Builder which may be reused to build other parts of a statement.
template<class ValueType >
guint add_expr (const ValueType&value)
 Defines an expression in Builder which may be reused to build other parts of a statement.
guint add_expr_as_value (const Value&value)
 Defines an expression in Builder which may be reused to build other parts of a statement.
guint add_param (const Glib::ustring& param_name, GType type, bool nullok=false)
 Defines a parameter which may be reused to build other parts of a statement.
guint add_cond (SqlOperatorType op, guint op1, guint op2=0, guint op3=0)
 Builds a new expression which reprenents a condition (or operation).
guint add_cond (SqlOperatorType op, const Glib::ArrayHandle< guint >& op_ids)
 Builds a new expression which reprenents a condition (or operation).
guint add_function (const Glib::ustring& function_name, const Glib::ArrayHandle< guint >& args)
 Builds a new expression which represents a function applied to some arguments.
guint add_function (const Glib::ustring& function_name, guint arg)
 Builds a new expression which represents a function applied to an argument.
guint add_sub_select (const SqlStatement& sqlst)
guint select_add_field (const Glib::ustring& field_name, const Glib::ustring& table_name, const Glib::ustring& alias=Glib::ustring())
guint select_add_target (const Glib::ustring& table_name, const Glib::ustring& alias=Glib::ustring())
 Adds a new target to a SELECT statement.
guint select_add_target_id (guint table_id, const Glib::ustring& alias=Glib::ustring())
guint select_join_targets (guint left_target_id, guint right_target_id, SqlSelectJoinType join_type, guint join_expr=0)
 Joins two targets in a SELECT statement.
void join_add_field (guint join_id, const Glib::ustring& field_name)
void select_order_by (guint expr_id, bool asc=true, const Glib::ustring& collation_name=Glib::ustring())
void select_set_distinct (bool distinct=true)
 Adds or removes a DISTINCT clause for a SELECT statement.
void select_set_distinct (bool distinct, guint expr_id)
void select_set_limit (guint limit_count, guint offset=0)
 Defines the maximum number of rows in the DataModel resulting from the execution of the built statement.
void select_set_limit_id (guint limit_count_expr_id, guint limit_offest_expr_id=0)
void select_set_having (guint cond_id)
void select_group_by (guint expr_id)
void set_table (const Glib::ustring& table_name)
void set_where (guint cond_id)
void add_field_id (guint field_id, guint value_id=0)
template<class ValueType >
void add_field_value (const Glib::ustring& field_name, const ValueType&value)
void add_field_value_as_value (const Glib::ustring& field_name, const Value&value)
void compound_add_sub_select (const SqlStatement& sqlst)
SqlExpr export_expression (guint id) const
guint import_expression (const SqlExpr& expr)

Static Public Member Functions

static Glib::RefPtr< SqlBuildercreate (SqlStatementType type)

Protected Member Functions

 SqlBuilder (SqlStatementType type)

Related Functions

(Note that these are not member functions.)



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

Constructor & Destructor Documentation

virtual Gnome::Gda::SqlBuilder::~SqlBuilder (  )  [virtual]
Gnome::Gda::SqlBuilder::SqlBuilder ( SqlStatementType  type  )  [protected]

Member Function Documentation

guint Gnome::Gda::SqlBuilder::add_cond ( SqlOperatorType  op,
const Glib::ArrayHandle< guint > &  op_ids 
)

Builds a new expression which reprenents a condition (or operation).

Parameters:
op Type of condition
op_ids,: list of IDs of the operands of the condition
Returns:
The ID of the new expression, or 0 if there was an error.
guint Gnome::Gda::SqlBuilder::add_cond ( SqlOperatorType  op,
guint  op1,
guint  op2 = 0,
guint  op3 = 0 
)

Builds a new expression which reprenents a condition (or operation).

Parameters:
op Type of condition
op1 The ID of the 1st argument (not 0)
op2 The ID of the 2st argument (maybe 0 if op only requires one argument)
op3 The ID of the 3st argument (maybe 0 if op only requires one or two arguments)
Returns:
The ID of the new expression, or 0 if there was an error.
template <class ValueType >
guint Gnome::Gda::SqlBuilder::add_expr ( const ValueType &  value  )  [inline]

Defines an expression in Builder which may be reused to build other parts of a statement.

Parameters:
value,: value to set the expression to

See expr() except that no custom datahandler is given

Returns:
The ID of the new expression, or 0 if there was an error.
template <class ValueType >
guint Gnome::Gda::SqlBuilder::add_expr ( const Glib::RefPtr< DataHandler >&  dh,
const ValueType &  value 
) [inline]

Defines an expression in Builder which may be reused to build other parts of a statement.

Parameters:
dh The datahandler to use
value,: value to set the expression to

See expr() except that no custom datahandler is given

Returns:
The ID of the new expression, or 0 if there was an error.
guint Gnome::Gda::SqlBuilder::add_expr_as_value ( const Value value  ) 

Defines an expression in Builder which may be reused to build other parts of a statement.

Parameters:
value,: value to set the expression to

See expr() except that no custom datahandler is given

Returns:
The ID of the new expression, or 0 if there was an error.
guint Gnome::Gda::SqlBuilder::add_expr_as_value ( const Glib::RefPtr< DataHandler >&  dh,
const Value value 
)

Defines an expression in Builder which may be reused to build other parts of a statement.

Parameters:
dh The datahandler to use
value,: value to set the expression to

See expr() except that no custom datahandler is given

Returns:
The ID of the new expression, or 0 if there was an error.
void Gnome::Gda::SqlBuilder::add_field_id ( guint  field_id,
guint  value_id = 0 
)
template <class ValueType >
void Gnome::Gda::SqlBuilder::add_field_value ( const Glib::ustring field_name,
const ValueType &  value 
) [inline]
void Gnome::Gda::SqlBuilder::add_field_value_as_value ( const Glib::ustring field_name,
const Value value 
)
guint Gnome::Gda::SqlBuilder::add_function ( const Glib::ustring function_name,
guint  arg 
)

Builds a new expression which represents a function applied to an argument.

Parameters:
function_name The name of the function to embed (e.g. MAX, MIN, ...)
arg,: The ids of the argument to the function
Returns:
The ID of the new target, or 0 if there was an error.
guint Gnome::Gda::SqlBuilder::add_function ( const Glib::ustring function_name,
const Glib::ArrayHandle< guint > &  args 
)

Builds a new expression which represents a function applied to some arguments.

Parameters:
function_name The name of the function to embed (e.g. MAX, MIN, ...)
args,: list of ids of the arguments to the function
Returns:
The ID of the new target, or 0 if there was an error.
guint Gnome::Gda::SqlBuilder::add_id ( const Glib::ustring string  ) 

Defines an expression which may be reused to build other parts of a statement.

Parameters:
string String to use in the SQL
Returns:
The ID of the new expression, or 0 if there was an error.
guint Gnome::Gda::SqlBuilder::add_param ( const Glib::ustring param_name,
GType  type,
bool  nullok = false 
)

Defines a parameter which may be reused to build other parts of a statement.

Parameters:
 param_name: name of the parameter : GType of the parameter True if the parameter can be set to NULL
Returns:
The ID of the new expression, or 0 if there was an error.
guint Gnome::Gda::SqlBuilder::add_sub_select ( const SqlStatement sqlst  ) 
void Gnome::Gda::SqlBuilder::compound_add_sub_select ( const SqlStatement sqlst  ) 
static Glib::RefPtr<SqlBuilder> Gnome::Gda::SqlBuilder::create ( SqlStatementType  type  )  [static]
SqlExpr Gnome::Gda::SqlBuilder::export_expression ( guint  id  )  const
SqlStatement Gnome::Gda::SqlBuilder::get_sql_statement (  )  const
Glib::RefPtr<Statement> Gnome::Gda::SqlBuilder::get_statement (  )  const
const GdaSqlBuilder* Gnome::Gda::SqlBuilder::gobj (  )  const [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaSqlBuilder* Gnome::Gda::SqlBuilder::gobj (  )  [inline]

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaSqlBuilder* Gnome::Gda::SqlBuilder::gobj_copy (  ) 

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

guint Gnome::Gda::SqlBuilder::import_expression ( const SqlExpr expr  ) 
void Gnome::Gda::SqlBuilder::join_add_field ( guint  join_id,
const Glib::ustring field_name 
)
guint Gnome::Gda::SqlBuilder::select_add_field ( const Glib::ustring field_name,
const Glib::ustring table_name,
const Glib::ustring alias = Glib::ustring() 
)
guint Gnome::Gda::SqlBuilder::select_add_target ( const Glib::ustring table_name,
const Glib::ustring alias = Glib::ustring() 
)

Adds a new target to a SELECT statement.

Parameters:
table_id The ID of the expression holding a table reference.
alias The alias to give to the target.
Returns:
The ID of the new target, or 0 if there was an error.
guint Gnome::Gda::SqlBuilder::select_add_target_id ( guint  table_id,
const Glib::ustring alias = Glib::ustring() 
)
void Gnome::Gda::SqlBuilder::select_group_by ( guint  expr_id  ) 
guint Gnome::Gda::SqlBuilder::select_join_targets ( guint  left_target_id,
guint  right_target_id,
SqlSelectJoinType  join_type,
guint  join_expr = 0 
)

Joins two targets in a SELECT statement.

Parameters:
left_target_id The ID of the left target to use (not 0)
right_target_id The ID of the right target to use (not 0)
join_type The type of join
join_expr Joining expression's ID, or 0
Returns:
The ID of the new join, or 0 if there was an error.
void Gnome::Gda::SqlBuilder::select_order_by ( guint  expr_id,
bool  asc = true,
const Glib::ustring collation_name = Glib::ustring() 
)
void Gnome::Gda::SqlBuilder::select_set_distinct ( bool  distinct,
guint  expr_id 
)
void Gnome::Gda::SqlBuilder::select_set_distinct ( bool  distinct = true  ) 

Adds or removes a DISTINCT clause for a SELECT statement.

Parameters:
distinct Whether a DISTINCT clause should be in the SELECT statement.
void Gnome::Gda::SqlBuilder::select_set_having ( guint  cond_id  ) 
void Gnome::Gda::SqlBuilder::select_set_limit ( guint  limit_count,
guint  offset = 0 
)

Defines the maximum number of rows in the DataModel resulting from the execution of the built statement.

Parameters:
limit_count The number of rows that should be returned.
The offset of the first row that should appear in the result. (note that this feature may not be supported by all the database providers.)
void Gnome::Gda::SqlBuilder::select_set_limit_id ( guint  limit_count_expr_id,
guint  limit_offest_expr_id = 0 
)
void Gnome::Gda::SqlBuilder::set_table ( const Glib::ustring table_name  ) 
void Gnome::Gda::SqlBuilder::set_where ( guint  cond_id  ) 

Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::SqlBuilder > wrap ( GdaSqlBuilder *  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 on Tue May 25 16:26:53 2010 for libgdamm by  doxygen 1.6.1