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. NB: this parameter is ignored during the meta store update (it is set to 0 before the meta data update and restored to its state after).
Computes execution times for each statement executed.
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
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 (use %GDA_TRANSACTION_ISOLATION_SERVER_DEFAULT to apply the server default)
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.
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
A convenient method to create a new #GdaDbCatalog instance and set the current cnc
as a
property. If for some reason, this approach doesn't fit well, the same task can be achieved
by the following code:
GdaDbCatalog *catalog = gda_db_catalog_new (); g_object_set (catalog, "connection", cnc, 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>.
A simple example to remove a row in database.
GdaConnection *cnc;
//Open connection here
GError *error = NULL;
GValue *v_id = gda_value_new (G_TYPE_INT);
GValue *v_name = gda_value_new_from_string ("Aldibino Refinino", G_TYPE_STRING);
//The number 10 represents a primary key record in the table
g_value_set_int (v_id, 10);
//Delete a record with a specific ID in the col_id column
if (!gda_connection_delete_row_from_table (cnc, "TABLE_CONTACTS",
"col_id", v_id,
&error))
{
g_error ("Could not delete row in table: %s\n",
error && error->message ? error->message : "No detail");
}
//Delete a record with a specific NAME in the col_name column
if (!gda_connection_delete_row_from_table (cnc, "TABLE_CONTACTS",
"col_name", v_name,
&error))
{
g_error ("Could not delete row in table: %s\n",
error && error->message ? error->message : "No detail");
}
gda_value_free (v_id);
gda_value_free (v_name);
g_error_free (error);
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
Get the #GMainContext used while a potentially blocking operation is performed using nc,
see
gda_connection_set_main_context(). If cnc
is %NULL, then the setting applies to all the connections for which
no other similar setting has been set.
If no main context has been defined, then some function calls (for example connection opening) may block until the operation has finished.
the #GThread in which context
will be used, or %NULL (for the current thread)
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 current status of cnc
. Note that this function needs to lock the connection (see #GdaLockable)
to obtain the result.
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)
Internal function to be called by database providers to force a transaction status change.
the new state
Get the opaque pointer previously set using gda_connection_internal_set_provider_data(). If it's not set, then add a connection event and returns %NULL
Internal function to be called by database providers to reset the transaction status.
Internal functions to be called by database providers when a savepoint has been added to keep track of the transaction status of the connection
Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.
name of the parent transaction, or %NULL
savepoint's name, or %NULL
Internal functions to be called by database providers when a savepoint has been removed to keep track of the transaction status of the connection
Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.
savepoint's name, or %NULL
Internal functions to be called by database providers when a savepoint has been rolled back to keep track of the transaction status of the connection
Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.
savepoint's name, or %NULL
Note: calling this function more than once will not make it call destroy_func
on any previously
set opaque data,
you'll have to do it yourself.
Note: destroy_func,
needs to free the memory associated to data,
if necessary.
a #GdaServerProviderConnectionData, which can be extended as needed by the provider for which cnc
is opened
function to call when the connection closes and data
needs to be destroyed
Internal functions to be called by database providers when a statement has been executed to keep track of the transaction status of the connection
a #GdaStatement which has been executed
execution's parameters
a #GdaConnectionEvent if the execution failed, or %NULL
Internal functions to be called by database providers when a transaction has been committed to keep track of the transaction status of the connection
Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.
transaction's name, or %NULL
Internal functions to be called by database providers when a transaction has been rolled back to keep track of the transaction status of the connection
Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.
transaction's name, or %NULL
Internal functions to be called by database providers when a transaction has been started to keep track of the transaction status of the connection.
Note: this function should not be called if gda_connection_internal_statement_executed() has already been called because a statement's execution was necessary to perform the action.
name of the parent transaction, or %NULL
transaction's name, or %NULL
isolation level.
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.
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. The function either blocks or, if a #GMaincontext has been specified using gda_connection_set_main_context(), processes the events for that main context until either the connection opening has succeeded or failed.
If the connection is already opened, then this function returns %TRUE immediately.
This function requests that the connection be opened.
If the connection is already opened, then this function returns an error (with the %GDA_CONNECTION_ALREADY_OPENED_ERROR code).
Note: callback
function will be called when processing events from the #GMainContext defined by
gda_connection_set_main_context(), for example when there is a main loop for that main context.
a #GdaConnectionOpenFunc which will be called after the connection has been opened (of failed to open)
This method is similar to gda_server_operation_get_value_at(), but for SQL identifiers: a new string
is returned instead of a #GValue. Also the returned string is assumed to represents an SQL identifier
and will correctly be quoted to be used with cnc
.
a #GdaServerOperation object
a complete path to a node (starting with "/")
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
Add more arguments if the flag needs them:
GDA_SERVER_OPERATION_CREATE_TABLE_FKEY_FLAG:
Create a #GdaServerOperation object using an opened connection, taking three arguments, a column's name the column's GType and #GdaServerOperationCreateTableFlag flag, you need to finish the list using %NULL.
You'll be able to modify the #GdaServerOperation object to add custom options to the operation. When finished call #gda_server_operation_perform_create_table or #gda_server_provider_perform_operation in order to execute the operation.
name of the table to create
list of arguments as #GdaServerOperationPrepareCreateTableArg containing column's name, column's #GType and a #GdaServerOperationCreateTableFlag flag
This is just a convenient function to create a #GdaServerOperation to drop a table in an opened connection.
name of the table to drop
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
Defines the #GMainContext which will still process events while a potentially blocking operation is performed using
cnc
. If cnc
is %NULL, then this function applies to all the connections, except the ones for which a different
context has been defined (be it user defined connections or internal connections used in other objects).
On the other hand, if cnc
is not %NULL, then the setting only applied to cnc
.
For exemple if there is a GUI which needs to continue to handle events, then you can use this function to pass the default #GMainContext used for the UI refreshing, for example:
If context
is %NULL, then potentially blocking operation will actually block any event from being processed
while the blocking operation is being performed.
the #GThread in which context
will be used, or %NULL (for the current thread)
a #GMainContext, or %NULL
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 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:
last_insert_row
may be %NULL after the function call if either the database provider
does not support it, or if the last interted row could not be determined (for example with SQLite if the table
in which the data is inserted has the WITHOUT ROWID optimization).
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
.
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()).
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
Retreive a pointer to the #GdaWorker used internally by the connection. This function is reserved to database provider's implementation and should not be used otherwise.
a #GdaServerProviderConnectionData, or %NULL
This function creates a new connection, 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_new_from_string() instead of this method.
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.
If auth_string
is given, it wil be used, otherwise auth_string of #GdaDsnInfo will be used.
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).
The returned connection is not yet opened, you need to call gda_connection_open() or gda_connection_open_async().
data source name.
authentication string, or %NULL
options for the connection (see #GdaConnectionOptions).
This function creates a new function, using a pre-defined data source (DSN) name, 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_new_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 separated 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).
The returned connection is not yet opened, you need to call gda_connection_open() or gda_connection_open_async().
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-6.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).
The returned connection is not yet opened, you need to call gda_connection_open() or gda_connection_open_async().
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 creates a connection and opens it, using a DSN. If opening fails, then no connection is created. See gda_connection_new_from_dsn() for more information.
data sourcename.
authentication string, or %NULL
options for the connection (see #GdaConnectionOptions).
This function creates a connection and opens it, using a DSN name. If opening fails, then no connection is created. The named DSN should be available. See gda_connection_new_from_dsn_name() for more information.
data source name.
authentication string, or %NULL
options for the connection (see #GdaConnectionOptions).
This function creates a connection and opens it, using a connection string. If opening fails, then no connection is created. See gda_connection_new_from_string() for more information.
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
Defines the number of #GdaConnectionEvent objects kept in memory which can be fetched using gda_connection_get_events().