DataModel.createIter

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.DataModelIter.moveToRow, and for models which are accessible sequentially only then use gda.data_model_iter.DataModelIter.moveNext (and gda.data_model_iter.DataModelIter.movePrev 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: <programlisting><![CDATA[iter = g_object_new (GDA_TYPE_DATA_MODEL_ITER, "data-model", proxy, NULL);]]></programlisting>

interface DataModel
createIter
()

Return Value

Type: gda.data_model_iter.DataModelIter

a #GdaDataModelIter object, or null if an error occurred