libgdamm 4.99.6

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions
Gnome::Gda::Connection Class Reference

Manages a connection to a data source. More...

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

List of all members.

## Public Member Functions

virtual | ~Connection ()
GdaConnection* | gobj ()
| Provides access to the underlying C GObject.
const GdaConnection* | gobj () const
| Provides access to the underlying C GObject.
GdaConnection* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool | open ()
| Tries to open the connection.
void | close ()
| Closes the connection to the underlying data source, but first emits the "conn_to_close" signal.
bool | is_opened () const
| Checks whether a connection is open or not.
ConnectionOptions | get_options () const
| Gets the Gda::ConnectionOptions used to open this connection.
get_dsn () const
get_cnc_string () const
| Gets the connection string used to open this connection.
void | clear_events_list ()
| This function lets you clear the list of Gda::ConnectionEvent's of the given connection.
Set >& last_insert_row)
| Executes stmt.
StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
std::vector< GType >& col_types)
| Executes a selection command on the given connection.
StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
int | statement_execute_non_select (const Set >& last_insert_row)
| Executes a non-selection statement on the given connection.
int | statement_execute_non_select (const Set >& params)
int | statement_execute_non_select (const Statement >& stmt)
int | statement_execute_non_select (const Glib::ustring& sql)
int | statement_execute_non_select_builder (const SqlBuilder >& builder)
int | statement_execute_non_select_builder (const Set >& params)
guint | async_statement_execute (const std::vector< GType >& col_types, bool need_last_insert_row=false)
| This method is similar to statement_execute() but is asynchronous as it method returns immediately with a task ID.
async_fetch_result (guint task_id, GdaSet** last_insert_row)
| Use this method to obtain the result of the execution of a statement which has been executed asynchronously by calling async_statement_execute().
bool | async_cancel (guint task_id)
| Requests that a task be cancelled.
TransactionStatus > | get_transaction_status () const
| Get the status of cnc regarding transactions.
bool | begin_transaction (const TransactionIsolation level)
| Starts a transaction on the data source, identified by the name parameter.
bool | commit_transaction (const Glib::ustring& name)
| Commits the given transaction to the backend database.
bool | rollback_transaction (const Glib::ustring& name)
| Rollbacks the given transaction.
bool | add_savepoint (const Glib::ustring& name)
| Adds a SAVEPOINT named name.
bool | rollback_savepoint (const Glib::ustring& name)
| Rollback all the modifications made after the SAVEPOINT named name.
bool | delete_savepoint (const Glib::ustring& name)
| Delete the SAVEPOINT named name when not used anymore.
< ConnectionEvent > > | get_events ()
| Retrieves a list of the last errors occurred during the connection.
< const ConnectionEvent > > | get_events () const
| Retrieves a list of the last errors occurred during the connection.
bool | insert_row_into_table (const Value >& values)
bool | update_row_in_table (const Value >& values)
bool | delete_row_from_table (const Value& condition_value)
Value& from) const
| Produces a fully quoted and escaped string from a GValue.
bool | supports_feature (ConnectionFeature feature) const
| Asks the underlying provider for if a specific feature is supported.
get_authentication () const
| Gets the user name used to open this connection.
Glib::ustring& sql)
| This helps to parse a SQL string.
create_parser ()
| Creates a new parser object able to parse the SQL dialect understood by cnc.
get_provider_name () const
| Gets the name (identifier) of the database provider used by cnc.
bool | update_meta_store ()
| Update the full meta store information.
bool | update_meta_store (const Glib::ustring& id)
| Update the meta store information id.
bool | update_meta_store_table (const Glib::ustring())
| Update the meta store information for the table named table_name.
bool | update_meta_store_table_names (const Glib::ustring())
| Update the meta store information for the table names.
bool | update_meta_store_data_types ()
| Update the meta store information for the data types.
bool | statement_prepare (const Statement >& stmt)
| Ask the database accessed through the cnc connection to prepare the usage of stmt.
Holder > >& filters)
| see #gda_connection_get_meta_store_data
ConnectionMetaType meta_type)
get_meta_store ()
| Get or initializes the Gda::MetaStore associated to cnc.
get_meta_store () const
| Get or initializes the Gda::MetaStore associated to cnc.
< StatementModelUsage model_usage)
| Executes all the statements contained in batch (in the order in which they were added to batch), and returns a list of Object objects, at most one Object for each statement; see statement_execute() for details about the returned objects.
Set >& options)
| Creates a new Gda::ServerOperation object which can be modified in order to perform the type type of action.
bool | perform_operation (const ServerOperation >& op)
| Performs the operation described by op (which should have been created using create_operation()).
get_provider ()
| Gets a pointer to the Gda::ServerProvider object used to access the database.
ServerProvider > | get_provider () const
| Gets a pointer to the Gda::ServerProvider object used to access the database.
Glib::ustring& id) const
| Use this method to get a correctly quoted (if necessary) SQL identifier which can be used in SQL statements, from id.
Holder > >& params_used) const
| Renders stmt as an SQL statement, adapted to the SQL dialect used by cnc.
StatementSqlFlag flags=STATEMENT_SQL_PARAMS_AS_VALUES) const
| Renders a Statement as a SQL statement string, adapted to the SQL dialect used by the connection.
StatementSqlFlag flags=STATEMENT_SQL_PARAMS_AS_VALUES) const
| Renders a Statement as a SQL statement string, adapted to the SQL dialect used by the connection.
const < ConnectionEvent >& > | signal_error ()
signal_conn_opened ()
signal_conn_to_close ()
signal_conn_closed ()
signal_dsn_changed ()
signal_transaction_status_changed ()
< property_provider ()
| Provider to use.
< property_provider () const
| Provider to use.
< property_auth_string ()
| Authentication string to use.
< property_auth_string () const
| Authentication string to use.
< property_cnc_string ()
| Connection string to use.
< property_cnc_string () const
| Connection string to use.
< property_dsn ()
| DSN to use.
< property_dsn () const
| DSN to use.
< property_meta_store ()
| GdaMetaStore used by the connection.
< property_meta_store () const
| GdaMetaStore used by the connection.
< ConnectionOptions > | property_options ()
| Options.
< ConnectionOptions > | property_options () const
| Options.
< bool > | property_is_wrapper () const
| Tells if the connection acts as a thread wrapper around another connection, making it completely thread safe.
property_monitor_wrapped_in_mainloop ()
| Make the connection set up a monitoring function in the mainloop to monitor the wrapped connection.
< bool > | property_monitor_wrapped_in_mainloop () const
| Make the connection set up a monitoring function in the mainloop to monitor the wrapped connection.
property_events_history_size ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
property_events_history_size () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.

