an XML node representing a <gda_array_data> XML node.
Appends a row to the data model (the new row will possibly have NULL values for all columns, or some other values depending on the data model implementation)
Upon errors -1 will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
Appends a row to the given data model. If any value in values
is actually %NULL, then
it is considered as a default value. If values
is %NULL then all values are set to their default value.
Upon errors -1 will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
#GList of #GValue* representing the row to add. The length must match model's column count. These #GValue are value-copied (the user is still responsible for freeing them).
Makes a copy of src
into a new #GdaDataModelArray object
Like gda_data_model_array_copy_model(), makes a copy of src,
but copies only some
columns.
array of src'
s columns to copy into the new array, not %NULL
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
Creates a new iterator object #GdaDataModelIter object which can be used to iterate through
rows in model
. The new #GdaDataModelIter does not hold any reference to model
(ie. if model
is destroyed at some point, the new iterator will become useless but in any case it will not prevent
the data model from being destroyed).
Depending on the data model's implementation, a new #GdaDataModelIter object may be created,
or a reference to an already existing #GdaDataModelIter may be returned. For example if model
only
supports being accessed using a forward moving cursor (say a the result of a SELECT executed by SQLite
with a cursor access mode specified), then this method will always return the same iterator.
If a new #GdaDataModelIter is created, then the row it represents is undefined.
For models which can be accessed randomly, any row can be set using gda_data_model_iter_move_to_row(), and for models which are accessible sequentially only then use gda_data_model_iter_move_next() (and gda_data_model_iter_move_prev() if supported).
Note: for the #GdaDataProxy data model (which proxies any #GdaDataModel for modifications and
has twice the number of columns of the proxied data model), this method will create an iterator
in which only the columns of the proxied data model appear. If you need to have a #GdaDataModelIter
in which all the proxy's columns appear, create it using:
Queries the underlying data model implementation for a description of a given column. That description is returned in the form of a #GdaColumn structure, which contains all the information about the given column in the data model.
WARNING: the returned #GdaColumn object belongs to the model
model and
and should not be destroyed; any modification will affect the whole data model.
column number.
Dumps a textual representation of the model
to the to_stream
stream
The following environment variables can affect the resulting output:
where to dump the data model
Dumps a textual representation of the model
into a new string. The main differences with gda_data_model_export_to_string() are that
the formatting options are passed using environment variables, and that the data is dumped regardless of the user locale (e.g. dates
are not formatted according to the locale).
The following environment variables can affect the resulting output:
Exports data contained in model
to the file
file; the format is specified using the format
argument. Note that
the date format used is the one used by the connection from which the data model has been made (as the result of a
SELECT statement), or, for other kinds of data models, the default format (refer to gda_data_handler_get_default()) unless
the "cnc" property has been set and points to a #GdaConnection to use that connection's date format.
Specifically, the parameters in the options
list can be:
Warning: this function uses a #GdaDataModelIter iterator, and if model
does not offer a random access
(check using gda_data_model_get_access_flags()), the iterator will be the same as normally used
to access data in model
previously to calling this method, and this iterator will be moved (point to
another row).
Upon errors %FALSE will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
the format in which to export data
the filename to export to
an array containing which columns of model
will be exported, or %NULL for all columns
an array containing which rows of model
will be exported, or %NULL for all rows
list of options for the export
Exports data contained in model
to a string; the format is specified using the format
argument, see the
gda_data_model_export_to_file() documentation for more information about the options
argument (except for the
"OVERWRITE" option).
Warning: this function uses a #GdaDataModelIter iterator, and if model
does not offer a random access
(check using gda_data_model_get_access_flags()), the iterator will be the same as normally used
to access data in model
previously to calling this method, and this iterator will be moved (point to
another row).
See also gda_data_model_dump_as_string();
the format in which to export data
an array containing which columns of model
will be exported, or %NULL for all columns
an array containing which rows of model
will be exported, or %NULL for all rows
list of options for the export
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().
Disables notifications of changes on the given data model. To re-enable notifications again, you should call the #gda_data_model_thaw function.
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.
Get the attributes of model
such as how to access the data it contains if it's modifiable, etc.
Get the attributes of the value stored at (row, col) in model,
which
is an ORed value of #GdaValueAttribute flags. As a special case, if
row
is -1, then the attributes returned correspond to a "would be" value
if a row was added to model
.
a valid column number
a valid row number, or -1
Get the index of the first column named name
in model
.
a column name
Gets a named field from the objects table of associations (see g_object_set_data()).
name of the key for that association
Returns the status of notifications changes on the given data model.
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
This function gets back user data pointers stored via g_object_set_qdata().
A #GQuark, naming the user data pointer
Returns the first row where all the values in values
at the columns identified at
cols_index
match. If the row can't be identified, then returns -1;
NOTE: the cols_index
array MUST contain a column index for each value in values
a list of #GValue values (no %NULL is allowed)
an array of #gint containing the column number to match each value of values
Upon errors %NULL will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
This method is similar to gda_data_model_get_value_at(), except that it also allows one to specify the expected #GType of the value to get: if the data model returned a #GValue of a type different than the expected one, then this method returns %NULL and an error code.
Note: the same limitations and usage instructions apply as for gda_data_model_get_value_at().
Upon errors %NULL will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
a valid column number.
a valid row number.
the expected data type of the returned value
if TRUE, then NULL values (value of type %GDA_TYPE_NULL) will not generate any error
Retrieves the data stored in the given position (identified by
the col
and row
parameters) on a data model.
Upon errors %NULL will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
This is the main function for accessing data in a model which allows random access to its data. To access data in a data model using a cursor, use a #GdaDataModelIter object, obtained using gda_data_model_create_iter().
Note1: the returned #GValue must not be modified directly (unexpected behaviours may occur if you do so).
Note2: the returned value may become invalid as soon as any Libgda part is executed again, which means if you want to keep the value, a copy must be made, however it will remain valid as long as the only Libgda usage is calling gda_data_model_get_value_at() for different values of the same row.
If you want to modify a value stored in a #GdaDataModel, use the gda_data_model_set_value_at() or gda_data_model_set_values() methods.
Upon errors %NULL will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
a valid column number.
a valid row number.
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
Imports data contained in the file
file into model;
the format is detected.
Upon errors FALSE will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
the filename to import from
a #GHashTable for columns translating, or %NULL, see gda_data_model_import_from_model()
list of options for the export
Copy the contents of the from
data model to the to
data model. The copy stops as soon as an error
orrurs.
The cols_trans
is a hash table for which keys are to
columns numbers and the values are
the corresponding column numbers in the from
data model. To set the values of a column in to
to NULL,
create an entry in the hash table with a negative value. For example:
Upon errors FALSE will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
the source #GdaDataModel
TRUE if to
is completely overwritten by from'
s data, and FALSE if from'
s data is appended to to
a #GHashTable for columns translating, or %NULL
Loads the data from string
into model
.
Upon errors FALSE will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
the string to import data from
a hash table containing which columns of model
will be imported, or %NULL for all columns, see gda_data_model_import_from_model()
list of options for the export
Checks whether object
has a [floating][floating-ref] reference.
Moves iter
to the row number given by row
.
a #GdaDataModelIter object.
a row to point to with iter
Moves iter
to the next row in model
.
a #GdaDataModelIter object.
Moves iter
to the next row in model
.
a #GdaDataModelIter object.
Set value
to the given column
and row pointed by iter
in the given model
.
a #GdaDataModelIter object.
the number of column to set value to
the to use to set on
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
.
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().
Removes a row from the data model.
Upon errors FALSE will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
the row number to be removed.
Emits the 'reset' and 'changed' signal on model
.
Emits the 'row_inserted' and 'changed' signals on model
.
This method should only be used by #GdaDataModel implementations to signal that a row has been inserted.
row number.
Emits the 'row_removed' and 'changed' signal on model
.
This method should only be used by #GdaDataModel implementations to signal that a row has been removed
row number.
Emits the 'row_updated' and 'changed' signals on model
.
This method should only be used by #GdaDataModel implementations to signal that a row has been updated.
row number.
Releases all references to other objects. This can be used to break reference cycles.
This function should only be called from object system implementations.
Sends a hint to the data model. The hint may or may not be handled by the data model, depending on its implementation
a hint to send to the model
an optional value to specify the hint, or %NULL
Sets the name
of the given col
in model,
and if its title is not set, also sets the
title to name
.
column number
name for the given column.
Sets the title
of the given col
in model
.
column number
title for the given column.
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
wrapper
will report as many columns as mapping_size,
and for each value at position 'i' in mapping,
wrapper
will report the 'i'th column, mapped to the wrapped data model column at position mapping[i].
For example if mapping is {3, 4, 0}, then wrapper
will report 3 columns, respectively mapped to the 4th,
5th and 1st columns of the wrapped data model (as column numbers start at 0).
If mapping
is %NULL, then no mapping is done and wrapper'
s columns will be the same as the wrapped
data model.
If a column in mapping
does not exist in the wrapped data model, then it is simply ignored (no error
reported).
Please note that if wrapper
has already been used and if the wrapped data model offers a cursor forward
access mode, then this method will return %FALSE and no action will be done.
If the mapping is applied, then any existing iterator will be invalid, and wrapper
is reset as if it
had just been created.
an array of #gint which represents the mapping between wrapper'
s columns and the columns of the wrapped data model
Enable or disable notifications changes on the given data model.
Set to TRUE if you require notifications.
Sets a property on an object.
the name of the property to set
the value
Modifies a value in model,
at (col,
row)
.
Upon errors FALSE will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
column number.
row number.
a #GValue (not %NULL)
In a similar way to gda_data_model_set_value_at(), this method modifies a data model's contents by setting several values at once.
If any value in values
is actually %NULL, then the value in the corresponding column is left
unchanged.
Upon errors FALSE will be returned and error
will be assigned a
#GError from the #GDA_DATA_MODEL_ERROR domain.
row number.
a list of #GValue (or %NULL), one for at most the number of columns of model
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
Re-enables notifications of changes on the given data model.
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.
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.
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
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
Adds the data from an XML node to the given data model (see the DTD for that node in the $prefix/share/libgda/dtd/libgda-array.dtd file).
Upon errors FALSE will be returned and
error
will be assigned a #GError from the #GDA_DATA_MODEL_ERROR domain.