Artificially slows down the execution of queries. This property can be used to debug some problems. If non zero, this value is the number of microseconds waited before actually executing each query.
Computes execution times for each statement executed.
This property, if set to %TRUE, specifies that the connection is not a real connection, but rather a #GdaConnection object which "proxies" all the calls to another connection which executes in a sub thread.
Note: this property is used internally by Libgda and should not be directly used by any programs. Setting this property has no effect, reading it is supported, though.
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.
Adds an event to the given connection. This function is usually called by providers, to inform clients of events that happened during some operation.
As soon as a provider (or a client, it does not matter) calls this
function with an event
object which is an error,
the connection object emits the "error" signal, to which clients can connect to be
informed of events.
WARNING: the reference to the event
object is stolen by this function!
is stored internally, so you don't need to unref it.
Declares that prepared_stmt
is a prepared statement object associated to gda_stmt
within the connection
(meaning the connection increments the reference counter of prepared_stmt)
.
If gda_stmt
changes or is destroyed, the the association will be lost and the connection will lose the
reference it has on prepared_stmt
.
a #GdaStatement object
a prepared statement object (as a #GdaPStmt object, or more likely a descendant)
Adds a SAVEPOINT named name
.
name of the savepoint to add
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.
a task ID returned by gda_connection_async_statement_execute()
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.
a task ID returned by gda_connection_async_statement_execute()
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).
Note that for asynchronous calls to succeed, it is gererally necessary to specify the %GDA_CONNECTION_OPTIONS_THREAD_ISOLATED flag when opening the connection to be sure it is opened in a separate thread in which asynchronous calls are made (failing to use this flag make the asynchronous call dependant on the database provider implementation and at the moment none support this feature).
a #GdaStatement object
a #GdaSet object (which can be obtained using gda_statement_get_parameters()), or %NULL
in the case where stmt
is a SELECT statement, specifies how the returned data model will be used
an array of GType to request each returned #GdaDataModel's column's GType, terminated with the G_TYPE_NONE
TRUE if the values of the last interted row must be computed
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.
a #GdaBatch object which contains all the statements to execute
a #GdaSet object (which can be obtained using gda_batch_get_parameters()), or %NULL
specifies how the returned data model(s) will be used, as a #GdaStatementModelUsage enum
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.
the name of the transation to start, or %NULL
the requested transaction level (%GDA_TRANSACTION_ISOLATION_UNKNOWN if not specified)
Creates a binding between source_property
on source
and target_property
on target
.
Whenever the source_property
is changed the target_property
is
updated using the same value. For instance:
g_object_bind_property (action, "active", widget, "sensitive", 0);
Will result in the "sensitive" property of the widget #GObject instance to be updated with the same value of the "active" property of the action #GObject instance.
If flags
contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
if target_property
on target
changes then the source_property
on source
will be updated as well.
The binding will automatically be removed when either the source
or the
target
instances are finalized. To remove the binding without affecting the
source
and the target
you can just call g_object_unref() on the returned
#GBinding instance.
Removing the binding by calling g_object_unref() on it must only be done if
the binding, source
and target
are only used from a single thread and it
is clear that both source
and target
outlive the binding. Especially it
is not safe to rely on this if the binding, source
or target
can be
finalized from different threads. Keep another reference to the binding and
use g_binding_unbind() instead to be on the safe side.
A #GObject can have multiple bindings.
the property on source
to bind
the target #GObject
the property on target
to bind
flags to pass to #GBinding
Creates a binding between source_property
on source
and target_property
on target,
allowing you to set the transformation functions to be used by
the binding.
This function is the language bindings friendly version of g_object_bind_property_full(), using #GClosures instead of function pointers.
the property on source
to bind
the target #GObject
the property on target
to bind
flags to pass to #GBinding
a #GClosure wrapping the transformation function from the source
to the target,
or %NULL to use the default
a #GClosure wrapping the transformation function from the target
to the source,
or %NULL to use the default
This function lets you clear the list of #GdaConnectionEvent's of the given connection.
Closes the connection to the underlying data source, but first emits the "conn-to-close" signal.
Closes the connection to the underlying data source, without emiting any warning signal.
Commits the given transaction to the backend database. You need to call gda_connection_begin_transaction() first.
the name of the transation to commit, or %NULL
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.
the type of operation requested
an optional list of parameters
This is a convenience function, which creates a DELETE statement and executes it using the values provided. It internally relies on variables which makes it immune to SQL injection problems.
The equivalent SQL command is: DELETE FROM <table> WHERE <condition_column_name> = <condition_value>.
the table's name with the row's values to be updated
the name of the column to used in the WHERE condition clause
the condition_column_type'
s GType
Delete the SAVEPOINT named name
when not used anymore.
name of the savepoint to delete
This is a convenience function to execute a SQL command over the opened connection. For the returned value, see gda_connection_statement_execute_non_select()'s documentation.
a query statement that must not begin with "SELECT"
This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().
Increases the freeze count on object
. If the freeze count is
non-zero, the emission of "notify" signals on object
is
stopped. The signals are queued until the freeze count is decreased
to zero. Duplicate notifications are squashed so that at most one
#GObject::notify signal is emitted for each property modified while the
object is frozen.
This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.
Gets the user name used to open this connection.
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.
Gets a named field from the objects table of associations (see g_object_set_data()).
name of the key for that association
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
Gets the #GdaConnectionOptions used to open this connection.
Gets a property of an object.
The value
can be:
In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling g_value_unset().
Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.
the name of the property to get
return location for the property value
Gets a pointer to the #GdaServerProvider object used to access the database
Gets the name (identifier) of the database provider used by cnc
This function gets back user data pointers stored via g_object_set_qdata().
A #GQuark, naming the user data pointer
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
Gets n_properties
properties for an object
.
Obtained properties will be set to values
. All properties must be valid.
Warnings will be emitted and undefined behaviour may result if invalid
properties are passed in.
the names of each property to get
the values of each property to get
col_names
and values
must have length (>= 1).
This is a convenience function, which creates an INSERT statement and executes it using the values provided. It internally relies on variables which makes it immune to SQL injection problems.
The equivalent SQL command is: INSERT INTO <table> (<column_name> [,...]) VALUES (<column_name> = <new_value> [,...]).
table's name to insert into
a list of column names (as const gchar *)
a list of values (as #GValue)
Checks whether object
has a [floating][floating-ref] reference.
Checks whether a connection is open or not.
Locks lockable
. If it is already locked by another thread, the current thread will block until it is unlocked
by the other thread.
This function can be used even if g_thread_init() has not yet been called, and, in that case, will do nothing.
Note: unlike g_mutex_lock(), this method recursive, which means a thread can lock lockable
several times
(and has to unlock it as many times to actually unlock it).
Emits a "notify" signal for the property property_name
on object
.
When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.
Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.
the name of a property installed on the class of object
.
Emits a "notify" signal for the property specified by pspec
on object
.
This function omits the property name lookup, hence it is faster than g_object_notify().
One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:
enum
{
PROP_0,
PROP_FOO,
PROP_LAST
};
static GParamSpec *properties[PROP_LAST];
static void
my_object_class_init (MyObjectClass *klass)
{
properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
0, 100,
50,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_FOO,
properties[PROP_FOO]);
}
and then notify a change on the "foo" property with:
g_object_notify_by_pspec (self, properties[PROP_FOO]);
the #GParamSpec of a property installed on the class of object
.
Tries to open the connection.
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.
a #GdaServerOperation object
Use this method to get a pointer to the next available connection event which can then be customized and taken into account using gda_connection_add_event().
a #GdaConnectionEventType
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:
id
is a reserved SQL keyword (such as SELECT, INSERT, ...)id
contains non allowed characters such as spaces, or if it starts with a digitcnc,
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.
an SQL identifier
Increase the reference count of object,
and possibly remove the
[floating][floating-ref] reference, if object
has a floating reference.
In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.
Since GLib 2.56, the type of object
will be propagated to the return type
under the same conditions as for g_object_ref().
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.
a #GdaRepetitiveStatement object
specifies how the returned data model will be used as a #GdaStatementModelUsage enum
an array of GType to request each returned GdaDataModel's column's GType, see gda_connection_statement_execute_select_full() for more information
set to TRUE if the method has to stop on the first error.
Rollback all the modifications made after the SAVEPOINT named name
.
name of the savepoint to rollback to
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.
the name of the transation to commit, or %NULL
Releases all references to other objects. This can be used to break reference cycles.
This function should only be called from object system implementations.
Each object carries around a table of associations from strings to pointers. This function lets you set an association.
If the object already had an association with that name, the old association will be destroyed.
Internally, the key
is converted to a #GQuark using g_quark_from_string().
This means a copy of key
is kept permanently (even after object
has been
finalized) — so it is recommended to only use a small, bounded set of values
for key
in your program, to avoid the #GQuark storage growing unbounded.
name of the key
data to associate with that key
Sets a property on an object.
the name of the property to set
the value
Executes stmt
.
As stmt
can, by design (and if not abused), contain only one SQL statement, the
return object will either be:
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.
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:
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
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
Also see the provider's limitations, and the
Advanced GdaDataSelect usage sections.a #GdaStatement object
a #GdaSet object (which can be obtained using gda_statement_get_parameters()), or %NULL
in the case where stmt
is a SELECT statement, specifies how the returned data model will be used
Executes a non-selection statement on the given connection.
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
.
a #GdaStatement object.
a #GdaSet object (which can be obtained using gda_statement_get_parameters()), or %NULL
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.
a #GdaStatement object.
a #GdaSet object (which can be obtained using gda_statement_get_parameters()), or %NULL
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.
a #GdaStatement object.
a #GdaSet object (which can be obtained using gda_statement_get_parameters()), or %NULL
specifies how the returned data model will be used as a #GdaStatementModelUsage enum
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.
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 because database usually don't allow variables to be used in place of a table name).
Renders stmt
as an SQL statement, adapted to the SQL dialect used by cnc
a #GdaStatement object
a #GdaSet object (which can be obtained using gda_statement_get_parameters()), or %NULL
SQL rendering flags, as #GdaStatementSqlFlag OR'ed values
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
name of the key
This function gets back user data pointers stored via
g_object_set_qdata() and removes the data
from object
without invoking its destroy() function (if any was
set).
Usually, calling this function is only required to update
user data pointers with a destroy notifier, for example:
void
object_add_to_user_list (GObject *object,
const gchar *new_string)
{
// the quark, naming the object data
GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
// retrieve the old string list
GList *list = g_object_steal_qdata (object, quark_string_list);
// prepend new string
list = g_list_prepend (list, g_strdup (new_string));
// this changed 'list', so we need to set it again
g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
}
static void
free_string_list (gpointer data)
{
GList *node, *list = data;
for (node = list; node; node = node->next)
g_free (node->data);
g_list_free (list);
}
Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().
A #GQuark, naming the user data pointer
Asks the underlying provider for if a specific feature is supported.
feature to ask for.
Reverts the effect of a previous call to
g_object_freeze_notify(). The freeze count is decreased on object
and when it reaches zero, queued "notify" signals are emitted.
Duplicate notifications for each property are squashed so that at most one #GObject::notify signal is emitted for each property, in the reverse order in which they have been queued.
It is an error to call this function when the freeze count is zero.
Tries to lock lockable
. If it is already locked by another thread, then it immediately returns FALSE, otherwise
it locks lockable
.
This function can be used even if g_thread_init() has not yet been called, and, in that case, will do nothing.
Note: unlike g_mutex_lock(), this method recursive, which means a thread can lock lockable
several times
(and has to unlock it as many times to actually unlock it).
Unlocks lockable
. This method should not be called if the current does not already holds a lock on lockable
(having
used gda_lockable_lock() or gda_lockable_trylock()).
This function can be used even if g_thread_init() has not yet been called, and, in that case, will do nothing.
Decreases the reference count of object
. When its reference count
drops to 0, the object is finalized (i.e. its memory is freed).
If the pointer to the #GObject may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to %NULL rather than retain a dangling pointer to a potentially invalid #GObject instance. Use g_clear_object() for this.
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:
context
to request that only the information about that table 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 context
argument.
For more information, see the Database structure section, and the Update the meta data about a table howto.
description of which part of cnc'
s associated #GdaMetaStore should be updated, or %NULL
col_names
and values
must have length (>= 1).
This is a convenience function, which creates an UPDATE statement and executes it using the values provided. It internally relies on variables which makes it immune to SQL injection problems.
The equivalent SQL command is: UPDATE <table> SET <column_name> = <new_value> [,...] WHERE <condition_column_name> = <condition_value>.
the table's name with the row's values to be updated
the name of the column to used in the WHERE condition clause
the condition_column_type'
s GType
a list of column names (as const gchar *)
a list of values (as #GValue)
Produces a fully quoted and escaped string from a GValue
#GValue to convert from
This function essentially limits the life time of the closure
to
the life time of the object. That is, when the object is finalized,
the closure
is invalidated by calling g_closure_invalidate() on
it, in order to prevent invocations of the closure with a finalized
(nonexisting) object. Also, g_object_ref() and g_object_unref() are
added as marshal guards to the closure,
to ensure that an extra
reference count is held on object
during invocation of the
closure
. Usually, this function will be called on closures that
use this object
as closure data.
#GClosure to watch
Find the #GParamSpec with the given name for an
interface. Generally, the interface vtable passed in as g_iface
will be the default vtable from g_type_default_interface_ref(), or,
if you know the interface has already been loaded,
g_type_default_interface_peek().
any interface vtable for the interface, or the default vtable for the interface
name of a property to look up.
Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created #GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.
This function is meant to be called from the interface's default
vtable initialization function (the class_init
member of
#GTypeInfo.) It must not be called after after class_init
has
been called for any object types implementing this interface.
If pspec
is a floating reference, it will be consumed.
any interface vtable for the interface, or the default vtable for the interface.
the #GParamSpec for the new property
Lists the properties of an interface.Generally, the interface
vtable passed in as g_iface
will be the default vtable from
g_type_default_interface_ref(), or, if you know the interface has
already been loaded, g_type_default_interface_peek().
any interface vtable for the interface, or the default vtable for the interface
This function is similar to gda_connection_open_from_dsn(), except it does not actually open the connection, you have to open it using gda_connection_open().
data source name.
authentication string, or %NULL
options for the connection (see #GdaConnectionOptions).
This function is similar to gda_connection_open_from_string(), except it does not actually open the connection, you have to open it using gda_connection_open().
provider ID to connect to, or %NULL
connection string.
authentication string, or %NULL
options for the connection (see #GdaConnectionOptions).
Creates a new instance of a #GObject subtype and sets its properties.
Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.
the type id of the #GObject subtype to instantiate
an array of #GParameter
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
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).
data source name.
authentication string, or %NULL
options for the connection (see #GdaConnectionOptions).
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-5.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
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
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 ID to connect to, or %NULL
connection string.
authentication string, or %NULL
options for the connection (see #GdaConnectionOptions).
Opens an SQLite connection even if the SQLite provider is not installed, to be used by database providers which need a temporary database to store some information.
the directory the database file will be in, or %NULL for the default TMP directory
the database file name
if %TRUE, then the database file will be removed afterwards
Extract the provider, connection parameters, username and password from string
.
in string,
the various parts are strings
which are expected to be encoded using an RFC 1738 compliant encoding. If they are specified,
the returned provider, username and password strings are correctly decoded.
For example all the following connection strings:
will return the following new strings (double quotes added here to delimit strings):
a string in the "[<provider>://][<username>[:<password>]]
<connection_params>" form
a place to store the new string containing the <connection_params> part
a place to store the new string containing the <provider> part
a place to store the new string containing the <username> part
a place to store the new string containing the <password> part, or %NULL
Defines the number of #GdaConnectionEvent objects kept in memory which can be fetched using gda_connection_get_events().