## Static Public Member Functions

static create ()
static ConnectionOptions options=CONNECTION_OPTIONS_NONE)
static ConnectionOptions options=CONNECTION_OPTIONS_NONE)
| Opens a connection given a provider ID and a connection string.

## Protected Member Functions

| Connection ()
virtual void | on_error (const ConnectionEvent >& error)
virtual void | on_conn_opened ()
virtual void | on_conn_to_close ()
virtual void | on_conn_closed ()
virtual void | on_dsn_changed ()
virtual void | on_transaction_status_changed ()

## Related Functions

(Note that these are not member functions.)
< Gnome::Gda::Connection > | wrap (GdaConnection* object, bool take_copy=false)
| A

## Detailed Description

Manages a connection to a data source.

This class offers access to all operations involving an opened connection to a database. Connection objects are obtained via the Client class.

Once obtained, applications can use a Connection to execute commands, run transactions, and get information about all objects stored in the underlying database.

## Constructor & Destructor Documentation

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

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

## Member Function Documentation

bool Gnome::Gda::Connection::add_savepoint | ( | const Glib::ustring & | name | ) |

Adds a SAVEPOINT named name.

Parameters:

  name | Name of the savepoint to add.

Returns:
  `true` if no error occurred.

bool Gnome::Gda::Connection::async_cancel | ( | guint | task_id | ) |

Requests that a task be cancelled.

This operation may of may not have any effect depending on the task's status, even if it returns `true`. If it returns `false`, then the task has not been cancelled.

Since libgdamm 4.2:

Parameters:

  task_id | A task ID returned by async_statement_execute().

Returns:
  `true` if no error occurred.

Glib::Object> Gnome::Gda::Connection::async_fetch_result | ( | guint | task_id,
|  | GdaSet ** | last_insert_row
| ) |  |

Use this method to obtain the result of the execution of a statement which has been executed asynchronously by calling async_statement_execute().

This function is non locking and will return `0` (and no error will be set) if the statement has not been executed yet.

If the statement has been executed, this method returns the same value as statement_execute() would have if the statement had been executed synchronously.

Since libgdamm 4.2:

Parameters:

  task_id | A task ID returned by async_statement_execute().
  last_insert_row | A place to store a new Gda::Set object which contains the values of the last inserted row, or `0`.

Returns:
  A Object, or `0` if an error occurred.

guint Gnome::Gda::Connection::async_statement_execute | ( | const Statement >& | stmt,
|  | const Set >& | params,
|  | StatementModelUsage | model_usage,
|  | const std::vector< GType > & | col_types,
|  | bool | need_last_insert_row = `false`
| ) |  |

This method is similar to statement_execute() but is asynchronous as it method returns immediately with a task ID.

It's up to the caller to use async_fetch_result() regularly to check if the statement's execution is finished.

It is possible to call the method several times to request several statements to be executed asynchronously, the statements will be executed in the order in which they were requested.

The parameters, if present, are copied and can be discarded or modified before the statement is actually executed. The stmt object is not copied but simply referenced (for performance reasons), and if it is modified before it is actually executed, then its execution will not occur. It is however safe to call Glib::object_unref() on it if it's not needed anymore.

The execution failure of any statement has no impact on the execution of other statements except for example if the connection has a transaction started and the failure invalidates the transaction (as decided by the database server).

Since libgdamm 4.2:

