]> saetta.ns0.it Git - solipa/territorio/commitdiff
Test con correzioni dell'import da file istat di regioni e province (dopo aggiornamen...
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Wed, 3 Nov 2010 12:43:22 +0000 (13:43 +0100)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Wed, 3 Nov 2010 12:43:22 +0000 (13:43 +0100)
src/importaregioniprovinceistat.c

index 88208bd6de65f0083373397f9de2a15ddc2cdd59..6c03dbef1a024e1486f437a3c7cb8a6235666405 100644 (file)
@@ -135,9 +135,9 @@ TerritorioImportaRegioniProvinceIstat
                                        gtk_widget_destroy (dialog);
                                        return NULL;
                                }
-                       gda_data_model_dump (dm, stderr);
+                       /*gda_data_model_dump (dm, stderr);*/
 
-                       /*errors = gda_data_model_import_get_errors (GDA_DATA_MODEL_IMPORT (dm));
+                       errors = gda_data_model_import_get_errors (GDA_DATA_MODEL_IMPORT (dm));
                        if (errors != NULL)
                                {
                                        while (errors != NULL)
@@ -155,7 +155,7 @@ TerritorioImportaRegioniProvinceIstat
                                        gtk_dialog_run (GTK_DIALOG (dialog));
                                        gtk_widget_destroy (dialog);
                                        return NULL;
-                               }*/
+                               }
 
                        rows = gda_data_model_get_n_rows (dm);
                        g_message ("Numero di record: %d.", rows);
@@ -173,7 +173,7 @@ TerritorioImportaRegioniProvinceIstat
 
                        plist = gda_set_new_inline (1, "OVERWRITE", G_TYPE_BOOLEAN, TRUE);
                        gda_data_model_export_to_file (dm, GDA_DATA_MODEL_IO_TEXT_SEPARATED, "importato.csv",
-                                                              NULL, 0, NULL, 0, plist, NULL);
+                                                      NULL, 0, NULL, 0, plist, NULL);
 
                        /* TODO
                         * segnarsi i record aggiornati, perché alla fine del ciclo quelli
@@ -205,14 +205,14 @@ TerritorioImportaRegioniProvinceIstat
                                                                        sql = g_strdup_printf ("INSERT INTO regioni (id, nome, cod_istat)"
                                                                                               " VALUES (%d, '%s', '%s')",
                                                                                               id_regioni,
-                                                                                              gdaex_data_model_get_value_stringify_at (dm, row, 7),
+                                                                                              gdaex_strescape (gdaex_data_model_get_value_stringify_at (dm, row, 7), NULL),
                                                                                               k_regioni_cod_istat);
                                                                }
                                                        else
                                                                {
                                                                        id_regioni = gdaex_data_model_get_value_integer_at (dm_regioni, 0, 0);
                                                                        sql = g_strdup_printf ("UPDATE regioni SET nome = '%s' WHERE id = %d",
-                                                                                              gdaex_data_model_get_value_stringify_at (dm, row, 7),
+                                                                                              gdaex_strescape (gdaex_data_model_get_value_stringify_at (dm, row, 7), NULL),
                                                                                               id_regioni);
                                                                }
                                                        if (gdaex_execute (priv->commons->gdaex, sql) < 1)
@@ -245,7 +245,7 @@ TerritorioImportaRegioniProvinceIstat
                                                        sql = g_strdup_printf ("INSERT INTO province (id, nome, cod_istat, sigla, id_regioni)"
                                                                               " VALUES (%d, '%s', '%s', '%s', %d)",
                                                                               id_province,
-                                                                              gdaex_data_model_get_value_stringify_at (dm, row, 10),
+                                                                              gdaex_strescape (gdaex_data_model_get_value_stringify_at (dm, row, 10), NULL),
                                                                               gdaex_data_model_get_value_stringify_at (dm, row, 8),
                                                                               gdaex_data_model_get_value_stringify_at (dm, row, 11),
                                                                               id_regioni);
@@ -256,7 +256,7 @@ TerritorioImportaRegioniProvinceIstat
                                                        sql = g_strdup_printf ("UPDATE province SET nome = '%s',"
                                                                               " sigla = '%s'"
                                                                               " WHERE id = %d",
-                                                                              gdaex_data_model_get_value_stringify_at (dm, row, 10),
+                                                                              gdaex_strescape (gdaex_data_model_get_value_stringify_at (dm, row, 10), NULL),
                                                                               gdaex_data_model_get_value_stringify_at (dm, row, 11),
                                                                               id_province);
                                                }