# Gnome::Gda::SqlStatement Class Reference

Every SQL statement can be decomposed in the SqlStatement tree structure. More...

Collaboration diagram for Gnome::Gda::SqlStatement:
[legend]

List of all members.

## Public Member Functions

| SqlStatement ()
| SqlStatement (GdaSqlStatement* gobject, bool make_a_copy=true)
| SqlStatement (const SqlStatement& other)
SqlStatement& | operator= (const SqlStatement& other)
| ~SqlStatement ()
void | swap (SqlStatement& other)
GdaSqlStatement* | gobj ()
| Provides access to the underlying C instance.
const GdaSqlStatement* | gobj () const
| Provides access to the underlying C instance.
GdaSqlStatement* | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
| SqlStatement (SqlStatementType type=SQL_STATEMENT_SELECT)
bool | empty () const
Glib::ustring | serialize () const
| Creates a string representation of stmt.
bool | check_structure () const
| Checks for any error in stmt's structure to make sure the statement is valid (for example a SELECT statement must at least return a column, a DELETE statement must specify which table is targeted).
bool | check_validity (const Glib::RefPtr< Connection >& cnc)
| If cnc is not `0`, then checks that all the database objects referenced in the statement actually exist in the connection's database (for example the table being updated in a UPDATE statement must exist in the connection's database for the check to succeed).
void | check_clean ()
| Cleans any data set by a previous call to gda_sql_statement_check_validity().
bool | normalize (const Glib::RefPtr< Connection >& cnc)
| "Normalizes" (in place) some parts of stmt, which means stmt may be modified.

## Static Public Member Functions

static SqlStatementType | string_to_type (const Glib::ustring&type)
| Converts a string to a Gda::SqlStatementType value, see also gda_sql_statement_type_to_string()

## Protected Attributes

GdaSqlStatement* | gobject_

## Related Functions

(Note that these are not member functions.)
void | swap (SqlStatement& lhs, SqlStatement& rhs)
Gnome::Gda::SqlStatement | wrap (GdaSqlStatement* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Every SQL statement can be decomposed in the SqlStatement tree structure.

See the documentation for the underlying GdaSqlStatement.

## Constructor & Destructor Documentation

Gnome::Gda::SqlStatement::SqlStatement | ( | ) |

Gnome::Gda::SqlStatement::SqlStatement | ( | GdaSqlStatement * | gobject,
|  | bool | make_a_copy = `true`
| ) |  | `[explicit]`

Gnome::Gda::SqlStatement::SqlStatement | ( | const SqlStatement& | other ) |

Gnome::Gda::SqlStatement::~SqlStatement | ( | ) |

Gnome::Gda::SqlStatement::SqlStatement | ( | SqlStatementType | type = `SQL_STATEMENT_SELECT` ) | `[explicit]`

## Member Function Documentation

void Gnome::Gda::SqlStatement::check_clean | ( | ) |

Cleans any data set by a previous call to gda_sql_statement_check_validity().

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

Checks for any error in stmt's structure to make sure the statement is valid (for example a SELECT statement must at least return a column, a DELETE statement must specify which table is targeted).

Returns:
  `true` if no error occurred.

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

If cnc is not `0`, then checks that all the database objects referenced in the statement actually exist in the connection's database (for example the table being updated in a UPDATE statement must exist in the connection's database for the check to succeed).

This method fills the stmt->validity_meta_struct attribute.

If cnc is `0`, then remove any information from a previous call to this method stored in stmt. In this case, the stmt->validity_meta_struct attribute is cleared.

Also note that some parts of stmt may be modified: for example leading and trailing spaces in aliases or objects names will be removed.

Parameters:

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

Returns:
  `true` if no error occurred.

bool Gnome::Gda::SqlStatement::empty | ( | ) | const

const GdaSqlStatement* Gnome::Gda::SqlStatement::gobj | ( | ) | const`[inline]`

Provides access to the underlying C instance.

GdaSqlStatement* Gnome::Gda::SqlStatement::gobj | ( | ) | `[inline]`

Provides access to the underlying C instance.

GdaSqlStatement* Gnome::Gda::SqlStatement::gobj_copy | ( | ) | const

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

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

"Normalizes" (in place) some parts of stmt, which means stmt may be modified.

At the moment any "*" field in a SELECT statement will be replaced by one Gda::SqlSelectField structure for each field in the referenced table.

Parameters:

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

Returns:
  `true` if no error occurred.

SqlStatement& Gnome::Gda::SqlStatement::operator= | ( | const SqlStatement& | other ) |

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

Creates a string representation of stmt.

Returns:
  A new string.

static SqlStatementType Gnome::Gda::SqlStatement::string_to_type | ( | const Glib::ustring & | type ) | `[static]`

Converts a string to a Gda::SqlStatementType value, see also gda_sql_statement_type_to_string()

Parameters:

  type | A string representing a Gda::SqlStatementType type.

Returns:
  A Gda::SqlStatementType value.

void Gnome::Gda::SqlStatement::swap | ( | SqlStatement& | other ) |

## Friends And Related Function Documentation

void swap | ( | SqlStatement& | lhs,
|  | SqlStatement& | rhs
| ) |  | `[related]`

Parameters:

  lhs | The left-hand side
  rhs | The right-hand side

Gnome::Gda::SqlStatement wrap | ( | GdaSqlStatement * | 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.

## Member Data Documentation

GdaSqlStatement* Gnome::Gda::SqlStatement::gobject_`[protected]`

The documentation for this class was generated from the following file:

- libgdamm/sqlstatement.h