Parameters:

  stmt | A Gda::Statement object.
  params | A Gda::Set object (which can be obtained using Gda::Statement::get_parameters()), or `0`.
  model_usage | In the case where stmt is a SELECT statement, specifies how the returned data model will be used.
  col_types | An array of GType to request each returned Gda::DataModel's column's GType, terminated with the G_TYPE_NONE.
  need_last_insert_row | `true` if the values of the last interted row must be computed.

Returns:
  A task ID, or 0 if an error occurred (not an error regarding stmt itself as its execution has not yet started but any other error).

Glib::Object> > Gnome::Gda::Connection::batch_execute | ( | const Batch >& | batch,
|  | const Set >& | params,
|  | StatementModelUsage | model_usage
| ) |  |

Executes all the statements contained in batch (in the order in which they were added to batch), and returns a list of Object objects, at most one Object for each statement; see statement_execute() for details about the returned objects.

If one of the statement fails, then none of the subsequent statement will be executed, and the method returns the list of Object created by the correct execution of the previous statements. If a transaction is required, then it should be started before calling this method.

Parameters:

  batch | A Gda::Batch object which contains all the statements to execute.
  params | A Gda::Set object (which can be obtained using Gda::Batch::get_parameters()), or `0`.
  model_usage | Specifies how the returned data model(s) will be used, as a Gda::StatementModelUsage enum.

Returns:
  A new list of Object objects.

bool Gnome::Gda::Connection::begin_transaction | ( | const Glib::ustring & | name,
|  | TransactionIsolation | level
| ) |  |

Starts a transaction on the data source, identified by the name parameter.

Before starting a transaction, you can check whether the underlying provider does support transactions or not by using the supports_feature() function.

Parameters:

  name | The name of the transation to start, or `0`.
  level | The requested transaction level (Gda::TRANSACTION_ISOLATION_UNKNOWN if not specified).

Returns:
  `true` if the transaction was started successfully, `false` otherwise.

void Gnome::Gda::Connection::clear_events_list | ( |  | ) |

This function lets you clear the list of Gda::ConnectionEvent's of the given connection.

void Gnome::Gda::Connection::close | ( |  | ) |

Closes the connection to the underlying data source, but first emits the "conn_to_close" signal.

bool Gnome::Gda::Connection::commit_transaction | ( | const Glib::ustring & | name | ) |

Commits the given transaction to the backend database.

You need to call begin_transaction() first.

Parameters:

  name | The name of the transation to commit, or `0`.

Returns:
  `true` if the transaction was finished successfully, `false` otherwise.

static Connection> Gnome::Gda::Connection::create | ( |  | ) | `[static]`

static Connection> Gnome::Gda::Connection::create_from_string | ( | const Glib::ustring & | provider_name,
|  | const Glib::ustring & | cnc_string,
|  | const Glib::ustring & | auth_string = `Glib::ustring()`,
|  | ConnectionOptions | options = `CONNECTION_OPTIONS_NONE`
| ) |  | `[static]`

ServerOperation> Gnome::Gda::Connection::create_operation | ( | ServerOperationType | type,
|  | const Set >& | options
| ) |  |

Creates a new Gda::ServerOperation object which can be modified in order to perform the type type of action.

It is a wrapper around the Gda::ServerProvider::create_operation() method.

Parameters:

  type | The type of operation requested.
  options | An optional list of parameters.

Returns:
  A new Gda::ServerOperation object, or `0` in the connection's provider does not support the type type of operation or if an error occurred.

SqlParser> Gnome::Gda::Connection::create_parser | ( |  | ) |

Creates a new parser object able to parse the SQL dialect understood by cnc.

If the Gda::ServerProvider object internally used by cnc does not have its own parser, then `0` is returned, and a general SQL parser can be obtained using Gda::SqlParser::new().

Returns:
  A new Gda::SqlParser object, or `0`.

bool Gnome::Gda::Connection::delete_row_from_table | ( | const Glib::ustring & | table,
|  | const Glib::ustring & | condition_column_name,
|  | const Value& | condition_value
| ) |  |

bool Gnome::Gda::Connection::delete_savepoint | ( | const Glib::ustring & | name | ) |

Delete the SAVEPOINT named name when not used anymore.

Parameters:

  name | Name of the savepoint to delete.

Returns:
  `true` if no error occurred.

Glib::ustring Gnome::Gda::Connection::get_authentication | ( |  | ) | const

Gets the user name used to open this connection.

Returns:
  The user name.

Glib::ustring Gnome::Gda::Connection::get_cnc_string | ( |  | ) | const

Gets the connection string used to open this connection.

The connection string is the string sent over to the underlying database provider, which describes the parameters to be used to open a connection on the underlying data source.

Returns:
  The connection string used when opening the connection.

Glib::ustring Gnome::Gda::Connection::get_dsn | ( |  | ) | const

Returns:
  The data source name the connection object is connected to.

ConnectionEvent> > Gnome::Gda::Connection::get_events | ( |  | ) |

Retrieves a list of the last errors occurred during the connection.

The returned list is chronologically ordered such as that the most recent event is the Gda::ConnectionEvent of the first node.

Warning: the cnc object may change the list if connection events occur

Returns:
  A List of Gda::ConnectionEvent objects (the list should not be modified).

