[gnome-db] import from csv



i didn't understand how to read from a csv file :-(

i am under windows with libgda 4.1.11 (i'm using this version because i didn't test the last version yet)

the code i'm using

			GdaSet *plist = gda_set_new_inline (14,
			                                    "SEPARATOR", G_TYPE_STRING, ";",
			                                    "ESCAPE_CHAR", G_TYPE_STRING, "",
			                                    "G_TYPE_0", G_TYPE_GTYPE, G_TYPE_INT,
"G_TYPE_1", G_TYPE_GTYPE, G_TYPE_STRING, "G_TYPE_2", G_TYPE_GTYPE, G_TYPE_STRING, "G_TYPE_3", G_TYPE_GTYPE, G_TYPE_STRING, "G_TYPE_4", G_TYPE_GTYPE, G_TYPE_STRING, "G_TYPE_5", G_TYPE_GTYPE, G_TYPE_STRING, "G_TYPE_6", G_TYPE_GTYPE, G_TYPE_STRING, "G_TYPE_7", G_TYPE_GTYPE, G_TYPE_STRING, "G_TYPE_8", G_TYPE_GTYPE, G_TYPE_STRING, "G_TYPE_9", G_TYPE_GTYPE, G_TYPE_STRING, "G_TYPE_10", G_TYPE_GTYPE, G_TYPE_STRING, "G_TYPE_11", G_TYPE_GTYPE, G_TYPE_STRING);
			dm = gda_data_model_import_new_file (filename, FALSE, plist);
			if (dm == NULL)
				{
					/* error */
					return NULL;
				}

dm is not null; if i call gda_data_model_import_get_errors (GDA_DATA_MODEL_IMPORT (dm)) it returns a non null gslist but only with the message "no error"

if i call gda_data_model_export_to_file i get an empty file; and if i call gda_data_model_get_n_rows i get -1

where am I doing wrong?

an extract from the csv file

1;ITC;NORD-OVEST;Nord-ovest;01;ITC1;PIEMONTE;Piemonte;001;ITC11;Torino;TO
1;ITC;NORD-OVEST;Nord-ovest;01;ITC1;PIEMONTE;Piemonte;002;ITC12;Vercelli;VC
1;ITC;NORD-OVEST;Nord-ovest;01;ITC1;PIEMONTE;Piemonte;003;ITC15;Novara;NO
1;ITC;NORD-OVEST;Nord-ovest;01;ITC1;PIEMONTE;Piemonte;004;ITC16;Cuneo;CN
1;ITC;NORD-OVEST;Nord-ovest;01;ITC1;PIEMONTE;Piemonte;005;ITC17;Asti;AT
1;ITC;NORD-OVEST;Nord-ovest;01;ITC1;PIEMONTE;Piemonte;006;ITC18;Alessandria;AL

thanks in advance



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]