Gnome::Gda::SqlStatement Class Reference

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

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

## Public Member Functions

| SqlStatement ()
| SqlStatement (GdaSqlStatement* gobject, bool make_a_copy=true)
| SqlStatement (const SqlStatement& other)
SqlStatement& | operator= (const SqlStatement& other)
| SqlStatement (SqlStatement&& other) noexcept
SqlStatement& | operator= (SqlStatement&& other) noexcept
| ~SqlStatement () noexcept
void | swap (SqlStatement& other) noexcept
GdaSqlStatement* | gobj ()
| Provides access to the underlying C instance. More...
const GdaSqlStatement* | gobj () const
| Provides access to the underlying C instance. More...
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. More...
| SqlStatement (SqlStatementType type=SQL_STATEMENT_SELECT)
bool | empty () const
Glib::ustring | serialize () const
| Creates a string representation of stmt. More...
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). More...
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). More...
void | check_clean ()
| Cleans any data set by a previous call to gda_sql_statement_check_validity(). More...
bool | normalize (const Glib::RefPtr< Connection >& cnc)
| "Normalizes" (in place) some parts of stmt, which means stmt may be modified. More...

## Static Public Member Functions

static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
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() More...

## Protected Attributes

GdaSqlStatement* | gobject_

## Related Functions

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

## 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 | ( | SqlStatement&& | other | ) |

noexcept

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

noexcept

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

static GType Gnome::Gda::SqlStatement::get_type | ( |  | ) |

static

Get the GType for this class, for use with the underlying GObject type system.

GdaSqlStatement* Gnome::Gda::SqlStatement::gobj | ( |  | ) |

inline

Provides access to the underlying C instance.

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

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 | ) |

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

noexcept

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 | ) |

noexcept

## 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