ConnectionEvent> > Gnome::Gda::Connection::get_events | ( |  | ) | const

Retrieves a list of the last errors occurred during the connection.

The returned list is chronologically ordered such as that the most recent event is the Gda::ConnectionEvent of the first node.

Warning: the cnc object may change the list if connection events occur

Returns:
  A List of Gda::ConnectionEvent objects (the list should not be modified).

MetaStore> Gnome::Gda::Connection::get_meta_store | ( |  | ) |

Get or initializes the Gda::MetaStore associated to cnc.

Returns:
  A Gda::MetaStore object.

MetaStore> Gnome::Gda::Connection::get_meta_store | ( |  | ) | const

Get or initializes the Gda::MetaStore associated to cnc.

Returns:
  A Gda::MetaStore object.

DataModel> Gnome::Gda::Connection::get_meta_store_data | ( | ConnectionMetaType | meta_type,
|  | const Holder > >& | filters
| ) |  |

see #gda_connection_get_meta_store_data

Parameters:

  meta_type | Describes which data to get.
  filters | A List of Gda::Holder objects.

Returns:
  A Gda::DataModel containing the data required. The caller is responsible for freeing the returned model using Glib::object_unref().

DataModel> Gnome::Gda::Connection::get_meta_store_data | ( | ConnectionMetaType | meta_type | ) |

ConnectionOptions Gnome::Gda::Connection::get_options | ( |  | ) | const

Gets the Gda::ConnectionOptions used to open this connection.

Returns:
  The connection options.

ServerProvider> Gnome::Gda::Connection::get_provider | ( |  | ) |

Gets a pointer to the Gda::ServerProvider object used to access the database.

Returns:
  The Gda::ServerProvider (NEVER `0`).

ServerProvider> Gnome::Gda::Connection::get_provider | ( |  | ) | const

Gets a pointer to the Gda::ServerProvider object used to access the database.

Returns:
  The Gda::ServerProvider (NEVER `0`).

Glib::ustring Gnome::Gda::Connection::get_provider_name | ( |  | ) | const

Gets the name (identifier) of the database provider used by cnc.

Returns:
  A non modifiable string.

TransactionStatus> Gnome::Gda::Connection::get_transaction_status | ( |  | ) | const

Get the status of cnc regarding transactions.

The returned object should not be modified or destroyed; however it may be modified or destroyed by the connection itself.

If `0` is returned, then no transaction has been associated with cnc

Returns:
  A Gda::TransactionStatus object, or `0`.

GdaConnection* Gnome::Gda::Connection::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

const GdaConnection* Gnome::Gda::Connection::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaConnection* Gnome::Gda::Connection::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::Connection::insert_row_into_table | ( | const Glib::ustring & | table,
|  | const Glib::ustring > & | col_names,
|  | const Value >& | values
| ) |  |

bool Gnome::Gda::Connection::is_opened | ( |  | ) | const

Checks whether a connection is open or not.

Returns:
  `true` if the connection is open, `false` if it's not.

virtual void Gnome::Gda::Connection::on_conn_closed | ( |  | ) | `[protected, virtual]`

virtual void Gnome::Gda::Connection::on_conn_opened | ( |  | ) | `[protected, virtual]`

virtual void Gnome::Gda::Connection::on_conn_to_close | ( |  | ) | `[protected, virtual]`

virtual void Gnome::Gda::Connection::on_dsn_changed | ( |  | ) | `[protected, virtual]`

virtual void Gnome::Gda::Connection::on_error | ( | const ConnectionEvent >& | error | ) | `[protected, virtual]`

virtual void Gnome::Gda::Connection::on_transaction_status_changed | ( |  | ) | `[protected, virtual]`

bool Gnome::Gda::Connection::open | ( |  | ) |

Tries to open the connection.

Returns:
  `true` if the connection is opened, and `false` otherwise.

static Connection> Gnome::Gda::Connection::open_from_string | ( | const Glib::ustring & | provider_name,
|  | const Glib::ustring & | cnc_string,
|  | const Glib::ustring & | auth_string = `Glib::ustring()`,
|  | ConnectionOptions | options = `CONNECTION_OPTIONS_NONE`
| ) |  | `[static]`

Opens a connection given a provider ID and a connection string.

This allows applications to open connections without having to create a data source (DSN) in the configuration. The format of cnc_string is similar to PostgreSQL and MySQL connection strings. It is a semicolumn-separated series of <key>=

pairs, where each key and value are encoded as per RFC 1738, see gda_rfc1738_encode() for more information.

The possible keys depend on the provider, the "gda-sql-4.0 -L" command can be used to list the actual keys for each installed database provider.

For example the connection string to open an SQLite connection to a database file named "my_data.db" in the current directory would be `"DB_DIR=.;DB_NAME=my_data"`.

The cnc_string string must have the following format: "[<provider>://][<username>[:<password>]@]<connection_params>" (if <username> and/or <password> are provided, and auth_string is `0`, then these username and passwords will be used, and if <provider> is provided and provider_name is `0` then this provider will be used). Note that if provided, <username>, <password> and <provider> must be encoded as per RFC 1738, see gda_rfc1738_encode() for more information.

