| GNOME Data Access 5 manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Implemented Interfaces | Properties | ||||
struct GdaDataModelImport; struct GdaDataModelImportClass; GdaDataModelImportPrivate; GdaDataModel * gda_data_model_import_new_file (const gchar *filename,gboolean random_access,GdaSet *options); GdaDataModel * gda_data_model_import_new_mem (const gchar *data,gboolean random_access,GdaSet *options); GdaDataModel * gda_data_model_import_new_xml_node (xmlNodePtr node); GSList * gda_data_model_import_get_errors (GdaDataModelImport *model); void gda_data_model_import_clean_errors (GdaDataModelImport *model);
"data-string" gchar* : Read / Write / Construct Only "filename" gchar* : Read / Write / Construct Only "options" GdaSet* : Read / Write / Construct Only "random-access" gboolean : Read / Write / Construct Only "strict" gboolean : Read / Write / Construct "xml-node" gpointer : Read / Write / Construct Only
GdaDataModel * gda_data_model_import_new_file (const gchar *filename,gboolean random_access,GdaSet *options);
Creates a new GdaDataModel object which contains the data stored within the filename file.
The options are the following ones:
For the CSV format:
ENCODING (string): specifies the encoding of the data in the file
SEPARATOR (string): specifies the CSV separator (comma as default)
QUOTE (string): specifies the character used to as quote park (double quote as default)
TITLE_AS_FIRST_LINE (boolean): consider that the first line of the file contains columns' titles
G_TYPE_<column number> (GType): specifies the type of value expected in column <column number>
Other formats: no option
Note: after the creation, please use gda_data_model_import_get_errors() to check any error.
|
the file to import data from |
|
TRUE if random access will be required |
|
importing options. [transfer none][allow-none] |
Returns : |
a pointer to the newly created GdaDataModel. [transfer full] |
GdaDataModel * gda_data_model_import_new_mem (const gchar *data,gboolean random_access,GdaSet *options);
Creates a new GdaDataModel object which contains the data stored in the data string.
Important note: the data string is not copied for memory efficiency reasons and should not
therefore be altered in any way as long as the returned data model exists.
|
a string containing the data to import |
|
TRUE if random access will be required |
|
importing options, see gda_data_model_import_new_file() for more information. [transfer none][allow-none]
|
Returns : |
a pointer to the newly created GdaDataModel. [transfer full] |
GdaDataModel * gda_data_model_import_new_xml_node (xmlNodePtr node);
Creates a new GdaDataModel and loads the data in node. The resulting data model
can be accessed in a random way.
|
an XML node corresponding to a <data-array> tag. [transfer none] |
Returns : |
a pointer to the newly created GdaDataModel. [transfer full] |
GSList * gda_data_model_import_get_errors (GdaDataModelImport *model);
Get the list of errors which model has to report. The returned list is a list of
GError structures, and must not be modified
|
a GdaDataModelImport object |
Returns : |
the list of errors (which must not be modified), or NULL. [transfer none][element-type GObject.Error]
|
void gda_data_model_import_clean_errors (GdaDataModelImport *model);
Clears the history of errors model has to report
|
a GdaDataModelImport object |
"data-string" property "data-string" gchar* : Read / Write / Construct Only
Data to import, as a string.
Default value: NULL
"filename" property "filename" gchar* : Read / Write / Construct Only
Name of the file to import.
Default value: NULL
"random-access" property "random-access" gboolean : Read / Write / Construct Only
Defines if the data model will be accessed randomly or through a cursor. If set to FALSE,
access will have to be done using a cursor.
Default value: FALSE
"strict" property "strict" gboolean : Read / Write / Construct
Defines the behaviour in case the imported data contains recoverable errors (usually too
many or too few data per row). If set to TRUE, an error will be reported and the import
will stop, and if set to FALSE, then the error will be reported but the import will not stop.
Default value: FALSE
Since 4.2.1