libgdamm: Gnome::Gda::Connection Class Reference

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

Inheritance diagram for Gnome::Gda::Connection:
Collaboration diagram for Gnome::Gda::Connection:

Public Member Functions

 Connection (Connection&& src) noexcept
 
Connectionoperator= (Connection&& src) noexcept
 
virtual ~Connection () noexcept
 
GdaConnection* gobj ()
 Provides access to the underlying C GObject. More...

 
const GdaConnection* gobj () const
 Provides access to the underlying C GObject. More...

 
GdaConnection* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
bool open ()
 Tries to open the connection. More...

 
void close ()
 Closes the connection to the underlying data source, but first emits the "conn_to_close" signal. More...

 
bool is_opened () const
 Checks whether a connection is open or not. More...

 
ConnectionOptions get_options () const
 Gets the Gda::ConnectionOptions used to open this connection. More...

 
Glib::ustring get_dsn () const
 
Glib::ustring get_cnc_string () const
 Gets the connection string used to open this connection. More...

 
void clear_events_list ()
 This function lets you clear the list of Gda::ConnectionEvent's of the given connection. More...

 
Glib::RefPtr< Glib::Objectstatement_execute (const Glib::RefPtr< const Statement >& stmt, const Glib::RefPtr< const Set >& params, StatementModelUsage model_usage, Glib::RefPtr< const Set >& last_insert_row)
 Executes stmt. More...

 
Glib::RefPtr< Glib::Objectstatement_execute (const Glib::RefPtr< const Statement >& stmt, StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
 
Glib::RefPtr< Glib::Objectstatement_execute (const Glib::ustring& sql, StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
 
Glib::RefPtr< DataModelstatement_execute_select (const Glib::RefPtr< const Statement >& stmt, const Glib::RefPtr< const Set >& params, StatementModelUsage model_usage, const std::vector< GType >& col_types)
 Executes a selection command on the given connection. More...

 
Glib::RefPtr< DataModelstatement_execute_select (const Glib::RefPtr< const Statement >& stmt, StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
 
Glib::RefPtr< DataModelstatement_execute_select (const Glib::ustring& sql, StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
 
Glib::RefPtr< DataModelstatement_execute_select (const Glib::RefPtr< const Statement >& stmt, const Glib::RefPtr< const Set >& params, StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
 
Glib::RefPtr< DataModelstatement_execute_select (const Glib::ustring& sql, const Glib::RefPtr< const Set >& params, StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
 
Glib::RefPtr< DataModelstatement_execute_select_builder (const Glib::RefPtr< const SqlBuilder >& stmt, StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
 
Glib::RefPtr< DataModelstatement_execute_select_builder (const Glib::RefPtr< const SqlBuilder >& stmt, const Glib::RefPtr< const Set >& params, StatementModelUsage model_usage=STATEMENT_MODEL_RANDOM_ACCESS)
 
int statement_execute_non_select (const Glib::RefPtr< const Statement >& stmt, const Glib::RefPtr< const Set >& params, Glib::RefPtr< const Set >& last_insert_row)
 Executes a non-selection statement on the given connection. More...

 
int statement_execute_non_select (const Glib::RefPtr< const Statement >& stmt, const Glib::RefPtr< const Set >& params)
 
int statement_execute_non_select (const Glib::RefPtr< const Statement >& stmt)
 
int statement_execute_non_select (const Glib::ustring& sql)
 
int statement_execute_non_select_builder (const Glib::RefPtr< const SqlBuilder >& builder)
 
int statement_execute_non_select_builder (const Glib::RefPtr< const SqlBuilder >& builder, const Glib::RefPtr< const Set >& params)
 
guint async_statement_execute (const Glib::RefPtr< const Statement >& stmt, const Glib::RefPtr< 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. More...

 
Glib::RefPtr< Glib::Objectasync_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(). More...

 
bool async_cancel (guint task_id)
 Requests that a task be cancelled. More...

 
Glib::RefPtr< const TransactionStatusget_transaction_status () const
 Get the status of cnc regarding transactions. More...

 
bool begin_transaction (const Glib::ustring& name, TransactionIsolation level)
 Starts a transaction on the data source, identified by the name parameter. More...

 
bool commit_transaction (const Glib::ustring& name)
 Commits the given transaction to the backend database. More...

 
bool rollback_transaction (const Glib::ustring& name)
 Rollbacks the given transaction. More...

 
bool add_savepoint (const Glib::ustring& name)
 Adds a SAVEPOINT named name. More...

 
bool rollback_savepoint (const Glib::ustring& name)
 Rollback all the modifications made after the SAVEPOINT named name. More...

 
bool delete_savepoint (const Glib::ustring& name)
 Delete the SAVEPOINT named name when not used anymore. More...

 
std::vector< Glib::RefPtr< ConnectionEvent > > get_events ()
 Retrieves a list of the last errors occurred during the connection. More...

 
std::vector< Glib::RefPtr< const ConnectionEvent > > get_events () const
 Retrieves a list of the last errors occurred during the connection. More...

 
bool insert_row_into_table (const Glib::ustring& table, const std::vector< Glib::ustring >& col_names, const std::vector< Value >& values)
 
bool update_row_in_table (const Glib::ustring& table, const Glib::ustring& condition_column_name, const Value& condition_value, const std::vector< Glib::ustring >& col_names, const std::vector< Value >& values)
 
bool delete_row_from_table (const Glib::ustring& table, const Glib::ustring& condition_column_name, const Value& condition_value)
 
Glib::ustring value_to_sql_string (const Value& from) const
 Produces a fully quoted and escaped string from a GValue. More...

 
bool supports_feature (ConnectionFeature feature) const
 Asks the underlying provider for if a specific feature is supported. More...

 
Glib::ustring get_authentication () const
 Gets the user name used to open this connection. More...

 
Glib::RefPtr< Statementparse_sql_string (const Glib::ustring& sql)
 This helps to parse a SQL string. More...

 
Glib::RefPtr< SqlParsercreate_parser ()
 Creates a new parser object able to parse the SQL dialect understood by cnc. More...

 
Glib::ustring get_provider_name () const
 Gets the name (identifier) of the database provider used by cnc. More...

 
bool update_meta_store ()
 Update the full meta store information. More...

 
bool update_meta_store (const Glib::ustring& id)
 Update the meta store information id. More...

 
bool 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. More...

 
bool update_meta_store_table_names (const Glib::ustring& schema_name=Glib::ustring())
 Update the meta store information for the table names. More...

 
bool update_meta_store_data_types ()
 Update the meta store information for the data types. More...

 
bool statement_prepare (const Glib::RefPtr< const Statement >& stmt)
 Ask the database accessed through the cnc connection to prepare the usage of stmt. More...

 
Glib::RefPtr< DataModelget_meta_store_data (ConnectionMetaType meta_type, const std::vector< Glib::RefPtr< Holder > >& filters)
 see #gda_connection_get_meta_store_data More...

 
Glib::RefPtr< DataModelget_meta_store_data (ConnectionMetaType meta_type)
 
Glib::RefPtr< MetaStoreget_meta_store ()
 Get or initializes the Gda::MetaStore associated to cnc. More...

 
Glib::RefPtr< const MetaStoreget_meta_store () const
 Get or initializes the Gda::MetaStore associated to cnc. More...

 
std::vector< Glib::RefPtr< Glib::Object > > batch_execute (const Glib::RefPtr< Batch >& batch, const Glib::RefPtr< 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. More...

 
Glib::RefPtr< ServerOperationcreate_operation (ServerOperationType type, const Glib::RefPtr< const Set >& options)
 Creates a new Gda::ServerOperation object which can be modified in order to perform the type type of action. More...

 
bool perform_operation (const Glib::RefPtr< ServerOperation >& op)
 Performs the operation described by op (which should have been created using create_operation()). More...

 
Glib::RefPtr< ServerProviderget_provider ()
 Gets a pointer to the Gda::ServerProvider object used to access the database. More...

 
Glib::RefPtr< const ServerProviderget_provider () const
 Gets a pointer to the Gda::ServerProvider object used to access the database. More...

 
Glib::ustring 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. More...

 
Glib::ustring statement_to_sql (const Glib::RefPtr< const Statement >& stmt, const Glib::RefPtr< const Set >& params, StatementSqlFlag flags, std::vector< Glib::RefPtr< Holder > >& params_used) const
 Renders stmt as an SQL statement, adapted to the SQL dialect used by cnc. More...

 
Glib::ustring statement_to_sql (const Glib::RefPtr< const Statement >& stmt, const Glib::RefPtr< 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. More...

 
Glib::ustring statement_to_sql (const Glib::RefPtr< 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. More...

 
Glib::SignalProxy1< void, const Glib::RefPtr< ConnectionEvent >& > signal_error ()
 
Glib::SignalProxy0< void > signal_conn_opened ()
 
Glib::SignalProxy0< void > signal_conn_to_close ()
 
Glib::SignalProxy0< void > signal_conn_closed ()
 
Glib::SignalProxy0< void > signal_dsn_changed ()
 
Glib::SignalProxy0< void > signal_transaction_status_changed ()
 
Glib::PropertyProxy< Glib::RefPtr< ServerProvider > > property_provider ()
 Provider to use. More...

 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ServerProvider > > property_provider () const
 Provider to use. More...

 
Glib::PropertyProxy< Glib::ustringproperty_auth_string ()
 Authentication string to use. More...

 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_auth_string () const
 Authentication string to use. More...

 
Glib::PropertyProxy< Glib::ustringproperty_cnc_string ()
 Connection string to use. More...

 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_cnc_string () const
 Connection string to use. More...

 
Glib::PropertyProxy< Glib::ustringproperty_dsn ()
 DSN to use. More...

 
Glib::PropertyProxy_ReadOnly< Glib::ustringproperty_dsn () const
 DSN to use. More...

 
Glib::PropertyProxy< Glib::RefPtr< MetaStore > > property_meta_store ()
 GdaMetaStore used by the connection. More...

 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< MetaStore > > property_meta_store () const
 GdaMetaStore used by the connection. More...

 
Glib::PropertyProxy< ConnectionOptionsproperty_options ()
 Options. More...

 
Glib::PropertyProxy_ReadOnly< ConnectionOptionsproperty_options () const
 Options. More...

 
Glib::PropertyProxy_ReadOnly< bool > property_is_wrapper () const
 Tells if the connection acts as a thread wrapper around another connection, making it completely thread safe. More...

 
Glib::PropertyProxy< bool > property_monitor_wrapped_in_mainloop ()
 Make the connection set up a monitoring function in the mainloop to monitor the wrapped connection. More...

 
Glib::PropertyProxy_ReadOnly< bool > property_monitor_wrapped_in_mainloop () const
 Make the connection set up a monitoring function in the mainloop to monitor the wrapped connection. More...

 
Glib::PropertyProxy< int > property_events_history_size ()
 
Glib::PropertyProxy_ReadOnly< int > property_events_history_size () const
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
void * get_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
void * steal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
void connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
 
sigc::connection connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObject * gobj ()
 
const GObject * gobj () const
 
GObject * gobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable ()
 
 trackable (const trackable &src)
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (void *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (void *data) const
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 
static Glib::RefPtr< Connectioncreate ()
 
static Glib::RefPtr< Connectioncreate_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 Glib::RefPtr< Connectionopen_from_string (const Glib::ustring& provider_name, const Glib::ustring& cnc_string, const Glib::ustring& auth_string=Glib::ustring(), ConnectionOptions options=CONNECTION_OPTIONS_NONE)
 Opens a connection given a provider ID and a connection string. More...

 

Protected Member Functions

 Connection ()
 
virtual void on_error (const Glib::RefPtr< ConnectionEvent >& error)
 This is a default handler for the signal signal_error(). More...

 
virtual void on_conn_opened ()
 This is a default handler for the signal signal_conn_opened(). More...

 
virtual void on_conn_to_close ()
 This is a default handler for the signal signal_conn_to_close(). More...

 
virtual void on_conn_closed ()
 This is a default handler for the signal signal_conn_closed(). More...

 
virtual void on_dsn_changed ()
 This is a default handler for the signal signal_dsn_changed(). More...

 
virtual void on_transaction_status_changed ()
 This is a default handler for the signal signal_transaction_status_changed(). More...

 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
virtual ~Object () noexcept
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gnome::Gda::Connectionwrap (GdaConnection* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Additional Inherited Members

- Public Types inherited from Glib::Object
typedef void(* DestroyNotify) (gpointer data)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 

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

Gnome::Gda::Connection::Connection ( Connection&&  src)
noexcept
virtual Gnome::Gda::Connection::~Connection ( )
virtualnoexcept
Gnome::Gda::Connection::Connection ( )
protected

Member Function Documentation

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

Adds a SAVEPOINT named name.

Parameters
nameName 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_idA task ID returned by async_statement_execute().
Returns
true if no error occurred.
Glib::RefPtr<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_idA task ID returned by async_statement_execute().
last_insert_rowA 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 Glib::RefPtr< const Statement >&  stmt,
const Glib::RefPtr< 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
stmtA Gda::Statement object.
paramsA Gda::Set object (which can be obtained using Gda::Statement::get_parameters()), or 0.
model_usageIn the case where stmt is a SELECT statement, specifies how the returned data model will be used.
col_typesAn array of GType to request each returned Gda::DataModel's column's GType, terminated with the G_TYPE_NONE.
need_last_insert_rowtrue 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).
std::vector< Glib::RefPtr<Glib::Object> > Gnome::Gda::Connection::batch_execute ( const Glib::RefPtr< Batch >&  batch,
const Glib::RefPtr< 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
batchA Gda::Batch object which contains all the statements to execute.
paramsA Gda::Set object (which can be obtained using Gda::Batch::get_parameters()), or 0.
model_usageSpecifies 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
nameThe name of the transation to start, or 0.
levelThe 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
nameThe name of the transation to commit, or 0.
Returns
true if the transaction was finished successfully, false otherwise.
static Glib::RefPtr<Connection> Gnome::Gda::Connection::create ( )
static
static Glib::RefPtr<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
Glib::RefPtr<ServerOperation> Gnome::Gda::Connection::create_operation ( ServerOperationType  type,
const Glib::RefPtr< 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
typeThe type of operation requested.
optionsAn 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.
Glib::RefPtr<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
nameName 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.
std::vector< Glib::RefPtr<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).
std::vector< Glib::RefPtr<const 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).
Glib::RefPtr<MetaStore> Gnome::Gda::Connection::get_meta_store ( )

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

Returns
A Gda::MetaStore object.
Glib::RefPtr<const MetaStore> Gnome::Gda::Connection::get_meta_store ( ) const

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

Returns
A Gda::MetaStore object.
Glib::RefPtr<DataModel> Gnome::Gda::Connection::get_meta_store_data ( ConnectionMetaType  meta_type,
const std::vector< Glib::RefPtr< Holder > >&  filters 
)

see #gda_connection_get_meta_store_data

Parameters
meta_typeDescribes which data to get.
Aplace to store errors, or 0.
filtersA 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().
Glib::RefPtr<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.
Glib::RefPtr<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).
Glib::RefPtr<const 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.
Glib::RefPtr<const 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.
static GType Gnome::Gda::Connection::get_type ( )
static

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

GdaConnection* Gnome::Gda::Connection::gobj ( )
inline

Provides access to the underlying C GObject.

const GdaConnection* Gnome::Gda::Connection::gobj ( ) const
inline

Provides access to the underlying C GObject.

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 std::vector< Glib::ustring > &  col_names,
const std::vector< 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 ( )
protectedvirtual

This is a default handler for the signal signal_conn_closed().

virtual void Gnome::Gda::Connection::on_conn_opened ( )
protectedvirtual

This is a default handler for the signal signal_conn_opened().

virtual void Gnome::Gda::Connection::on_conn_to_close ( )
protectedvirtual

This is a default handler for the signal signal_conn_to_close().

virtual void Gnome::Gda::Connection::on_dsn_changed ( )
protectedvirtual

This is a default handler for the signal signal_dsn_changed().

virtual void Gnome::Gda::Connection::on_error ( const Glib::RefPtr< ConnectionEvent >&  error)
protectedvirtual

This is a default handler for the signal signal_error().

virtual void Gnome::Gda::Connection::on_transaction_status_changed ( )
protectedvirtual

This is a default handler for the signal signal_transaction_status_changed().

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

Tries to open the connection.

Returns
true if the connection is opened, and false otherwise.
static Glib::RefPtr<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_nameProvider ID to connect to, or 0.
cnc_stringConnection string.
auth_stringAuthentication string, or 0.
optionsOptions for the connection (see Gda::ConnectionOptions).
Returns
A new Gda::Connection if connection opening was sucessfull or 0 if there was an error.
Connection& Gnome::Gda::Connection::operator= ( Connection&&  src)
noexcept
Glib::RefPtr<Statement> Gnome::Gda::Connection::parse_sql_string ( const Glib::ustring sql)

This helps to parse a SQL string.

Parameters
sqlAn 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 Glib::RefPtr< 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
opA Gda::ServerOperation object.
Returns
true if no error occurred.
Glib::PropertyProxy< Glib::ustring > Gnome::Gda::Connection::property_auth_string ( )

Authentication string to use.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gnome::Gda::Connection::property_auth_string ( ) const

Authentication string to use.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< Glib::ustring > Gnome::Gda::Connection::property_cnc_string ( )

Connection string to use.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gnome::Gda::Connection::property_cnc_string ( ) const

Connection string to use.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< Glib::ustring > Gnome::Gda::Connection::property_dsn ( )

DSN to use.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gnome::Gda::Connection::property_dsn ( ) const

DSN to use.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< int > Gnome::Gda::Connection::property_events_history_size ( )
Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< int > Gnome::Gda::Connection::property_events_history_size ( ) const
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, 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.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< Glib::RefPtr<MetaStore> > Gnome::Gda::Connection::property_meta_store ( )

GdaMetaStore used by the connection.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<MetaStore> > Gnome::Gda::Connection::property_meta_store ( ) const

GdaMetaStore used by the connection.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, 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.

Returns
A PropertyProxy that allows you to get or set the value of the property, 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.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< ConnectionOptions > Gnome::Gda::Connection::property_options ( )

Options.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< ConnectionOptions > Gnome::Gda::Connection::property_options ( ) const

Options.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< Glib::RefPtr<ServerProvider> > Gnome::Gda::Connection::property_provider ( )

Provider to use.

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<ServerProvider> > Gnome::Gda::Connection::property_provider ( ) const

Provider to use.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, 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:

  • if id is a reserved SQL keyword (such as SELECT, INSERT, ...)
  • if id contains non allowed characters such as spaces, or if it starts with a digit
  • 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.

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
idAn 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
nameName 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
nameThe 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 ( )
Slot Prototype:
void on_my_conn_closed()
Glib::SignalProxy0< void > Gnome::Gda::Connection::signal_conn_opened ( )
Slot Prototype:
void on_my_conn_opened()
Glib::SignalProxy0< void > Gnome::Gda::Connection::signal_conn_to_close ( )
Slot Prototype:
void on_my_conn_to_close()
Glib::SignalProxy0< void > Gnome::Gda::Connection::signal_dsn_changed ( )
Slot Prototype:
void on_my_dsn_changed()
Glib::SignalProxy1< void,const Glib::RefPtr<ConnectionEvent>& > Gnome::Gda::Connection::signal_error ( )
Slot Prototype:
void on_my_error(const Glib::RefPtr<ConnectionEvent>& error)
Glib::SignalProxy0< void > Gnome::Gda::Connection::signal_transaction_status_changed ( )
Slot Prototype:
void on_my_transaction_status_changed()
Glib::RefPtr<Glib::Object> Gnome::Gda::Connection::statement_execute ( const Glib::RefPtr< const Statement >&  stmt,
const Glib::RefPtr< const Set >&  params,
StatementModelUsage  model_usage,
Glib::RefPtr< const 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:

  • 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.
  • 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"
  • a (GObject) Gda::Holder named "EVENT" which contains a Gda::ConnectionEvent </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:

  • one with the '+0' ID which may for example contain 1 (note that its "name" property should be "id")
  • one with the '+1' ID which will contain 'joe' (note that its "name" property should be "name")

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 params 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 params 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 params 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_NULL). In this case, if (after this method call) any of params' 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
stmtA Gda::Statement object.
paramsA Gda::Set object (which can be obtained using Gda::Statement::get_parameters()), or 0.
model_usageIn the case where stmt is a SELECT statement, specifies how the returned data model will be used.
last_insert_rowA 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::RefPtr<Glib::Object> Gnome::Gda::Connection::statement_execute ( const Glib::RefPtr< const Statement >&  stmt,
StatementModelUsage  model_usage = STATEMENT_MODEL_RANDOM_ACCESS 
)
Glib::RefPtr<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 Glib::RefPtr< const Statement >&  stmt,
const Glib::RefPtr< const Set >&  params,
Glib::RefPtr< const 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 params list of parameters.

See statement_execute() form more information about last_insert_row.

Parameters
stmtA Gda::Statement object.
paramsA Gda::Set object (which can be obtained using Gda::Statement::get_parameters()), or 0.
last_insert_rowA 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 Glib::RefPtr< const Statement >&  stmt,
const Glib::RefPtr< const Set >&  params 
)
int Gnome::Gda::Connection::statement_execute_non_select ( const Glib::RefPtr< 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 Glib::RefPtr< const SqlBuilder >&  builder)
int Gnome::Gda::Connection::statement_execute_non_select_builder ( const Glib::RefPtr< const SqlBuilder >&  builder,
const Glib::RefPtr< const Set >&  params 
)
Glib::RefPtr<DataModel> Gnome::Gda::Connection::statement_execute_select ( const Glib::RefPtr< const Statement >&  stmt,
const Glib::RefPtr< 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 params list of parameters.

Parameters
stmtA Gda::Statement object.
paramsA Gda::Set object (which can be obtained using Gda::Statement::get_parameters()), or 0.
model_usageSpecifies how the returned data model will be used as a Gda::StatementModelUsage enum.
col_typesAn 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.
Glib::RefPtr<DataModel> Gnome::Gda::Connection::statement_execute_select ( const Glib::RefPtr< const Statement >&  stmt,
StatementModelUsage  model_usage = STATEMENT_MODEL_RANDOM_ACCESS 
)
Glib::RefPtr<DataModel> Gnome::Gda::Connection::statement_execute_select ( const Glib::ustring sql,
StatementModelUsage  model_usage = STATEMENT_MODEL_RANDOM_ACCESS 
)
Glib::RefPtr<DataModel> Gnome::Gda::Connection::statement_execute_select ( const Glib::RefPtr< const Statement >&  stmt,
const Glib::RefPtr< const Set >&  params,
StatementModelUsage  model_usage = STATEMENT_MODEL_RANDOM_ACCESS 
)
Glib::RefPtr<DataModel> Gnome::Gda::Connection::statement_execute_select ( const Glib::ustring sql,
const Glib::RefPtr< const Set >&  params,
StatementModelUsage  model_usage = STATEMENT_MODEL_RANDOM_ACCESS 
)
Glib::RefPtr<DataModel> Gnome::Gda::Connection::statement_execute_select_builder ( const Glib::RefPtr< const SqlBuilder >&  stmt,
StatementModelUsage  model_usage = STATEMENT_MODEL_RANDOM_ACCESS 
)
Glib::RefPtr<DataModel> Gnome::Gda::Connection::statement_execute_select_builder ( const Glib::RefPtr< const SqlBuilder >&  stmt,
const Glib::RefPtr< const Set >&  params,
StatementModelUsage  model_usage = STATEMENT_MODEL_RANDOM_ACCESS 
)
bool Gnome::Gda::Connection::statement_prepare ( const Glib::RefPtr< 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
stmtA Gda::Statement object.
Returns
true if no error occurred.
Glib::ustring Gnome::Gda::Connection::statement_to_sql ( const Glib::RefPtr< const Statement >&  stmt,
const Glib::RefPtr< const Set >&  params,
StatementSqlFlag  flags,
std::vector< Glib::RefPtr< Holder > >&  params_used 
) const

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

Parameters
stmtA Gda::Statement object.
paramsA Gda::Set object (which can be obtained using Gda::Statement::get_parameters()), or 0.
flagsSQL rendering flags, as Gda::StatementSqlFlag OR'ed values.
params_usedA place to store the list of individual Gda::Holder objects within params 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
stmtA Statement object.
ASet object (which can be obtained using Statement::get_parameters()).
flagsSQL rendering flags, as StatementSqlFlag OR'ed values
params_usedA 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 Glib::RefPtr< const Statement >&  stmt,
const Glib::RefPtr< 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
stmtA Statement object.
ASet object (which can be obtained using Statement::get_parameters()).
flagsSQL rendering flags, as StatementSqlFlag OR'ed values
Exceptions
ConnectionError
Glib::ustring Gnome::Gda::Connection::statement_to_sql ( const Glib::RefPtr< 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
stmtA Statement object..
flagsSQL 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
featureFeature 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
idAn 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_nameName of the table where the information is needed
schema_nameName 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_nameName 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 std::vector< Glib::ustring > &  col_names,
const std::vector< 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
fromValue to convert from.
Returns
Escaped and quoted value or 0 if not supported.

Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::Connection > wrap ( GdaConnection *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse 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