The auth_string must contain the authentication information for the server to accept the connection. It is a string containing semi-colon seperated named values, usually like "USERNAME=...;PASSWORD=..." where the ... are replaced by actual values. Note that each name and value must be encoded as per RFC 1738, see gda_rfc1738_encode() for more information.

The actual named parameters required depend on the provider being used, and that list is available as the <parameter>auth_params</parameter> member of the Gda::ProviderInfo structure for each installed provider (use Gda::Config::get_provider_info() to get it). Similarly to the format of the connection string, use the "gda-sql-4.0 -L" command to list the possible named parameters.

Additionally, it is possible to have the connection string respect the "<provider_name>://<real cnc string>" format, in which case the provider name and the real connection string will be extracted from that string (note that if provider_name is not `0` then it will still be used as the provider ID).\

This method may fail with a GDA_CONNECTION_ERROR domain error (see the Gda::ConnectionError error codes) or a Gda::CONFIG_ERROR domain error (see the Gda::ConfigError error codes).

Parameters:

  provider_name | Provider ID to connect to, or `0`.
  cnc_string | Connection string.
  auth_string | Authentication string, or `0`.
  options | Options for the connection (see Gda::ConnectionOptions).

Returns:
  A new Gda::Connection if connection opening was sucessfull or `0` if there was an error.

Statement> Gnome::Gda::Connection::parse_sql_string | ( | const Glib::ustring & | sql | ) |

This helps to parse a SQL string.

Parameters:

  sql | An SQL command to parse.

Returns:
  A Statement representing the SQL command or an empty RefPtr if an error occurred.

bool Gnome::Gda::Connection::perform_operation | ( | const ServerOperation >& | op | ) |

Performs the operation described by op (which should have been created using create_operation()).

It is a wrapper around the Gda::ServerProvider::perform_operation() method.

Parameters:

  op | A Gda::ServerOperation object.

Returns:
  `true` if no error occurred.

Glib::ustring> Gnome::Gda::Connection::property_auth_string | ( |  | ) |

Authentication string to use.

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::Connection::property_auth_string | ( |  | ) | const

Authentication string to use.

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::Connection::property_cnc_string | ( |  | ) |

Connection string to use.

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::Connection::property_cnc_string | ( |  | ) | const

Connection string to use.

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::Connection::property_dsn | ( |  | ) |

DSN to use.

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::Connection::property_dsn | ( |  | ) | const

DSN to use.

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<int> Gnome::Gda::Connection::property_events_history_size | ( |  | ) |

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_ReadOnly<int> Gnome::Gda::Connection::property_events_history_size | ( |  | ) | 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_ReadOnly<bool> Gnome::Gda::Connection::property_is_wrapper | ( |  | ) | const

Tells if the connection acts as a thread wrapper around another connection, making it completely thread safe.

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.

MetaStore> > Gnome::Gda::Connection::property_meta_store | ( |  | ) |

GdaMetaStore used by the connection.

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.

MetaStore> > Gnome::Gda::Connection::property_meta_store | ( |  | ) | const

GdaMetaStore used by the connection.

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<bool> Gnome::Gda::Connection::property_monitor_wrapped_in_mainloop | ( |  | ) |

Make the connection set up a monitoring function in the mainloop to monitor the wrapped connection.

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_ReadOnly<bool> Gnome::Gda::Connection::property_monitor_wrapped_in_mainloop | ( |  | ) | const

Make the connection set up a monitoring function in the mainloop to monitor the wrapped connection.

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.

ConnectionOptions> Gnome::Gda::Connection::property_options | ( |  | ) |

Options.

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.

ConnectionOptions> Gnome::Gda::Connection::property_options | ( |  | ) | const

Options.

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.

ServerProvider> > Gnome::Gda::Connection::property_provider | ( |  | ) |

Provider to use.

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.

ServerProvider> > Gnome::Gda::Connection::property_provider | ( |  | ) | const

Provider to use.

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::Connection::quote_sql_identifier | ( | const Glib::ustring & | id | ) | const

Use this method to get a correctly quoted (if necessary) SQL identifier which can be used in SQL statements, from id.

If id is already correctly quoted for cnc, then a copy of id may be returned.

This method may add double quotes (or other characters) around id: <itemizedlist> <listitem>if id is a reserved SQL keyword (such as SELECT, INSERT, ...)</listitem> <listitem>if id contains non allowed characters such as spaces, or if it starts with a digit</listitem> <listitem>in any other event as necessary for cnc, depending on the the options passed when opening the cnc connection, and specifically the GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE option.</listitem> </itemizedlist>

