int dump_format = 0; //0=insert statements, 1 = dump
int quoteidentifiers = 0;
int forceint4 = 0;
+int createindex = 0;
char opt = ' ';
char *col_names = NULL;
char *pgtype;
int PIP( Point P, Point* V, int n );
void *safe_malloc(size_t size);
void CreateTable(void);
+void CreateIndex(void);
void usage(char *me, int exitcode);
void InsertPoint(void);
void InsertPointWKT(void);
*/
if(opt != 'a') CreateTable();
+ /*
+ * Create GiST index if requested
+ */
+ if(createindex) CreateIndex();
+
/*
* Generate INSERT or COPY lines
*/
printf("'%s',%d);\n", pgtype, pgdims);
}
+void
+CreateIndex(void)
+{
+ /*
+ * Create gist index
+ */
+ if ( schema )
+ {
+ printf("CREATE INDEX \"%s_%s_gist\" ON \"%s\".\"%s\" using gist (\"%s\" gist_geometry_ops);\n", table, geom, schema, table, geom);
+ }
+ else
+ {
+ printf("CREATE INDEX \"%s_%s_gist\" ON \"%s\" using gist (\"%s\" gist_geometry_ops);\n", table, geom, table, geom);
+ }
+}
+
void
LoadData(void)
{
fprintf(stderr, "\n");
fprintf(stderr, " -i Use int4 type for all integer dbf fields.\n");
fprintf(stderr, "\n");
+ fprintf(stderr, " -I Create a GiST index on the geometry column.\n");
+ fprintf(stderr, "\n");
fprintf(stderr, " -w Use wkt format (for postgis-0.x support - drops M - drifts coordinates).\n");
#ifdef USE_ICONV
fprintf(stderr, "\n");
extern char *optarg;
extern int optind;
- while ((c = getopt(ARGC, ARGV, "kcdapDs:g:iW:w")) != EOF){
+ while ((c = getopt(ARGC, ARGV, "kcdapDs:g:iW:wI")) != EOF){
switch (c) {
case 'c':
if (opt == ' ')
case 'i':
forceint4 = 1;
break;
+ case 'I':
+ createindex = 1;
+ break;
case 'w':
hwgeom = 1;
break;
/**********************************************************************
* $Log$
+ * Revision 1.88.2.2 2005/07/01 14:22:40 strk
+ * backported -I switch
+ *
* Revision 1.88.2.1 2005/04/21 09:07:41 strk
* Applied patch from Ron Mayer fixing a segfault in string escaper funx
*