Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions

# Gnome::Gda::Statement Class Reference

Single SQL statement. More...

Inheritance diagram for Gnome::Gda::Statement:
[legend]
Collaboration diagram for Gnome::Gda::Statement:
[legend]

List of all members.

## Public Types
typedef Glib::ListHandle < const Glib::RefPtr< Holder > > | HolderSList
## Public Member Functions
virtual | ~Statement ()
GdaStatement* | gobj ()
| Provides access to the underlying C GObject.
const GdaStatement* | gobj () const
| Provides access to the underlying C GObject.
GdaStatement* | 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 > | copy () const
| Copy constructor.
Glib::ustring | serialize () const
| Creates a string representing the contents of stmt.
bool | get_parameters (Glib::RefPtr< Set >& out_params)
| Get a new Gda::Set object which groups all the execution parameters which stmt needs.
Glib::ustring | to_sql () const
Glib::ustring | to_sql (const Glib::RefPtr< const Set >& params) const
Glib::ustring | to_sql (const Glib::RefPtr< Connection >& cnc, const Glib::RefPtr< const Set >& params, StatementSqlFlag flags, const HolderSList& params_used) const
| Renders stmt as an SQL statement, with some control on how it is rendered.
SqlStatementType | get_statement_type () const
| Get the type of statement held by stmt.
bool | is_useless () const
| Tells if stmt is composed only of spaces (that is it has no real SQL code), and is completely useless as such.
bool | check_structure () const
| Checks that stmt's structure is correct.
bool | check_validity (const Glib::RefPtr< Connection >& cnc) const
| If cnc is not `0` then checks that every object (table, field, function) used in stmt actually exists in cnc's database.
bool | normalize (const Glib::RefPtr< Connection >& cnc)
| "Normalizes" some parts of stmt, see gda_sql_statement_normalize() for more information.
Glib::PropertyProxy< gpointer > | property_structure ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly < gpointer > | property_structure () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::SignalProxy2< void, const Glib::RefPtr< Connection > &, bool > | signal_checked ()
Glib::SignalProxy0< void > | signal_reset ()
## Static Public Member Functions
static Glib::RefPtr< Statement > | create ()
## Protected Member Functions
| Statement ()
virtual void | on_checked (const Glib::RefPtr< Connection >& cnc, bool valid)
virtual void | on_reset ()
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr < Gnome::Gda::Statement > | wrap (GdaStatement* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Single SQL statement.

The Gda::Statement represents a single SQL statement (multiple statements can be grouped in a Batch object).

A Gda::Statement can either be built "manually" by building a Gda::SqlStatement structure, or from an SQL statement using a Gda::SqlParser object. A GdaConnection can use a GdaStatement to:

- prepare it for a future execution, the preparation step involves converting the GdaStatement object into a structure used by the database's own API, see Gda::Connection::statement_prepare()
- execute it using Gda::Connection::statement_execute_select() if it is known that the statement is a selection statement, Gda::Connection::statement_execute_non_select() if it is not a selection statement, or Gda::Connection::statement_execute() when the type of expected result is unknown. Note that it is possible to use the same Gda::Statement object at the same time with several Gda::Connection objects.

## Member Typedef Documentation

typedef Glib::ListHandle< const Glib::RefPtr<Holder> > Gnome::Gda::Statement::HolderSList

## Constructor & Destructor Documentation

virtual Gnome::Gda::Statement::~Statement | ( | ) | `[virtual]`

Gnome::Gda::Statement::Statement | ( | ) | `[protected]`

## Member Function Documentation

bool Gnome::Gda::Statement::check_structure | ( | ) | const

Checks that stmt's structure is correct.

Returns:
  `true` if stmt's structure is correct.

bool Gnome::Gda::Statement::check_validity | ( | const Glib::RefPtr< Connection >& | cnc ) | const

If cnc is not `0` then checks that every object (table, field, function) used in stmt actually exists in cnc's database.

If cnc is `0`, then cleans anything related to cnc in stmt.

See gda_sql_statement_check_validity() for more information.

Parameters:

  cnc | A Gda::Connection object, or `0`.

Returns:
  `true` if every object actually exists in cnc's database.

Glib::RefPtr<Statement> Gnome::Gda::Statement::copy | ( | ) | const

Copy constructor.

Returns:
  A the new copy of orig.

static Glib::RefPtr<Statement> Gnome::Gda::Statement::create | ( | ) | `[static]`

bool Gnome::Gda::Statement::get_parameters | ( | Glib::RefPtr< Set >& | out_params ) |

Get a new Gda::Set object which groups all the execution parameters which stmt needs.

This new object is returned though out_params.

Note that if stmt does not need any parameter, then out_params is set to `0`.

Parameters:

  out_params | A place to store a new Gda::Set object, or `0`.

Returns:
  `true` if no error occurred.

SqlStatementType Gnome::Gda::Statement::get_statement_type | ( | ) | const

Get the type of statement held by stmt.

It returns GDA_SQL_STATEMENT_NONE if stmt does not hold any statement

Returns:
  The statement type.

const GdaStatement* Gnome::Gda::Statement::gobj | ( | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaStatement* Gnome::Gda::Statement::gobj | ( | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaStatement* Gnome::Gda::Statement::gobj_copy | ( | ) |

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

bool Gnome::Gda::Statement::is_useless | ( | ) | const

Tells if stmt is composed only of spaces (that is it has no real SQL code), and is completely useless as such.

Returns:
  `true` if executing stmt does nothing.

bool Gnome::Gda::Statement::normalize | ( | const Glib::RefPtr< Connection >& | cnc ) |

"Normalizes" some parts of stmt, see gda_sql_statement_normalize() for more information.

Parameters:

  cnc | A Gda::Connection object.

Returns:
  `true` if no error occurred.

virtual void Gnome::Gda::Statement::on_checked | ( | const Glib::RefPtr< Connection >& | cnc,
|  | bool | valid
| ) |  | `[protected, virtual]`

virtual void Gnome::Gda::Statement::on_reset | ( | ) | `[protected, virtual]`

Glib::PropertyProxy_ReadOnly<gpointer> Gnome::Gda::Statement::property_structure | ( | ) | const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<gpointer> Gnome::Gda::Statement::property_structure | ( | ) |

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::ustring Gnome::Gda::Statement::serialize | ( | ) | const

Creates a string representing the contents of stmt.

Returns:
  A string containing the serialized version of stmt.

Glib::SignalProxy2< void,const Glib::RefPtr<Connection>&,bool > Gnome::Gda::Statement::signal_checked | ( | ) |

Prototype:
  `void on_my_checked(const Glib::RefPtr<Connection>& cnc, bool valid)`

Glib::SignalProxy0< void > Gnome::Gda::Statement::signal_reset | ( | ) |

Prototype:
  `void on_my_reset()`

Glib::ustring Gnome::Gda::Statement::to_sql | ( | const Glib::RefPtr< const Set >& | params ) | const

Glib::ustring Gnome::Gda::Statement::to_sql | ( | const Glib::RefPtr< Connection >& | cnc,
|  | const Glib::RefPtr< const Set >& | params,
|  | StatementSqlFlag | flags,
|  | const HolderSList & | params_used
| ) |  | const

Renders stmt as an SQL statement, with some control on how it is rendered.

If cnc is not `0`, then the rendered SQL will better be suited to be used by cnc (in particular it may include some SQL tweaks and/or proprietary extensions specific to the database engine used by cnc): in this case the result is similar to calling Gda::Connection::statement_to_sql().

Parameters:

  cnc | A Gda::Connection object, or `0`.
  params | Parameters contained in a single Gda::Set object.
  flags | A set of flags to control the rendering.
  params_used | A place to store the list of actual Gda::Holder objects in used to do the rendering, or `0`.

Returns:
  A new string if no error occurred.

Glib::ustring Gnome::Gda::Statement::to_sql | ( | ) | const

## Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::Statement > wrap | ( | GdaStatement * | 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/statement.h