One can safely pass an already quoted id to this method, either with quoting characters allowed by cnc or using the double quote (") character.

{4,0}.3

Parameters:

  id | An SQL identifier.

Returns:
  A new string, to free with Glib::free() once not needed anymore.

bool Gnome::Gda::Connection::rollback_savepoint | ( | const Glib::ustring & | name | ) |

Rollback all the modifications made after the SAVEPOINT named name.

Parameters:

  name | Name of the savepoint to rollback to.

Returns:
  `true` if no error occurred.

bool Gnome::Gda::Connection::rollback_transaction | ( | const Glib::ustring & | name | ) |

Rollbacks the given transaction.

This means that all changes made to the underlying data source since the last call to begin_transaction() or commit_transaction() will be discarded.

Parameters:

  name | The name of the transation to commit, or `0`.

Returns:
  `true` if the operation was successful, `false` otherwise.

Glib::SignalProxy0< void > Gnome::Gda::Connection::signal_conn_closed | ( |  | ) |

Prototype:
  `void on_my_conn_closed()`

Glib::SignalProxy0< void > Gnome::Gda::Connection::signal_conn_opened | ( |  | ) |

Prototype:
  `void on_my_conn_opened()`

Glib::SignalProxy0< void > Gnome::Gda::Connection::signal_conn_to_close | ( |  | ) |

Prototype:
  `void on_my_conn_to_close()`

Glib::SignalProxy0< void > Gnome::Gda::Connection::signal_dsn_changed | ( |  | ) |

Prototype:
  `void on_my_dsn_changed()`

ConnectionEvent>& > Gnome::Gda::Connection::signal_error | ( |  | ) |

Prototype:
  `void on_my_error(const Glib::RefPtr<ConnectionEvent>& error)`

Glib::SignalProxy0< void > Gnome::Gda::Connection::signal_transaction_status_changed | ( |  | ) |

Prototype:
  `void on_my_transaction_status_changed()`

Glib::Object> Gnome::Gda::Connection::statement_execute | ( | const Statement >& | stmt,
|  | const Set >& | params,
|  | StatementModelUsage | model_usage,
|  | Set >& | last_insert_row
| ) |  |

Executes stmt.

As stmt can, by desing (and if not abused), contain only one SQL statement, the return object will either be: <itemizedlist> <listitem>a Gda::DataSelect object (which is also a Gda::DataModel) if stmt is a SELECT statement (usually a GDA_SQL_STATEMENT_SELECT, see Gda::SqlStatementType) containing the results of the SELECT. The resulting data model is by default read only, but modifications can be enabled, see the Gda::DataSelect's documentation for more information.</listitem> <listitem>a Gda::Set for any other SQL statement which correctly executed. In this case (if the provider supports it), then the Gda::Set may contain value holders named: <itemizedlist> <listitem>a (`int`) Gda::Holder named "IMPACTED_ROWS"</listitem> <listitem>a (GObject) Gda::Holder named "EVENT" which contains a Gda::ConnectionEvent</listitem> </itemizedlist></listitem> </itemizedlist>

If last_insert_row is not `0` and stmt is an INSERT statement, then it will contain (if the provider used by cnc supports it) a new Gda::Set object composed of value holders named "+<column number>" starting at column 0 which contain the actual inserted values. For example if a table is composed of an 'id' column which is auto incremented and a 'name' column then the execution of a "INSERT INTO mytable (name) VALUES ('joe')" query will return a Gda::Set with two holders: <itemizedlist> <listitem>one with the '+0' ID which may for example contain 1 (note that its "name" property should be "id")</listitem> <listitem>one with the '+1' ID which will contain 'joe' (note that its "name" property should be "name")</listitem> </itemizedlist>

This method may fail with a Gda::SERVER_PROVIDER_ERROR domain error (see the Gda::ServerProviderError error codes).

Note:
  If stmt is a SELECT statement which has some parameters and if is `0`, then the statement can't be executed and this method will return `0`.
  If stmt is a SELECT statement which has some parameters and if is not `0` but contains some invalid parameters, then the statement can't be executed and this method will return `0`, unless the model_usage has the GDA_STATEMENT_MODEL_ALLOW_NOPARAM flag.
  If stmt is a SELECT statement which has some parameters and if is not `0` but contains some invalid parameters and if model_usage has the GDA_STATEMENT_MODEL_ALLOW_NOPARAM flag, then the returned data model will contain no row but will have all the correct columns (even though some of the columns might report as GDA_TYPE_`0`). In this case, if (after this method call) any of ' parameters change then the resulting data model will re-run itself, see the GdaDataSelect's auto-reset property for more information.
  if model_usage does not contain the GDA_STATEMENT_MODEL_RANDOM_ACCESS or GDA_STATEMENT_MODEL_CURSOR_FORWARD flags, then the default will be to return a random access data model
  If stmt is a SELECT statement which returns blob values (of type Gda::TYPE_BLOB), then an implicit transaction will have been started by the database provider, and it's up to the caller to close the transaction (which will then be locked) once all the blob ressources have been liberated (when the returned data model is destroyed). See the section about Binary large objects (BLOBs) for more information.

Also see the provider's limitations, and the Advanced GdaDataSelect usage sections.

Parameters:

  stmt | A Gda::Statement object.
  params | A Gda::Set object (which can be obtained using Gda::Statement::get_parameters()), or `0`.
  model_usage | In the case where stmt is a SELECT statement, specifies how the returned data model will be used.
  last_insert_row | A place to store a new Gda::Set object which contains the values of the last inserted row, or `0`.

Returns:
  A Object, or `0` if an error occurred.

Glib::Object> Gnome::Gda::Connection::statement_execute | ( | const Statement >& | stmt,
|  | StatementModelUsage | model_usage = `STATEMENT_MODEL_RANDOM_ACCESS`
| ) |  |

Glib::Object> Gnome::Gda::Connection::statement_execute | ( | const Glib::ustring & | sql,
|  | StatementModelUsage | model_usage = `STATEMENT_MODEL_RANDOM_ACCESS`
| ) |  |

int Gnome::Gda::Connection::statement_execute_non_select | ( | const Statement >& | stmt,
|  | const Set >& | params,
|  | Set >& | last_insert_row
| ) |  |

Executes a non-selection statement on the given connection.

The gda_execute_non_select_command() method can be easier to use if one prefers to use some SQL directly.

This function returns the number of rows affected by the execution of stmt, or -1 if an error occurred, or -2 if the connection's provider does not return the number of rows affected.

This function is just a convenience function around the statement_execute() function. See the documentation of the statement_execute() for information about the list of parameters.

See statement_execute() form more information about last_insert_row.

Parameters:

  stmt | A Gda::Statement object.
  params | A Gda::Set object (which can be obtained using Gda::Statement::get_parameters()), or `0`.
  last_insert_row | A place to store a new Gda::Set object which contains the values of the last inserted row, or `0`.

Returns:
  The number of rows affected (>=0) or -1 or -2.

int Gnome::Gda::Connection::statement_execute_non_select | ( | const Statement >& | stmt,
|  | const Set >& | params
| ) |  |

int Gnome::Gda::Connection::statement_execute_non_select | ( | const Statement >& | stmt | ) |

int Gnome::Gda::Connection::statement_execute_non_select | ( | const Glib::ustring & | sql | ) |

int Gnome::Gda::Connection::statement_execute_non_select_builder | ( | const SqlBuilder >& | builder | ) |

int Gnome::Gda::Connection::statement_execute_non_select_builder | ( | const SqlBuilder >& | builder,
|  | const Set >& | params
| ) |  |

DataModel> Gnome::Gda::Connection::statement_execute_select | ( | const Statement >& | stmt,
|  | const Set >& | params,
|  | StatementModelUsage | model_usage,
|  | const std::vector< GType > & | col_types
| ) |  |

Executes a selection command on the given connection.

This function returns a Gda::DataModel resulting from the SELECT statement, or `0` if an error occurred.

This function is just a convenience function around the statement_execute() function.

See the documentation of the statement_execute() for information about the list of parameters.

Parameters:

  stmt | A Gda::Statement object.
  params | A Gda::Set object (which can be obtained using Gda::Statement::get_parameters()), or `0`.
  model_usage | Specifies how the returned data model will be used as a Gda::StatementModelUsage enum.
  col_types | An array of GType to request each returned Gda::DataModel's column's GType, terminated with the G_TYPE_NONE value. Any value left to 0 will make the database provider determine the real GType. col_types can also be `0` if no column type is specified.

Returns:
  A Gda::DataModel containing the data returned by the data source, or `0` if an error occurred.

DataModel> Gnome::Gda::Connection::statement_execute_select | ( | const Statement >& | stmt,
|  | StatementModelUsage | model_usage = `STATEMENT_MODEL_RANDOM_ACCESS`
| ) |  |

DataModel> Gnome::Gda::Connection::statement_execute_select | ( | const Glib::ustring & | sql,
|  | StatementModelUsage | model_usage = `STATEMENT_MODEL_RANDOM_ACCESS`
| ) |  |

DataModel> Gnome::Gda::Connection::statement_execute_select | ( | const Statement >& | stmt,
|  | const Set >& | params,
|  | StatementModelUsage | model_usage = `STATEMENT_MODEL_RANDOM_ACCESS`
| ) |  |

DataModel> Gnome::Gda::Connection::statement_execute_select | ( | const Glib::ustring & | sql,
|  | const Set >& | params,
|  | StatementModelUsage | model_usage = `STATEMENT_MODEL_RANDOM_ACCESS`
| ) |  |

DataModel> Gnome::Gda::Connection::statement_execute_select_builder | ( | const SqlBuilder >& | stmt,
|  | StatementModelUsage | model_usage = `STATEMENT_MODEL_RANDOM_ACCESS`
| ) |  |

DataModel> Gnome::Gda::Connection::statement_execute_select_builder | ( | const SqlBuilder >& | stmt,
|  | const Set >& | params,
|  | StatementModelUsage | model_usage = `STATEMENT_MODEL_RANDOM_ACCESS`
| ) |  |

bool Gnome::Gda::Connection::statement_prepare | ( | const Statement >& | stmt | ) |

Ask the database accessed through the cnc connection to prepare the usage of stmt.

This is only useful if stmt will be used more than once (however some database providers may always prepare statements before executing them).

This function is also useful to make sure stmt is fully understood by the database before actually executing it.

Note however that it is also possible that statement_prepare() fails when statement_execute() does not fail (this will usually be the case with statements such as <![CDATA["SELECT* FROM ##tablename::string"]]> because database usually don't allow variables to be used in place of a table name).

Parameters:

  stmt | A Gda::Statement object.

Returns:
  `true` if no error occurred.

Glib::ustring Gnome::Gda::Connection::statement_to_sql | ( | const Statement >& | stmt,
|  | const Set >& | params,
|  | StatementSqlFlag | flags,
|  | Holder > >& | params_used
| ) |  | const

Renders stmt as an SQL statement, adapted to the SQL dialect used by cnc.

Parameters:

  stmt | A Gda::Statement object.
  params | A Gda::Set object (which can be obtained using Gda::Statement::get_parameters()), or `0`.
  flags | SQL rendering flags, as Gda::StatementSqlFlag OR'ed values.
  params_used | A place to store the list of individual Gda::Holder objects within which have been used.

Returns:
  A new string, or `0` if an error occurred. Renders a Statement as a SQL statement string, adapted to the SQL dialect used by the connection.

Parameters:

  stmt | A Statement object.
  A | Set object (which can be obtained using Statement::get_parameters()).
  flags | SQL rendering flags, as StatementSqlFlag OR'ed values
  params_used | A place to store the list of individual Holder objects within params which have been used.

Exceptions:

  ConnectionError |

Glib::ustring Gnome::Gda::Connection::statement_to_sql | ( | const Statement >& | stmt,
|  | const Set >& | params,
|  | StatementSqlFlag | flags = `STATEMENT_SQL_PARAMS_AS_VALUES`
| ) |  | const

Renders a Statement as a SQL statement string, adapted to the SQL dialect used by the connection.

Parameters:

  stmt | A Statement object.
  A | Set object (which can be obtained using Statement::get_parameters()).
  flags | SQL rendering flags, as StatementSqlFlag OR'ed values

Exceptions:

  ConnectionError |

Glib::ustring Gnome::Gda::Connection::statement_to_sql | ( | const Statement >& | stmt,
|  | StatementSqlFlag | flags = `STATEMENT_SQL_PARAMS_AS_VALUES`
| ) |  | const

Renders a Statement as a SQL statement string, adapted to the SQL dialect used by the connection.

Parameters:

  stmt | A Statement object..
  flags | SQL rendering flags, as StatementSqlFlag OR'ed values

Exceptions:

  ConnectionError |

bool Gnome::Gda::Connection::supports_feature | ( | ConnectionFeature | feature | ) | const

Asks the underlying provider for if a specific feature is supported.

Parameters:

  feature | Feature to ask for.

Returns:
  `true` if the provider supports it, `false` if not.

bool Gnome::Gda::Connection::update_meta_store | ( |  | ) |

Update the full meta store information.

Note that this may take some time for big databases

Returns:
  `true` if no error occurred.

bool Gnome::Gda::Connection::update_meta_store | ( | const Glib::ustring & | id | ) |

Update the meta store information id.

This can speed up the update of the meta store if you only need a specific information

Parameters:

  id | An id for the information to update (see http://library.gnome.org/devel/libgda/unstable/information_schema.html)

Returns:
  `true` if no error occurred.

bool Gnome::Gda::Connection::update_meta_store_data_types | ( |  | ) |

Update the meta store information for the data types.

This can speed up the update of the meta store if you only need the data types.

Returns:
  `true` if no error occurred.

bool Gnome::Gda::Connection::update_meta_store_table | ( | const Glib::ustring & | table_name,
|  | const Glib::ustring & | schema_name = `Glib::ustring()`
| ) |  |

Update the meta store information for the table named table_name.

This can speed up the update of the meta store if you only need the information for a specific table

Parameters:

  table_name | Name of the table where the information is needed
  schema_name | Name of the schema is in, or "" to update all tables with the given name. As with update_meta_store_table_names(), specifying a non-empty schema_name speeds up the operation, just not as significantly as with update_meta_store_table_names() because the operation itself is already pretty quick.

Returns:
  `true` if no error occurred.

bool Gnome::Gda::Connection::update_meta_store_table_names | ( | const Glib::ustring & | schema_name = `Glib::ustring()` | ) |

Update the meta store information for the table names.

This can speed up the update of the meta store if you only need the list of table names.

Parameters:

  schema_name

  Name of the schema whose tables to update, or "" to update all tables. For example, for postgresql this function takes a considerable amount of time when doing this. If you don't need information about internal postgresql tables, then you can speed up the process by only updating the tables for the "public" schema. Unfortunately, schema names are not common between different database systems.

Returns:
  `true` if no error occurred.

bool Gnome::Gda::Connection::update_row_in_table | ( | const Glib::ustring & | table,
|  | const Glib::ustring & | condition_column_name,
|  | const Value& | condition_value,
|  | const Glib::ustring > & | col_names,
|  | const Value >& | values
| ) |  |

Glib::ustring Gnome::Gda::Connection::value_to_sql_string | ( | const Value& | from | ) | const

Produces a fully quoted and escaped string from a GValue.

Parameters:

  from | Value to convert from.

Returns:
  Escaped and quoted value or `0` if not supported.

## Friends And Related Function Documentation

Gnome::Gda::Connection > wrap | ( | GdaConnection * | 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/connection.h