]> granicus.if.org Git - postgis/commitdiff
Add some logging during the load so we can see what's going on.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 18 Dec 2009 20:51:43 +0000 (20:51 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Fri, 18 Dec 2009 20:51:43 +0000 (20:51 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@5034 b70326c6-7e19-0410-871a-916f4a2858ee

loader/shp2pgsql-gui.c

index 2e84e996896e8afc7f9fd9cd90be0b04ae0fa09b..30ecfc3f3cd7c5f0c77535beadab258feaaa8bf9 100644 (file)
@@ -527,7 +527,7 @@ pgui_action_shape_file_set(GtkWidget *widget, gpointer data)
        /* Copy the table name into a fresh memory slot. */
        table = malloc(table_end - table_start + 1);
        memcpy(table, table_start, table_end - table_start);
-       table[table_end - table_start + 1] = '\0';
+       table[table_end - table_start] = '\0';
 
        /* Set the table name into the configuration */
        config->table = table;
@@ -544,6 +544,7 @@ pgui_action_import(GtkWidget *widget, gpointer data)
        char *dest_string = NULL;
        int ret, i;
        char *header, *footer, *record; 
+       int log_frequency = 500;
 
 
        if ( ! (connection_string = pgui_read_connection() ) )
@@ -636,6 +637,7 @@ pgui_action_import(GtkWidget *widget, gpointer data)
        /* If we are in COPY (dump format) mode, output the COPY statement and enter COPY mode */
        if (state->config->dump_format)
        {
+               log_frequency = 5000; /* log less often so we run faster */
                ret = ShpLoaderGetSQLCopyStatement(state, &header);
                if (ret != SHPLOADEROK)
                {
@@ -667,6 +669,10 @@ pgui_action_import(GtkWidget *widget, gpointer data)
                                else
                                        ret = pgui_exec(record);
 
+                               /* Display a record number as we load */
+                               if ((i % log_frequency) == 0)
+                                       pgui_logf("Loaded record number #%d", i);
+
                                /* Display a record number if we failed */
                                if (!ret)
                                        pgui_logf("Failed record number #%d", i);