DataCollection
Object Hierarchy:
Vda.DataCollection
Vda.DataCollection
Vda.DataCollection
GLib.Object
GLib.Object
GLib.Object->Vda.DataCollection
Description:
public interface DataCollection : Object
Implementators will be able to execute a SELECT to get all objects in the database related to a
parent object.
public class Address : Object, Vda.DataObject { // DataObject public string database_table_name { get ; construct set ; } public Vda.Connection database_connection { get ; set ; } public Cancellable cancellable { get ; set ; } // Database mapping [Description (nick="@id::pkey::auto" )] public int id { get ; set ; } [Description (nick="@street" )] public string street { get ; set ; } [Description (nick="@client::id" )] public int client { get ; set ; } construct { database_table_name = "address" ; } } public class Addresses : Object, Vda.DataCollection { private string _parent_property; private DataObject _parent; private GLib.Type _object_type; private string _ref_field; public Vda.Connection database_connection { get ; set ; } public string parent_property { get { return _parent_property; } } public DataObject parent { get { return _parent; } } public GLib.Type object_type { get { return _object_type; } } public string ref_field{ get { return _ref_field; } } public Cancellable cancellable { get ; set ; } construct { _parent_property = "id" ; _ref_field = "client" ; _object_type = typeof (Address); } public Addresses (Client client) { _parent = client; } } public class Client : Object, Vda.DataObject { Vda.Connection _cnc = null ; // DataObject public string database_table_name { get ; construct set ; } public Vda.Connection database_connection { get { return _cnc; } set { _cnc = value ; addresses.database_connection = _cnc; } } public Cancellable cancellable { get ; set ; } // Database mapping [Description (nick="@id::pkey::auto" )] public int id { get ; set ; } [Description (nick="@name" )] public string name { get ; set ; } [Description (nick="@description" )] public string description { get ; set ; } [Description (nick="@phone::id" )] public string phone { get ; set ; } public Addresses addresses { get ; set ; } construct { database_table_name = "clients" ; addresses = new Addresses (this ); } }
Using the above code a query, by accessing the Addresses object, you can call
get_objects and a the following query will be executed:
SELECT * FROM address WHERE address.client = 100 ;
Above number 100, is calculated from the current instance of Client object's id property.
Content:
Properties:
Methods:
public virtual async TableModel get_objects () throws Error
Builds and execute a SELECT command with the given parameters, and
returns a TableModel with all related rows.
Inherited Members:
All known members inherited from class GLib.Object
@get
@new
@ref
@set
add_toggle_ref
add_weak_pointer
bind_property
connect
constructed
disconnect
dispose
dup_data
dup_qdata
force_floating
freeze_notify
get_class
get_data
get_property
get_qdata
get_type
getv
interface_find_property
interface_install_property
interface_list_properties
is_floating
new_valist
new_with_properties
newv
notify
notify_property
ref_count
ref_sink
remove_toggle_ref
remove_weak_pointer
replace_data
replace_qdata
set_data
set_data_full
set_property
set_qdata
set_qdata_full
set_valist
setv
steal_data
steal_qdata
thaw_notify
unref
watch_closure
weak_ref
weak_unref