From: Paul Ramsey Date: Fri, 18 Dec 2009 20:51:43 +0000 (+0000) Subject: Add some logging during the load so we can see what's going on. X-Git-Tag: 1.5.0b1~67 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e5f3b78f64d27144b164d200dd6cf0d566d49e0f;p=postgis Add some logging during the load so we can see what's going on. git-svn-id: http://svn.osgeo.org/postgis/trunk@5034 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/loader/shp2pgsql-gui.c b/loader/shp2pgsql-gui.c index 2e84e9968..30ecfc3f3 100644 --- a/loader/shp2pgsql-gui.c +++ b/loader/shp2pgsql-gui.c @@ -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);