printf(" -i Use int4 type for all integer dbf fields.\n");
printf(" -I Create a spatial index on the geocolumn.\n");
printf(" -S Generate simple geometries instead of MULTI geometries.\n");
-#ifdef HAVE_ICONV
printf(" -W <encoding> Specify the character encoding of Shape's\n");
printf(" attribute column. (default : \"ASCII\")\n");
-#endif
printf(" -N <policy> NULL geometries handling policy (insert*,skip,abort)\n");
printf(" -n Only import DBF file.\n");
printf(" -? Display this help screen.\n");
break;
case 'W':
-#ifdef HAVE_ICONV
config->encoding = optarg;
-#else
- fprintf(stderr, "WARNING: the -W switch will have no effect. UTF8 disabled at compile time\n");
-#endif
break;
case 'N':
* Internal functions
*/
-#ifdef HAVE_ICONV
char *utf8(const char *fromcode, char *inputbuf);
-#endif
void vasbappend(stringbuffer_t *sb, char *fmt, ... );
char *escape_copy_string(char *str);
char *escape_insert_string(char *str);
va_end(ap);
}
-
-#ifdef HAVE_ICONV
/* Return allocated string containing UTF8 string converted from encoding fromcode */
char *
utf8(const char *fromcode, char *inputbuf)
return outputbuf;
}
-#endif
-
/**
* Escape input string suitable for COPY. If no characters require escaping, simply return
char name[MAXFIELDNAMELEN];
char name2[MAXFIELDNAMELEN];
DBFFieldType type = -1;
-#ifdef HAVE_ICONV
char *utf8str;
-#endif
/* If we are reading the entire shapefile, open it */
if (state->config->readshape == 1)
state->widths[j] = field_width;
state->precisions[j] = field_precision;
-#ifdef HAVE_ICONV
if (state->config->encoding)
{
/* If we are converting from another encoding to UTF8, convert the field name to UTF8 */
strncpy(name, utf8str, MAXFIELDNAMELEN);
free(utf8str);
}
-#endif
/*
* Make field names lowercase unless asked to
sb = stringbuffer_create();
stringbuffer_clear(sb);
-#ifdef HAVE_ICONV
/* Set the client encoding if required */
if (state->config->encoding)
{
vasbappend(sb, "SET CLIENT_ENCODING TO UTF8;\n");
}
-#endif
/* Use SQL-standard string escaping rather than PostgreSQL standard */
vasbappend(sb, "SET STANDARD_CONFORMING_STRINGS TO ON;\n");
char val[MAXVALUELEN];
char *escval;
char *geometry, *ret;
-#ifdef HAVE_ICONV
char *utf8str;
-#endif
int res, i;
/* Clear the stringbuffers */
return SHPLOADERERR;
}
-#ifdef HAVE_ICONV
if (state->config->encoding)
{
/* If we are converting from another encoding to UTF8, convert the field value to UTF8 */
strncpy(val, utf8str, MAXVALUELEN);
free(utf8str);
}
-#endif
/* Escape attribute correctly according to dump format */
if (state->config->dump_format)