PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ update_loader_config_globals_from_options_ui()

static void update_loader_config_globals_from_options_ui ( SHPLOADERCONFIG config)
static

Definition at line 533 of file shp2pgsql-gui.c.

References checkbutton_loader_options_autoindex, checkbutton_loader_options_dbfonly, checkbutton_loader_options_dumpformat, checkbutton_loader_options_forceint, checkbutton_loader_options_geography, checkbutton_loader_options_preservecase, checkbutton_loader_options_simplegeoms, shp_loader_config::createindex, shp_loader_config::dump_format, shp_loader_config::encoding, entry_options_encoding, shp_loader_config::forceint4, free(), shp_loader_config::geo_col, shp_loader_config::geography, GEOGRAPHY_DEFAULT, GEOMETRY_DEFAULT, shp_loader_config::quoteidentifiers, shp_loader_config::readshape, and shp_loader_config::simple_geometries.

Referenced by pgui_set_loader_configs_from_options_ui().

534 {
535  const char *entry_encoding = gtk_entry_get_text(GTK_ENTRY(entry_options_encoding));
536  gboolean preservecase = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_preservecase));
537  gboolean forceint = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_forceint));
538  gboolean createindex = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_autoindex));
539  gboolean dbfonly = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_dbfonly));
540  gboolean dumpformat = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_dumpformat));
541  gboolean geography = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_geography));
542  gboolean simplegeoms = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton_loader_options_simplegeoms));
543 
544  if (geography)
545  {
546  config->geography = 1;
547 
548  if (config->geo_col)
549  free(config->geo_col);
550 
551  config->geo_col = strdup(GEOGRAPHY_DEFAULT);
552  }
553  else
554  {
555  config->geography = 0;
556 
557  if (config->geo_col)
558  free(config->geo_col);
559 
560  config->geo_col = strdup(GEOMETRY_DEFAULT);
561  }
562 
563  /* Encoding */
564  if (entry_encoding && strlen(entry_encoding) > 0)
565  {
566  if (config->encoding)
567  free(config->encoding);
568 
569  config->encoding = strdup(entry_encoding);
570  }
571 
572  /* Preserve case */
573  if (preservecase)
574  config->quoteidentifiers = 1;
575  else
576  config->quoteidentifiers = 0;
577 
578  /* No long integers in table */
579  if (forceint)
580  config->forceint4 = 1;
581  else
582  config->forceint4 = 0;
583 
584  /* Create spatial index after load */
585  if (createindex)
586  config->createindex = 1;
587  else
588  config->createindex = 0;
589 
590  /* Read the .shp file, don't ignore it */
591  if (dbfonly)
592  {
593  config->readshape = 0;
594 
595  /* There will be no spatial column so don't create a spatial index */
596  config->createindex = 0;
597  }
598  else
599  config->readshape = 1;
600 
601  /* Use COPY rather than INSERT format */
602  if (dumpformat)
603  config->dump_format = 1;
604  else
605  config->dump_format = 0;
606 
607  /* Simple geometries only */
608  if (simplegeoms)
609  config->simple_geometries = 1;
610  else
611  config->simple_geometries = 0;
612 
613  return;
614 }
static GtkWidget * checkbutton_loader_options_preservecase
static GtkWidget * checkbutton_loader_options_dumpformat
static GtkWidget * checkbutton_loader_options_geography
#define GEOGRAPHY_DEFAULT
static GtkWidget * checkbutton_loader_options_forceint
#define GEOMETRY_DEFAULT
static GtkWidget * entry_options_encoding
static GtkWidget * checkbutton_loader_options_simplegeoms
static GtkWidget * checkbutton_loader_options_dbfonly
void free(void *)
static GtkWidget * checkbutton_loader_options_autoindex
Here is the call graph for this function:
Here is the caller graph for this function: