## GdaConnection GdaConnection — A connection to a database |

## Synopsis

                        GdaConnection;
    enum                GdaConnectionOptions;
    enum                GdaConnectionError;
    #define             GDA_CONNECTION_ERROR
    GdaConnection *     gda_connection_open_from_dsn        (const gchar *dsn,
                                                             const gchar *auth_string,
                                                             GdaConnectionOptions options,
                                                             GError **error);
    GdaConnection *     gda_connection_open_from_string     (const gchar *provider_name,
                                                             const gchar *cnc_string,
                                                             const gchar *auth_string,
                                                             GdaConnectionOptions options,
                                                             GError **error);
    gboolean            gda_connection_open                 (GdaConnection *cnc,
                                                             GError **error);
    void                gda_connection_close                (GdaConnection *cnc);
    void                gda_connection_close_no_warning     (GdaConnection *cnc);
    gboolean            gda_connection_is_opened            (GdaConnection *cnc);

    GdaSqlParser *      gda_connection_create_parser        (GdaConnection *cnc);
    gchar *             gda_connection_value_to_sql_string  (GdaConnection *cnc,
                                                             GValue *from);
    gchar *             gda_connection_quote_sql_identifier (GdaConnection *cnc,
                                                             const gchar *id);
    gchar *             gda_connection_statement_to_sql     (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaStatementSqlFlag flags,
                                                             GSList **params_used,
                                                             GError **error);
    gboolean            gda_connection_statement_prepare    (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GError **error);
    GObject *           gda_connection_statement_execute    (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaStatementModelUsage model_usage,
                                                             GdaSet **last_insert_row,
                                                             GError **error);
    GdaDataModel *      gda_connection_statement_execute_select
                                                            (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GError **error);
    GdaDataModel *      gda_connection_statement_execute_select_full
                                                            (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaStatementModelUsage model_usage,
                                                             GType *col_types,
                                                             GError **error);
    GdaDataModel *      gda_connection_statement_execute_select_fullv
                                                            (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaStatementModelUsage model_usage,
                                                             GError **error,
                                                             ...);
    gint                gda_connection_statement_execute_non_select
                                                            (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaSet **last_insert_row,
                                                             GError **error);
    GSList *            gda_connection_repetitive_statement_execute
                                                            (GdaConnection *cnc,
                                                             GdaRepetitiveStatement *rstmt,
                                                             GdaStatementModelUsage model_usage,
                                                             GType *col_types,
                                                             gboolean stop_on_error,
                                                             GError **error);
    GSList *            gda_connection_batch_execute        (GdaConnection *cnc,
                                                             GdaBatch *batch,
                                                             GdaSet *params,
                                                             GdaStatementModelUsage model_usage,
                                                             GError **error);
    gboolean            gda_connection_begin_transaction    (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GdaTransactionIsolation level,
                                                             GError **error);
    gboolean            gda_connection_commit_transaction   (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GError **error);
    gboolean            gda_connection_rollback_transaction (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GError **error);
    gboolean            gda_connection_add_savepoint        (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GError **error);
    gboolean            gda_connection_rollback_savepoint   (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GError **error);
    gboolean            gda_connection_delete_savepoint     (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GError **error);

    guint               gda_connection_async_statement_execute
                                                            (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaStatementModelUsage model_usage,
                                                             GType *col_types,
                                                             gboolean need_last_insert_row,
                                                             GError **error);
    GObject *           gda_connection_async_fetch_result   (GdaConnection *cnc,
                                                             guint task_id,
                                                             GdaSet **last_insert_row,
                                                             GError **error);
    gboolean            gda_connection_async_cancel         (GdaConnection *cnc,
                                                             guint task_id,
                                                             GError **error);

    GdaTransactionStatus * gda_connection_get_transaction_status
                                                            (GdaConnection *cnc);
    GdaConnectionOptions  gda_connection_get_options        (GdaConnection *cnc);
    GdaServerProvider * gda_connection_get_provider         (GdaConnection *cnc);
    const gchar *       gda_connection_get_provider_name    (GdaConnection *cnc);
    const gchar *       gda_connection_get_dsn              (GdaConnection *cnc);
    const gchar *       gda_connection_get_cnc_string       (GdaConnection *cnc);
    const gchar *       gda_connection_get_authentication   (GdaConnection *cnc);

    const GList *       gda_connection_get_events           (GdaConnection *cnc);

    GdaServerOperation * gda_connection_create_operation    (GdaConnection *cnc,
                                                             GdaServerOperationType type,
                                                             GdaSet *options,
                                                             GError **error);
    gboolean            gda_connection_perform_operation    (GdaConnection *cnc,
                                                             GdaServerOperation *op,
                                                             GError **error);

    enum                GdaConnectionFeature;
    gboolean            gda_connection_supports_feature     (GdaConnection *cnc,
                                                             GdaConnectionFeature feature);
    GdaMetaStore *      gda_connection_get_meta_store       (GdaConnection *cnc);
    gboolean            gda_connection_update_meta_store    (GdaConnection *cnc,
                                                             GdaMetaContext *context,
                                                             GError **error);
    enum                GdaConnectionMetaType;
    GdaDataModel *      gda_connection_get_meta_store_data  (GdaConnection *cnc,
                                                             GdaConnectionMetaType meta_type,
                                                             GError **error,
                                                             gint nb_filters,
                                                             ...);
    GdaDataModel *      gda_connection_get_meta_store_data_v
                                                            (GdaConnection *cnc,
                                                             GdaConnectionMetaType meta_type,
                                                             GList *filters,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----GdaConnection
             +----GdaVirtualConnection

## Implemented Interfaces

GdaConnection implements GdaLockable.

## Properties

      "auth-string"              gchar*                : Read / Write
      "cnc-string"               gchar*                : Read / Write
      "dsn"                      gchar*                : Read / Write
      "events-history-size"      gint                  : Read / Write
      "is-wrapper"               gboolean              : Read / Write / Construct Only
      "meta-store"               GdaMetaStore*         : Read / Write
      "monitor-wrapped-in-mainloop" gboolean              : Read / Write
      "options"                  GdaConnectionOptions  : Read / Write
      "provider"                 GdaServerProvider*    : Read / Write
      "thread-owner"             gpointer              : Read / Write

## Signals

      "conn-closed"                                    : Run Last
      "conn-opened"                                    : Run First
      "conn-to-close"                                  : Run First
      "dsn-changed"                                    : Run Last
      "error"                                          : Run Last
      "transaction-status-changed"                     : Run Last

## Description

Each connection to a database is represented by a GdaConnection object. A connection is created (and opened) using `gda_connection_open_from_dsn()` if a data source has been defined, or `gda_connection_open_from_string()` otherwise. It is not recommended to create a GdaConnection object using `g_object_new()` as the results are unpredictable (some parts won't correctly be initialized).

Use the connection object to execute statements, use transactions, get meta data information, ...

If supported by the database provider being used, statements can be executed asynchronously instead of blocking the execution thread untill the execution of a statement is finished. Each database provider is free to implement this feature as it wishes (using the API or using threads). The steps involved to execute a statement are then:

- Request the statement execution using `gda_connection_async_statement_execute()` which returns an execution ID to be used to identify a specific request

- Do some useful things (that is why async. statements' excution are for)

- Use one or more times `gda_connection_async_fetch_result()` to see if the execution is finished, using the request ID

- Use `gda_connection_async_cancel()` to cancel the execution of a statement

The GdaConnection object implements its own locking mechanism so it is thread-safe. However ad some database providers rely on an API which does not support threads or supports it only partially, the connections opened using those providers will only be accessible from the thread which created them (any other thread will be blocked trying to access the connection, use the `gda_lockable_try_lock()` method to check it the connection is usable from a thread).

If a connection really needs to be accessed by several threads at once, then it is possible to pass the GDA_CONNECTION_OPTIONS_THREAD_SAFE flag when opening it. This flag requests that the real connection be created and really accessed in a private sub thread.

## Details

### GdaConnection

    typedef struct _GdaConnection GdaConnection;

### enum GdaConnectionOptions

    typedef enum {
    	GDA_CONNECTION_OPTIONS_NONE = 0,
    	GDA_CONNECTION_OPTIONS_READ_ONLY = 1 << 0,
    	GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE = 1 << 1,
    	GDA_CONNECTION_OPTIONS_THREAD_SAFE = 1 << 2,
    	GDA_CONNECTION_OPTIONS_THREAD_ISOLATED = 1 << 3,
    	GDA_CONNECTION_OPTIONS_AUTO_META_DATA = 1 << 4
    } GdaConnectionOptions;

Specifies some aspects of a connection when opening it.

Additional information about the GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE flag:

- For example without this flag, if the table name specified in a GdaServerOperation to create a table is MyTable, then usually the database will create a table named mytable, whereas with this flag, the table will be created as MyTable (note that in the end the database may still decide to name the table mytable or differently if it can't do otherwise).

- Libgda will not apply this rule when parsing SQL code, the SQL code being parsed has to be conform to the database it will be used with

Additional information about the GDA_CONNECTION_OPTIONS_THREAD_SAFE and GDA_CONNECTION_OPTIONS_THREAD_ISOLATED flags: The GDA_CONNECTION_OPTIONS_THREAD_SAFE flag specifies that it has to be able to use the returned connection object from several threads at once (locking is ensured by the GdaConnection itself). Depending on the database provider's implementation and on the native libraries it uses, the "normal" connection object might not respect this requirement, and in this case a specific thread is started and used as the unique thread which will manipulate the actual connection, while a "wrapper connection" is actually returned and used by the caller (that wrapper connection passes method calls from the calling thread to the actual connection's specific thread, and gets the results back).

The GDA_CONNECTION_OPTIONS_THREAD_ISOLATED forces using a specific thread and a "wrapper connection" even if the "normal" connection would itself be thread safe; this is usefull for example to be sure the asynchronous API can always be used (see `gda_connection_async_statement_execute()`).

Having a specific thread and a "wrapper connection" definitely has an impact on the performances (because it involves messages passing between threads for every method call), so using the GDA_CONNECTION_OPTIONS_THREAD_SAFE or GDA_CONNECTION_OPTIONS_THREAD_ISOLATED flags should be carefully considered.

Note about the `GDA_CONNECTION_OPTIONS_AUTO_META_DATA` flag:

- Every time a DDL statement is successfully executed, the associated mate data, if defined, will be updated, which has a impact on performances

- If a transaction is started and some DDL statements are executed and the transaction is not rolled back or committed, then the meta data may end up being wrong

`GDA_CONNECTION_OPTIONS_NONE` | no specific aspect
`GDA_CONNECTION_OPTIONS_READ_ONLY` | this flag specifies that the connection to open should be in a read-only mode (this policy is not correctly enforced at the moment)
`GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE` | this flag specifies that SQL identifiers submitted as input to Libgda have to keep their case sensitivity.
`GDA_CONNECTION_OPTIONS_THREAD_SAFE` | this flag specifies that the connection to open will be used by several threads at once so it has to be thread safe
`GDA_CONNECTION_OPTIONS_THREAD_ISOLATED` | this flag specifies that the connection to open will be used by several threads at once and requests that the real connection be used only in a sub thread created specifically for it
`GDA_CONNECTION_OPTIONS_AUTO_META_DATA` | this flags specifies that if a GdaMetaStore has been associated to the connection, then it is kept up to date with the evolutions in the database's structure. Be aware however that there are some drawbacks explained below.

### enum GdaConnectionError

    typedef enum {
    	GDA_CONNECTION_DSN_NOT_FOUND_ERROR,
    	GDA_CONNECTION_PROVIDER_NOT_FOUND_ERROR,
    	GDA_CONNECTION_PROVIDER_ERROR,
    	GDA_CONNECTION_NO_CNC_SPEC_ERROR,
    	GDA_CONNECTION_NO_PROVIDER_SPEC_ERROR,
    	GDA_CONNECTION_OPEN_ERROR,
    	GDA_CONNECTION_STATEMENT_TYPE_ERROR,
    	GDA_CONNECTION_CANT_LOCK_ERROR,
    	GDA_CONNECTION_TASK_NOT_FOUND_ERROR,
    	GDA_CONNECTION_UNSUPPORTED_THREADS_ERROR,
    	GDA_CONNECTION_CLOSED_ERROR
    } GdaConnectionError;

### GDA_CONNECTION_ERROR

    #define GDA_CONNECTION_ERROR gda_connection_error_quark ()

### gda_connection_open_from_dsn ()

    GdaConnection *     gda_connection_open_from_dsn        (const gchar *dsn,
                                                             const gchar *auth_string,
                                                             GdaConnectionOptions options,
                                                             GError **error);

This function is the way of opening database connections with libgda, using a pre-defined data source (DSN), see `gda_config_define_dsn()` for more information about how to define a DSN. If you don't want to define a DSN, it is possible to use `gda_connection_open_from_string()` instead of this method.

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

The `auth_string` can contain the authentication information for the server to accept the connection. It is a string containing semi-colon seperated named value, 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 `auth_params` member of the GdaProviderInfo structure for each installed provider (use `gda_config_get_provider_info()` to get it). Also one can use the "gda-sql-4.0 -L" command to list the possible named parameters.

This method may fail with a GDA_CONNECTION_ERROR domain error (see the GdaConnectionError error codes) or a `GDA_CONFIG_ERROR` domain error (see the GdaConfigError error codes).

`dsn` : | data source name.
`auth_string` : | authentication string, or `NULL`
`options` : | options for the connection (see GdaConnectionOptions).
`error` : | a place to store an error, or `NULL`
Returns : | a new GdaConnection if connection opening was sucessfull or `NULL` if there was an error.

### gda_connection_open_from_string ()

    GdaConnection *     gda_connection_open_from_string     (const gchar *provider_name,
                                                             const gchar *cnc_string,
                                                             const gchar *auth_string,
                                                             GdaConnectionOptions options,
                                                             GError **error);

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>=<value> 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 `NULL`, then these username and passwords will be used, and if <provider> is provided and `provider_name` is `NULL` 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 `auth_params` member of the GdaProviderInfo 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 `NULL` then it will still be used as the provider ID).\

This method may fail with a GDA_CONNECTION_ERROR domain error (see the GdaConnectionError error codes) or a `GDA_CONFIG_ERROR` domain error (see the GdaConfigError error codes).

`provider_name` : | provider ID to connect to, or `NULL`
`cnc_string` : | connection string.
`auth_string` : | authentication string, or `NULL`
`options` : | options for the connection (see GdaConnectionOptions).
`error` : | a place to store an error, or `NULL`
Returns : | a new GdaConnection if connection opening was sucessfull or `NULL` if there was an error.

### gda_connection_open ()

    gboolean            gda_connection_open                 (GdaConnection *cnc,
                                                             GError **error);

Tries to open the connection.

`cnc` : | a GdaConnection object
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if the connection is opened, and FALSE otherwise.

### gda_connection_close ()

    void                gda_connection_close                (GdaConnection *cnc);

Closes the connection to the underlying data source, but first emits the "conn-to-close" signal.

`cnc` : | a GdaConnection object.

### gda_connection_close_no_warning ()

    void                gda_connection_close_no_warning     (GdaConnection *cnc);

Closes the connection to the underlying data source, without emiting any warning signal.

`cnc` : | a GdaConnection object.

### gda_connection_is_opened ()

    gboolean            gda_connection_is_opened            (GdaConnection *cnc);

Checks whether a connection is open or not.

`cnc` : | a GdaConnection object.
Returns : | `TRUE` if the connection is open, `FALSE` if it's not.

### gda_connection_create_parser ()

    GdaSqlParser *      gda_connection_create_parser        (GdaConnection *cnc);

Creates a new parser object able to parse the SQL dialect understood by `cnc`. If the GdaServerProvider object internally used by `cnc` does not have its own parser, then `NULL` is returned, and a general SQL parser can be obtained using `gda_sql_parser_new()`.

`cnc` : | a GdaConnection object
Returns : | a new GdaSqlParser object, or `NULL`

### gda_connection_value_to_sql_string ()

    gchar *             gda_connection_value_to_sql_string  (GdaConnection *cnc,
                                                             GValue *from);

Produces a fully quoted and escaped string from a GValue

`cnc` : | a GdaConnection object.
`from` : | GValue to convert from
Returns : | escaped and quoted value or NULL if not supported.

### gda_connection_quote_sql_identifier ()

    gchar *             gda_connection_quote_sql_identifier (GdaConnection *cnc,
                                                             const gchar *id);

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.

`cnc` : | a GdaConnection object
`id` : | an SQL identifier
Returns : | a new string, to free with `g_free()` once not needed anymore

Since 4.0.3

### gda_connection_statement_to_sql ()

    gchar *             gda_connection_statement_to_sql     (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaStatementSqlFlag flags,
                                                             GSList **params_used,
                                                             GError **error);

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

`cnc` : | a GdaConnection object
`stmt` : | a GdaStatement object
`params` : | a GdaSet object (which can be obtained using `gda_statement_get_parameters()`), or `NULL`. [allow-none]
`flags` : | SQL rendering flags, as GdaStatementSqlFlag OR'ed values
`params_used` : | a place to store the list of individual GdaHolder objects within `params` which have been used. [allow-none][element-type GdaHolder][out GdaHolder][transfer container GdaHolder]
`error` : | a place to store errors, or `NULL`
Returns : | a new string, or `NULL` if an error occurred

### gda_connection_statement_prepare ()

    gboolean            gda_connection_statement_prepare    (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GError **error);

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 `gda_connection_statement_prepare()` fails when `gda_connection_statement_execute()` does not fail (this will usually be the case with statements such as "SELECT * FROM ##tablename::string" because database usually don't allow variables to be used in place of a table name).

`cnc` : | a GdaConnection
`stmt` : | a GdaStatement object
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if no error occurred.

### gda_connection_statement_execute ()

    GObject *           gda_connection_statement_execute    (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaStatementModelUsage model_usage,
                                                             GdaSet **last_insert_row,
                                                             GError **error);

Executes `stmt`.

As `stmt` can, by desing (and if not abused), contain only one SQL statement, the return object will either be:

- a GdaDataSelect object (which is also a GdaDataModel) if `stmt` is a SELECT statement (usually a GDA_SQL_STATEMENT_SELECT, see GdaSqlStatementType) containing the results of the SELECT. The resulting data model is by default read only, but modifications can be enabled, see the GdaDataSelect's documentation for more information.

- a GdaSet for any other SQL statement which correctly executed. In this case (if the provider supports it), then the GdaSet may contain value holders named:

  - a (gint) GdaHolder named "IMPACTED_ROWS"

  - a (GObject) GdaHolder named "EVENT" which contains a GdaConnectionEvent

If `last_insert_row` is not `NULL` and `stmt` is an INSERT statement, then it will contain (if the provider used by `cnc` supports it) a new GdaSet 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 GdaSet 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 GdaServerProviderError error codes).

Note1: If `stmt` is a SELECT statement which has some parameters and if `params` is `NULL`, then the statement can't be executed and this method will return `NULL`.

Note2: If `stmt` is a SELECT statement which has some parameters and if `params` is not `NULL` but contains some invalid parameters, then the statement can't be executed and this method will return `NULL`, unless the `model_usage` has the GDA_STATEMENT_MODEL_ALLOW_NOPARAM flag.

Note3: If `stmt` is a SELECT statement which has some parameters and if `params` is not `NULL` 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.

Note4: 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

Note5: 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.

`cnc` : | a GdaConnection
`stmt` : | a GdaStatement object
`params` : | a GdaSet object (which can be obtained using `gda_statement_get_parameters()`), or `NULL`. [allow-none]
`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 GdaSet object which contains the values of the last inserted row, or `NULL`. [out][transfer full][allow-none]
`error` : | a place to store errors, or `NULL`
Returns : | a GObject, or `NULL` if an error occurred

### gda_connection_statement_execute_select ()

    GdaDataModel *      gda_connection_statement_execute_select
                                                            (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GError **error);

Executes a selection command on the given connection. The `gda_execute_select_command()` method can be easier to use if one prefers to use some SQL directly.

This function returns a GdaDataModel resulting from the SELECT statement, or `NULL` if an error occurred.

This function is just a convenience function around the `gda_connection_statement_execute()` function.

See the documentation of the `gda_connection_statement_execute()` for information about the `params` list of parameters.

`cnc` : | a GdaConnection object.
`stmt` : | a GdaStatement object.
`params` : | a GdaSet object (which can be obtained using `gda_statement_get_parameters()`), or `NULL`. [allow-none]
`error` : | a place to store an error, or `NULL`
Returns : | a GdaDataModel containing the data returned by the data source, or `NULL` if an error occurred

### gda_connection_statement_execute_select_full ()

    GdaDataModel *      gda_connection_statement_execute_select_full
                                                            (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaStatementModelUsage model_usage,
                                                             GType *col_types,
                                                             GError **error);

Executes a selection command on the given connection.

This function returns a GdaDataModel resulting from the SELECT statement, or `NULL` if an error occurred.

This function is just a convenience function around the `gda_connection_statement_execute()` function.

See the documentation of the `gda_connection_statement_execute()` for information about the `params` list of parameters.

`cnc` : | a GdaConnection object.
`stmt` : | a GdaStatement object.
`params` : | a GdaSet object (which can be obtained using `gda_statement_get_parameters()`), or `NULL`. [allow-none]
`model_usage` : | specifies how the returned data model will be used as a GdaStatementModelUsage enum
`col_types` : | an array of GType to request each returned GdaDataModel'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 `NULL` if no column type is specified. [array][allow-none]
`error` : | a place to store an error, or `NULL`
Returns : | a GdaDataModel containing the data returned by the data source, or `NULL` if an error occurred

### gda_connection_statement_execute_select_fullv ()

    GdaDataModel *      gda_connection_statement_execute_select_fullv
                                                            (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaStatementModelUsage model_usage,
                                                             GError **error,
                                                             ...);

Executes a selection command on the given connection.

This function returns a GdaDataModel resulting from the SELECT statement, or `NULL` if an error occurred.

This function is just a convenience function around the `gda_connection_statement_execute()` function.

See the documentation of the `gda_connection_statement_execute()` for information about the `params` list of parameters.

`cnc` : | a GdaConnection object.
`stmt` : | a GdaStatement object.
`params` : | a GdaSet object (which can be obtained using `gda_statement_get_parameters()`), or `NULL`. [allow-none]
`model_usage` : | specifies how the returned data model will be used as a GdaStatementModelUsage enum
`error` : | a place to store an error, or `NULL`
`...` : | a (-1 terminated) list of (column number, GType) specifying for each column mentioned the GType of the column in the returned GdaDataModel.
Returns : | a GdaDataModel containing the data returned by the data source, or `NULL` if an error occurred

### gda_connection_statement_execute_non_select ()

    gint                gda_connection_statement_execute_non_select
                                                            (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaSet **last_insert_row,
                                                             GError **error);

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 `gda_connection_statement_execute()` function. See the documentation of the `gda_connection_statement_execute()` for information about the `params` list of parameters.

See `gda_connection_statement_execute()` form more information about `last_insert_row`.

`cnc` : | a GdaConnection object.
`stmt` : | a GdaStatement object.
`params` : | a GdaSet object (which can be obtained using `gda_statement_get_parameters()`), or `NULL`. [allow-none]
`last_insert_row` : | a place to store a new GdaSet object which contains the values of the last inserted row, or `NULL`. [out][transfer full][allow-none]
`error` : | a place to store an error, or `NULL`
Returns : | the number of rows affected (>=0) or -1 or -2

### gda_connection_repetitive_statement_execute ()

    GSList *            gda_connection_repetitive_statement_execute
                                                            (GdaConnection *cnc,
                                                             GdaRepetitiveStatement *rstmt,
                                                             GdaStatementModelUsage model_usage,
                                                             GType *col_types,
                                                             gboolean stop_on_error,
                                                             GError **error);

Executes the statement upon which `rstmt` is built. Note that as several statements can actually be executed by this method, it is recommended to be within a transaction.

If `error` is not `NULL` and `stop_on_error` is `FALSE`, then it may contain the last error which occurred.

`cnc` : | a GdaConnection
`rstmt` : | a GdaRepetitiveStatement object
`model_usage` : | specifies how the returned data model will be used as a GdaStatementModelUsage enum
`col_types` : | an array of GType to request each returned GdaDataModel's column's GType, see `gda_connection_statement_execute_select_full()` for more information. [array][allow-none]
`stop_on_error` : | set to TRUE if the method has to stop on the first error.
`error` : | a place to store errors, or `NULL`
Returns : | a new list of GObject pointers (see `gda_connection_statement_execute()` for more information about what they represent), one for each actual execution of the statement upon which `rstmt` is built. If `stop_on_error` is `FALSE`, then the list may contain some `NULL` pointers which refer to statements which failed to execute. [transfer full][element-type GObject]

Since 4.2

### gda_connection_batch_execute ()

    GSList *            gda_connection_batch_execute        (GdaConnection *cnc,
                                                             GdaBatch *batch,
                                                             GdaSet *params,
                                                             GdaStatementModelUsage model_usage,
                                                             GError **error);

Executes all the statements contained in `batch` (in the order in which they were added to `batch`), and returns a list of GObject objects, at most one GObject for each statement; see `gda_connection_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 GObject created by the correct execution of the previous statements. If a transaction is required, then it should be started before calling this method.

`cnc` : | a GdaConnection object
`batch` : | a GdaBatch object which contains all the statements to execute
`params` : | a GdaSet object (which can be obtained using `gda_batch_get_parameters()`), or `NULL`. [allow-none]
`model_usage` : | specifies how the returned data model(s) will be used, as a GdaStatementModelUsage enum
`error` : | a place to store errors, or `NULL`
Returns : | a new list of GObject objects. [element-type GObject]

### gda_connection_begin_transaction ()

    gboolean            gda_connection_begin_transaction    (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GdaTransactionIsolation level,
                                                             GError **error);

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 `gda_connection_supports_feature()` function.

`cnc` : | a GdaConnection object.
`name` : | the name of the transation to start, or `NULL`. [allow-none]
`level` : | the requested transaction level (`GDA_TRANSACTION_ISOLATION_UNKNOWN` if not specified)
`error` : | a place to store errors, or `NULL`
Returns : | `TRUE` if the transaction was started successfully, `FALSE` otherwise.

### gda_connection_commit_transaction ()

    gboolean            gda_connection_commit_transaction   (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GError **error);

Commits the given transaction to the backend database. You need to call `gda_connection_begin_transaction()` first.

`cnc` : | a GdaConnection object.
`name` : | the name of the transation to commit, or `NULL`. [allow-none]
`error` : | a place to store errors, or `NULL`
Returns : | `TRUE` if the transaction was finished successfully, `FALSE` otherwise.

### gda_connection_rollback_transaction ()

    gboolean            gda_connection_rollback_transaction (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GError **error);

Rollbacks the given transaction. This means that all changes made to the underlying data source since the last call to #`gda_connection_begin_transaction()` or #`gda_connection_commit_transaction()` will be discarded.

`cnc` : | a GdaConnection object.
`name` : | the name of the transation to commit, or `NULL`. [allow-none]
`error` : | a place to store errors, or `NULL`
Returns : | `TRUE` if the operation was successful, `FALSE` otherwise.

### gda_connection_add_savepoint ()

    gboolean            gda_connection_add_savepoint        (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GError **error);

Adds a SAVEPOINT named `name`.

`cnc` : | a GdaConnection object
`name` : | name of the savepoint to add. [allow-none]
`error` : | a place to store errors or `NULL`
Returns : | TRUE if no error occurred

### gda_connection_rollback_savepoint ()

    gboolean            gda_connection_rollback_savepoint   (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GError **error);

Rollback all the modifications made after the SAVEPOINT named `name`.

`cnc` : | a GdaConnection object
`name` : | name of the savepoint to rollback to. [allow-none]
`error` : | a place to store errors or `NULL`
Returns : | TRUE if no error occurred

### gda_connection_delete_savepoint ()

    gboolean            gda_connection_delete_savepoint     (GdaConnection *cnc,
                                                             const gchar *name,
                                                             GError **error);

Delete the SAVEPOINT named `name` when not used anymore.

`cnc` : | a GdaConnection object
`name` : | name of the savepoint to delete. [allow-none]
`error` : | a place to store errors or `NULL`
Returns : | TRUE if no error occurred

### gda_connection_async_statement_execute ()

    guint               gda_connection_async_statement_execute
                                                            (GdaConnection *cnc,
                                                             GdaStatement *stmt,
                                                             GdaSet *params,
                                                             GdaStatementModelUsage model_usage,
                                                             GType *col_types,
                                                             gboolean need_last_insert_row,
                                                             GError **error);

This method is similar to `gda_connection_statement_execute()` but is asynchronous as it method returns immediately with a task ID. It's up to the caller to use `gda_connection_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 `g_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).

`cnc` : | a GdaConnection
`stmt` : | a GdaStatement object
`params` : | a GdaSet object (which can be obtained using `gda_statement_get_parameters()`), or `NULL`. [allow-none]
`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 GdaDataModel's column's GType, terminated with the G_TYPE_NONE. [array][allow-none]
`need_last_insert_row` : | TRUE if the values of the last interted row must be computed
`error` : | a place to store errors, or `NULL`
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)

Since 4.2

### gda_connection_async_fetch_result ()

    GObject *           gda_connection_async_fetch_result   (GdaConnection *cnc,
                                                             guint task_id,
                                                             GdaSet **last_insert_row,
                                                             GError **error);

Use this method to obtain the result of the execution of a statement which has been executed asynchronously by calling `gda_connection_async_statement_execute()`. This function is non locking and will return `NULL` (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 `gda_connection_statement_execute()` would have if the statement had been executed synchronously.

`cnc` : | a GdaConnection
`task_id` : | a task ID returned by `gda_connection_async_statement_execute()`
`last_insert_row` : | a place to store a new GdaSet object which contains the values of the last inserted row, or `NULL`. [out][transfer full][allow-none]
`error` : | a place to store errors, or `NULL`
Returns : | a GObject, or `NULL` if an error occurred

Since 4.2

### gda_connection_async_cancel ()

    gboolean            gda_connection_async_cancel         (GdaConnection *cnc,
                                                             guint task_id,
                                                             GError **error);

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.

`cnc` : | a GdaConnection
`task_id` : | a task ID returned by `gda_connection_async_statement_execute()`
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if no error occurred

Since 4.2

### gda_connection_get_transaction_status ()

    GdaTransactionStatus * gda_connection_get_transaction_status
                                                            (GdaConnection *cnc);

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 `NULL` is returned, then no transaction has been associated with `cnc`

`cnc` : | a GdaConnection object
Returns : | a GdaTransactionStatus object, or `NULL`. [transfer none]

### gda_connection_get_options ()

    GdaConnectionOptions  gda_connection_get_options        (GdaConnection *cnc);

Gets the GdaConnectionOptions used to open this connection.

`cnc` : | a GdaConnection object.
Returns : | the connection options.

### gda_connection_get_provider ()

    GdaServerProvider * gda_connection_get_provider         (GdaConnection *cnc);

Gets a pointer to the GdaServerProvider object used to access the database

`cnc` : | a GdaConnection object
Returns : | the GdaServerProvider (NEVER NULL). [transfer none]

### gda_connection_get_provider_name ()

    const gchar *       gda_connection_get_provider_name    (GdaConnection *cnc);

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

`cnc` : | a GdaConnection object
Returns : | a non modifiable string

### gda_connection_get_dsn ()

    const gchar *       gda_connection_get_dsn              (GdaConnection *cnc);

`cnc` : | a GdaConnection object
Returns : | the data source name the connection object is connected to.

### gda_connection_get_cnc_string ()

    const gchar *       gda_connection_get_cnc_string       (GdaConnection *cnc);

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.

`cnc` : | a GdaConnection object.
Returns : | the connection string used when opening the connection.

### gda_connection_get_authentication ()

    const gchar *       gda_connection_get_authentication   (GdaConnection *cnc);

Gets the user name used to open this connection.

`cnc` : | a GdaConnection object.
Returns : | the user name.

### gda_connection_get_events ()

    const GList *       gda_connection_get_events           (GdaConnection *cnc);

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 GdaConnectionEvent of the first node.

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

`cnc` : | a GdaConnection.
Returns : | a GList of GdaConnectionEvent objects (the list should not be modified). [transfer none]

### gda_connection_create_operation ()

    GdaServerOperation * gda_connection_create_operation    (GdaConnection *cnc,
                                                             GdaServerOperationType type,
                                                             GdaSet *options,
                                                             GError **error);

Creates a new GdaServerOperation object which can be modified in order to perform the type type of action. It is a wrapper around the `gda_server_provider_create_operation()` method.

`cnc` : | a GdaConnection object
`type` : | the type of operation requested
`options` : | an optional list of parameters. [allow-none]
`error` : | a place to store an error, or `NULL`
Returns : | a new GdaServerOperation object, or `NULL` in the connection's provider does not support the `type` type of operation or if an error occurred

### gda_connection_perform_operation ()

    gboolean            gda_connection_perform_operation    (GdaConnection *cnc,
                                                             GdaServerOperation *op,
                                                             GError **error);

Performs the operation described by `op` (which should have been created using `gda_connection_create_operation()`). It is a wrapper around the `gda_server_provider_perform_operation()` method.

`cnc` : | a GdaConnection object
`op` : | a GdaServerOperation object
`error` : | a place to store an error, or `NULL`
Returns : | TRUE if no error occurred

### enum GdaConnectionFeature

    typedef enum {
    	GDA_CONNECTION_FEATURE_AGGREGATES,
    	GDA_CONNECTION_FEATURE_BLOBS,
    	GDA_CONNECTION_FEATURE_INDEXES,
    	GDA_CONNECTION_FEATURE_INHERITANCE,
    	GDA_CONNECTION_FEATURE_NAMESPACES,
    	GDA_CONNECTION_FEATURE_PROCEDURES,
    	GDA_CONNECTION_FEATURE_SEQUENCES,
    	GDA_CONNECTION_FEATURE_SQL,
    	GDA_CONNECTION_FEATURE_TRANSACTIONS,
    	GDA_CONNECTION_FEATURE_SAVEPOINTS,
    	GDA_CONNECTION_FEATURE_SAVEPOINTS_REMOVE,
    	GDA_CONNECTION_FEATURE_TRIGGERS,
    	GDA_CONNECTION_FEATURE_UPDATABLE_CURSOR,
    	GDA_CONNECTION_FEATURE_USERS,
    	GDA_CONNECTION_FEATURE_VIEWS,
    	GDA_CONNECTION_FEATURE_XA_TRANSACTIONS,

    	GDA_CONNECTION_FEATURE_MULTI_THREADING,

    	GDA_CONNECTION_FEATURE_LAST
    } GdaConnectionFeature;

Used in `gda_connection_supports_feature()` and `gda_server_provider_supports_feature()` to test if a connection or a database provider supports some specific feature.

`GDA_CONNECTION_FEATURE_AGGREGATES` | test for aggregates support
`GDA_CONNECTION_FEATURE_BLOBS` | test for BLOBS (binary large objects) support
`GDA_CONNECTION_FEATURE_INDEXES` | test for indexes support
`GDA_CONNECTION_FEATURE_INHERITANCE` | test for tables inheritance support
`GDA_CONNECTION_FEATURE_NAMESPACES` | test for namespaces support
`GDA_CONNECTION_FEATURE_PROCEDURES` | test for functions support
`GDA_CONNECTION_FEATURE_SEQUENCES` | test for sequences support
`GDA_CONNECTION_FEATURE_SQL` | test for SQL language (even specific to the database) support
`GDA_CONNECTION_FEATURE_TRANSACTIONS` | test for transactions support
`GDA_CONNECTION_FEATURE_SAVEPOINTS` | test for savepoints within transactions support
`GDA_CONNECTION_FEATURE_SAVEPOINTS_REMOVE` | test if savepoints can be removed
`GDA_CONNECTION_FEATURE_TRIGGERS` | test for triggers support
`GDA_CONNECTION_FEATURE_UPDATABLE_CURSOR` | test for updatable cursors support
`GDA_CONNECTION_FEATURE_USERS` | test for users support
`GDA_CONNECTION_FEATURE_VIEWS` | test for views support
`GDA_CONNECTION_FEATURE_XA_TRANSACTIONS` | test for distributed transactions support
`GDA_CONNECTION_FEATURE_MULTI_THREADING` | test for native multi-threading support
`GDA_CONNECTION_FEATURE_LAST` |

### gda_connection_supports_feature ()

    gboolean            gda_connection_supports_feature     (GdaConnection *cnc,
                                                             GdaConnectionFeature feature);

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

`cnc` : | a GdaConnection object.
`feature` : | feature to ask for.
Returns : | `TRUE` if the provider supports it, `FALSE` if not.

### gda_connection_get_meta_store ()

    GdaMetaStore *      gda_connection_get_meta_store       (GdaConnection *cnc);

Get or initializes the GdaMetaStore associated to `cnc`

`cnc` : | a GdaConnection object
Returns : | a GdaMetaStore object

### gda_connection_update_meta_store ()

    gboolean            gda_connection_update_meta_store    (GdaConnection *cnc,
                                                             GdaMetaContext *context,
                                                             GError **error);

Updates `cnc`'s associated GdaMetaStore. If `context` is not `NULL`, then only the parts described by `context` will be updated, and if it is `NULL`, then the complete meta store will be updated. Detailed explanations follow:

In order to keep the meta store's contents in a consistent state, the update process involves updating the contents of all the tables related to one where the contents change. For example the "_columns" table (which lists all the columns of a table) depends on the "_tables" table (which lists all the tables in a schema), so if a row is added, removed or modified in the "_tables", then the "_columns" table's contents needs to be updated as well regarding that row.

If `context` is `NULL`, then the update process will simply overwrite any data that was present in all the meta store's tables with new (up to date) data even if nothing has changed, without having to build the tables' dependency tree. This is the recommended way of proceeding when dealing with a meta store which might be outdated.

On the other hand, if `context` is not `NULL`, then a tree of the dependencies has to be built (depending on `context`) and only some parts of the meta store are updated following that dependencies tree. Specifying a context may be useful for example in the following situations:

- One knows that a database object has changed (for example a table created), and may use the `context` to request that only the information about that table be updated

- One is only interrested in the list of views, and may request that only the information about views may be updated

When `context` is not `NULL`, and contains specified SQL identifiers (for example the "table_name" of the "_tables" table), then each SQL identifier has to match the convention the GdaMetaStore has adopted regarding case sensitivity, using `gda_connection_quote_sql_identifier()` or `gda_meta_store_sql_identifier_quote()`.

see the meta data section about SQL identifiers for more information, and the documentation about the `gda_sql_identifier_quote()` function which will be most useful.

Note however that usually more information will be updated than strictly requested by the `context` argument.

For more information, see the Database structure section, and the Update the meta data about a table howto.

`cnc` : | a GdaConnection object.
`context` : | description of which part of `cnc`'s associated GdaMetaStore should be updated, or `NULL`. [allow-none]
`error` : | a place to store errors, or `NULL`
Returns : | TRUE if no error occurred

### enum GdaConnectionMetaType

    typedef enum {
    	GDA_CONNECTION_META_NAMESPACES,
    	GDA_CONNECTION_META_TYPES,
    	GDA_CONNECTION_META_TABLES,
    	GDA_CONNECTION_META_VIEWS,
    	GDA_CONNECTION_META_FIELDS,
    	GDA_CONNECTION_META_INDEXES
    } GdaConnectionMetaType;

Used with `gda_connection_get_meta_store_data()` to describe what meta data to extract from a connection's associated GdaMetaStore.

`GDA_CONNECTION_META_NAMESPACES` | lists the namespaces (or schemas for PostgreSQL)
`GDA_CONNECTION_META_TYPES` | lists the database types
`GDA_CONNECTION_META_TABLES` | lists the tables
`GDA_CONNECTION_META_VIEWS` | lists the views
`GDA_CONNECTION_META_FIELDS` | lists the table's or view's fields
`GDA_CONNECTION_META_INDEXES` | lists the table's indexes

### gda_connection_get_meta_store_data ()

    GdaDataModel *      gda_connection_get_meta_store_data  (GdaConnection *cnc,
                                                             GdaConnectionMetaType meta_type,
                                                             GError **error,
                                                             gint nb_filters,
                                                             ...);

Retrieves data stored in `cnc`'s associated GdaMetaStore object. This method is useful to easily get some information about the meta-data associated to `cnc`, such as the list of tables, views, and other database objects.

Note: it's up to the caller to make sure the information contained within `cnc`'s associated GdaMetaStore is up to date using `gda_connection_update_meta_store()` (it can become outdated if the database's schema is modified).

For more information about the returned data model's attributes, or about the `meta_type` and ... filter arguments, see this description.

Also, when using filters involving data which are SQL identifiers, make sure each SQL identifier is represented using the GdaMetaStore convention, using `gda_meta_store_sql_identifier_quote()` or `gda_meta_store_sql_identifier_quote()`.

See the meta data section about SQL identifiers for more information, and the documentation about the `gda_sql_identifier_quote()` function which will be most useful.

`cnc` : | a GdaConnection object.
`meta_type` : | describes which data to get.
`error` : | a place to store errors, or `NULL`
`nb_filters` : | the number of filters in the @... argument
`...` : | a list of (filter name (gchar *), filter value (GValue*)) pairs specifying the filter to apply to the returned data model's contents (there must be `nb_filters` pairs)
Returns : | a GdaDataModel containing the data required. The caller is responsible for freeing the returned model using `g_object_unref()`.

### gda_connection_get_meta_store_data_v ()

    GdaDataModel *      gda_connection_get_meta_store_data_v
                                                            (GdaConnection *cnc,
                                                             GdaConnectionMetaType meta_type,
                                                             GList *filters,
                                                             GError **error);

see gda_connection_get_meta_store_data

`cnc` : | a GdaConnection object.
`meta_type` : | describes which data to get.
`filters` : | a GList of GdaHolder objects. [element-type GdaHolder]
`error` : | a place to store errors, or `NULL`
Returns : | a GdaDataModel containing the data required. The caller is responsible for freeing the returned model using `g_object_unref()`.

## Property Details

### The `"auth-string"` property

      "auth-string"              gchar*                : Read / Write

Authentication string to use.

Default value: NULL

### The `"cnc-string"` property

      "cnc-string"               gchar*                : Read / Write

Connection string to use.

Default value: NULL

### The `"dsn"` property

      "dsn"                      gchar*                : Read / Write

DSN to use.

Default value: NULL

### The `"events-history-size"` property

      "events-history-size"      gint                  : Read / Write

Defines the number of GdaConnectionEvent objects kept in memory which can be fetched using `gda_connection_get_events()`.

Allowed values: >= 5

Default value: 5

Since 4.2

### The `"is-wrapper"` property

      "is-wrapper"               gboolean              : Read / Write / Construct Only

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

Default value: FALSE

Since 4.2

### The `"meta-store"` property

      "meta-store"               GdaMetaStore*         : Read / Write

GdaMetaStore used by the connection.

### The `"monitor-wrapped-in-mainloop"` property

      "monitor-wrapped-in-mainloop" gboolean              : Read / Write

Useful only when there is a mainloop and when the connection acts as a thread wrapper around another connection, it sets up a timeout to handle signals coming from the wrapped connection.

If the connection is not a thread wrapper, then this property has no effect.

Default value: FALSE

Since 4.2

### The `"options"` property

      "options"                  GdaConnectionOptions  : Read / Write

Options.

### The `"provider"` property

      "provider"                 GdaServerProvider*    : Read / Write

Provider to use.

### The `"thread-owner"` property

      "thread-owner"             gpointer              : Read / Write

Unique GThread from which the connection will be available.This should only be modified by the database providers' implementation.

## Signal Details

### The `"conn-closed"` signal

    void                user_function                      (GdaConnection *cnc,
                                                            gpointer       user_data)      : Run Last

Gets emitted when the connection to the database has been closed

@:

`cnc` : | the GdaConnection
`user_data` : | user data set when the signal handler was connected.

### The `"conn-opened"` signal

    void                user_function                      (GdaConnection *cnc,
                                                            gpointer       user_data)      : Run First

Gets emitted when the connection has been opened to the database

@:

`cnc` : | the GdaConnection
`user_data` : | user data set when the signal handler was connected.

### The `"conn-to-close"` signal

    void                user_function                      (GdaConnection *cnc,
                                                            gpointer       user_data)      : Run First

Gets emitted when the connection to the database is about to be closed

@:

`cnc` : | the GdaConnection
`user_data` : | user data set when the signal handler was connected.

### The `"dsn-changed"` signal

    void                user_function                      (GdaConnection *cnc,
                                                            gpointer       user_data)      : Run Last

Gets emitted when the DSN used by `cnc` has been changed

@:

`cnc` : | the GdaConnection
`user_data` : | user data set when the signal handler was connected.

### The `"error"` signal

    void                user_function                      (GdaConnection      *cnc,
                                                            GdaConnectionEvent *event,
                                                            gpointer            user_data)      : Run Last

Gets emitted whenever a connection event occurs. Chech the nature of `event` to see if it's an error or a simple notification

@: @:

`cnc` : | the GdaConnection
`event` : | a GdaConnectionEvent object
`user_data` : | user data set when the signal handler was connected.

### The `"transaction-status-changed"` signal

    void                user_function                      (GdaConnection *cnc,
                                                            gpointer       user_data)      : Run Last

Gets emitted when the transaction status of `cnc` has changed (a transaction has been started, rolled back, a savepoint added,...)

@:

`cnc` : | the GdaConnection
`user_data` : | user data set when the signal handler was connected.