# Gnome::Gda::SqlBuilder Class Reference

Inherits Glib::Object.

Collaboration diagram for Gnome::Gda::SqlBuilder:
[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< Statement > | get_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.
void | 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_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 | 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)
## Static Public Member Functions
static Glib::RefPtr< SqlBuilder > | create (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,
|  | 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.

static Glib::RefPtr<SqlBuilder> Gnome::Gda::SqlBuilder::create | ( | SqlStatementType | type | ) | `[static]`

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.

void Gnome::Gda::SqlBuilder::join_add_field | ( | guint | join_id,
|  | const Glib::ustring & | field_name |
| ) |  |  |

void 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_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::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:

- libgdamm/sqlbuilder.h