Gnome::Gda::SqlBuilder Class Reference

Inherits Glib::Object.

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

List of all members.

Public Types

typedef guint Id

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
Id add_id (const Glib::ustring&string)
Id add_field_id (const Glib::ustring& field_name, const Glib::ustring& table_name=Glib::ustring())
template<class ValueType >
Id 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.
Id 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 >
Id add_expr (const ValueType&value)
 Defines an expression in Builder which may be reused to build other parts of a statement.
Id add_expr_as_value (const Value&value)
 Defines an expression in Builder which may be reused to build other parts of a statement.
Id 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.
Id add_cond (SqlOperatorType op, Id op1, Id op2=0, Id op3=0)
 Builds a new expression which reprenents a condition (or operation).
Id add_cond (SqlOperatorType op, const Glib::ArrayHandle< Id >& op_ids)
 Builds a new expression which reprenents a condition (or operation).
Id add_function (const Glib::ustring& function_name, const Glib::ArrayHandle< Id >& args)
 Builds a new expression which represents a function applied to some arguments.
Id add_function (const Glib::ustring& function_name, Id arg)
 Builds a new expression which represents a function applied to an argument.
Id add_sub_select (const SqlStatement& sqlst)
Id select_add_field (const Glib::ustring& field_name, const Glib::ustring& table_name, const Glib::ustring& alias=Glib::ustring())
Id select_add_target (const Glib::ustring& table_name, const Glib::ustring& alias=Glib::ustring())
 Adds a new target to a SELECT statement.
Id select_add_target_id (Id table_id, const Glib::ustring& alias=Glib::ustring())
Id select_join_targets (Id left_target_id, Id right_target_id, SqlSelectJoinType join_type, Id join_expr=0)
 Joins two targets in a SELECT statement.
void join_add_field (Id join_id, const Glib::ustring& field_name)
void select_order_by (Id 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, Id expr_id)
void select_set_limit (Id limit_count, Id offset=0)
 Defines the maximum number of rows in the DataModel resulting from the execution of the built statement.
void select_set_limit_id (Id limit_count_expr_id, Id limit_offest_expr_id=0)
void select_set_having (Id cond_id)
void select_group_by (Id expr_id)
void set_table (const Glib::ustring& table_name)
void set_where (Id cond_id)
void add_field_value_id (Id field_id, Id 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 (Id id) const
Id 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.

Member Typedef Documentation


Constructor & Destructor Documentation

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

Member Function Documentation

Id Gnome::Gda::SqlBuilder::add_cond ( SqlOperatorType  op,
const Glib::ArrayHandle< Id >&  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.
Id Gnome::Gda::SqlBuilder::add_cond ( SqlOperatorType  op,
Id  op1,
Id  op2 = 0,
Id  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 >
Id 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 >
Id 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.
Id 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.
Id 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.
Id Gnome::Gda::SqlBuilder::add_field_id ( const Glib::ustring field_name,
const Glib::ustring table_name = Glib::ustring() 
)
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 
)
void Gnome::Gda::SqlBuilder::add_field_value_id ( Id  field_id,
Id  value_id = 0 
)
Id Gnome::Gda::SqlBuilder::add_function ( const Glib::ustring function_name,
Id  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.
Id Gnome::Gda::SqlBuilder::add_function ( const Glib::ustring function_name,
const Glib::ArrayHandle< Id >&  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.
Id Gnome::Gda::SqlBuilder::add_id ( const Glib::ustring string  ) 
Id 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.
Id 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 ( Id  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.

Id Gnome::Gda::SqlBuilder::import_expression ( const SqlExpr expr  ) 
void Gnome::Gda::SqlBuilder::join_add_field ( Id  join_id,
const Glib::ustring field_name 
)
Id Gnome::Gda::SqlBuilder::select_add_field ( const Glib::ustring field_name,
const Glib::ustring table_name,
const Glib::ustring alias = Glib::ustring() 
)
Id 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.
Id Gnome::Gda::SqlBuilder::select_add_target_id ( Id  table_id,
const Glib::ustring alias = Glib::ustring() 
)
void Gnome::Gda::SqlBuilder::select_group_by ( Id  expr_id  ) 
Id Gnome::Gda::SqlBuilder::select_join_targets ( Id  left_target_id,
Id  right_target_id,
SqlSelectJoinType  join_type,
Id  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 ( Id  expr_id,
bool  asc = true,
const Glib::ustring collation_name = Glib::ustring() 
)
void Gnome::Gda::SqlBuilder::select_set_distinct ( bool  distinct,
Id  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 ( Id  cond_id  ) 
void Gnome::Gda::SqlBuilder::select_set_limit ( Id  limit_count,
Id  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 ( Id  limit_count_expr_id,
Id  limit_offest_expr_id = 0 
)
void Gnome::Gda::SqlBuilder::set_table ( const Glib::ustring table_name  ) 
void Gnome::Gda::SqlBuilder::set_where ( Id  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 Fri Aug 6 18:07:47 2010 for libgdamm by  doxygen 1.6.1