1445         char *sql_form, *query, *connection_string, *progress_shapefile = NULL;
 
 1450         char *header, *footer, *record;
 
 1456                 pgui_seterr(
_(
"ERROR: You haven't specified any files to import"));
 
 1466                 pgui_seterr(
_(
"Unable to connect to the database - please check your connection settings"));
 
 1483         sql_form = 
"SELECT a.attnum, a.attname AS field, t.typname AS type, a.attlen AS length, a.atttypmod AS precision FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n WHERE c.relname = '%s' AND n.nspname = '%s' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND c.relnamespace = n.oid ORDER BY a.attnum";
 
 1495                 sz = strlen(sql_form) + strlen(loader_file_config->
schema) + strlen(loader_file_config->
table) + 1;
 
 1497                 snprintf(query, sz, sql_form, loader_file_config->
table, loader_file_config->
schema);
 
 1532                 pgui_logf(
"\n==============================");
 
 1533                 pgui_logf(
"Importing with configuration: %s, %s, %s, %s, mode=%c, dump=%d, simple=%d, geography=%d, index=%d, shape=%d, srid=%d", loader_file_config->
table, loader_file_config->
schema, loader_file_config->
geo_col, loader_file_config->
shp_file, loader_file_config->
opt, loader_file_config->
dump_format, loader_file_config->
simple_geometries, loader_file_config->
geography, loader_file_config->
createindex, loader_file_config->
readshape, loader_file_config->
sr_id);
 
 1544                 gtk_widget_set_sensitive(widget, 
FALSE);
 
 1547                 while (gtk_events_pending())
 
 1548                         gtk_main_iteration();
 
 1560                                 goto import_cleanup;
 
 1564                 for (i = strlen(loader_file_config->
shp_file); i >= 0
 
 1565                         && loader_file_config->
shp_file[i - 1] != 
'\\' && loader_file_config->
shp_file[i - 1] != 
'/'; i--);
 
 1567                 progress_shapefile = 
malloc(strlen(loader_file_config->
shp_file));
 
 1568                 strcpy(progress_shapefile, &loader_file_config->
shp_file[i]);
 
 1574                 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(
progress), 0.0);
 
 1591                                 goto import_cleanup;
 
 1600                         goto import_cleanup;
 
 1606             int records_per_tick = (numrecords / 200) - 1;
 
 1608             if ( records_per_tick < 1 )
 
 1609                 records_per_tick = 1;
 
 1621                                                 goto import_cleanup;
 
 1629                                         goto import_cleanup;
 
 1633                         for (i = 0; i < numrecords && 
is_running; i++)
 
 1648                                                 pgui_logf(
_(
"Import failed on record number %d"), i);
 
 1656                                         goto import_cleanup;
 
 1670                                                 pgui_logf(
_(
"Import failed on record number %d"), i);
 
 1685                                 if ( i % records_per_tick == 0 )
 
 1686                                     gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(
progress), (
float)i / numrecords);
 
 1689                                 while (gtk_events_pending())
 
 1690                                         gtk_main_iteration();
 
 1697                                         goto import_cleanup;
 
 1700                                 if (PQresultStatus(
result) != PGRES_COMMAND_OK)
 
 1704                                         goto import_cleanup;
 
 1719                                         goto import_cleanup;
 
 1725                                 gtk_label_set_text(GTK_LABEL(
label_progress), 
_(
"Creating spatial index..."));
 
 1728                                 while (gtk_events_pending())
 
 1729                                         gtk_main_iteration();
 
 1737                                 goto import_cleanup;
 
 1758                 if (progress_shapefile)
 
 1759                         free(progress_shapefile);
 
 1769         gtk_widget_set_sensitive(widget, 
TRUE);
 
 1772         gtk_widget_hide(widget);
 
 1773         gtk_widget_show(widget);
 
 1779         while (gtk_events_pending())
 
 1780                 gtk_main_iteration();
 
 1783         free(connection_string);
 
char result[OUT_DOUBLE_BUFFER_SIZE]
char * ShpDumperGetConnectionStringFromConn(SHPCONNECTIONCONFIG *conn)
const char SHPAPI_CALL1 * SHPTypeName(int nSHPType);const char SHPAPI_CALL1(*) SHPPartTypeName(int nPartType
int ShpLoaderGetRecordCount(SHPLOADERSTATE *state)
void ShpLoaderDestroy(SHPLOADERSTATE *state)
int ShpLoaderGetSQLCopyStatement(SHPLOADERSTATE *state, char **strheader)
int ShpLoaderOpenShape(SHPLOADERSTATE *state)
int ShpLoaderGenerateSQLRowStatement(SHPLOADERSTATE *state, int item, char **strrecord)
int ShpLoaderGetSQLFooter(SHPLOADERSTATE *state, char **strfooter)
SHPLOADERSTATE * ShpLoaderCreate(SHPLOADERCONFIG *config)
int ShpLoaderGetSQLHeader(SHPLOADERSTATE *state, char **strheader)
#define SHPLOADERRECISNULL
#define SHPLOADERRECDELETED
static GtkWidget * label_progress
static GtkWidget * progress
static void static void static void static void pgui_seterr(const char *fmt,...) __attribute__((format(printf
static int pgui_copy_write(const char *line)
static volatile int is_running
static int validate_remote_loader_columns(SHPLOADERCONFIG *config, PGresult *result)
static int pgui_copy_end(const int rollback)
static void static void static void pgui_logf(const char *fmt,...) __attribute__((format(printf
static PGconn * pg_connection
static void pgui_raise_error_dialogue(void)
static void static void static void static void static void update_conn_ui_from_conn_config(void)
static int pgui_copy_start(const char *sql)
static GtkWidget * dialog_progress
static int connection_test(void)
GtkListStore * import_file_list_store
#define GUIMSG_LINE_MAXLEN
static int pgui_exec(const char *sql)
static SHPCONNECTIONCONFIG * conn
static GtkWidget * window_conn
char message[SHPLOADERMSGLEN]