Changeset 2513
- Timestamp:
- 10/14/06 07:22:10 (6 years ago)
- Location:
- trunk
- Files:
-
- 7 modified
-
CHANGES (modified) (1 diff)
-
doc/man/pgsql2shp.1 (modified) (1 diff)
-
doc/man/shp2pgsql.1 (modified) (1 diff)
-
loader/pgsql2shp.c (modified) (6 diffs)
-
loader/README.pgsql2shp (modified) (1 diff)
-
loader/README.shp2pgsql (modified) (1 diff)
-
loader/shp2pgsql.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/CHANGES
r2512 r2513 5 5 - Include the Version.config in loader/dumper USAGE messages 6 6 - Replace hand-made, fragile JDBC version parser with Properties 7 - Sanitized usage output of loader/dumper. 7 8 8 9 -
trunk/doc/man/pgsql2shp.1
r2503 r2513 67 67 \fB\-k\fR 68 68 Keep idendifiers case (don't uppercase field names). 69 .TP 70 \fB\-?\fR 71 Display version and usage information. 69 72 70 73 .SH "INSTALLATION" -
trunk/doc/man/shp2pgsql.1
r2503 r2513 89 89 \fB\-N\fR <\fIpolicy\fR> 90 90 Specify NULL geometries handling policy (insert,skip,abort). 91 .TP 92 \fB\-?\fR 93 Display version and usage information. 91 94 92 95 .SH "INSTALLATION" -
trunk/loader/pgsql2shp.c
r2512 r2513 94 94 int getMaxFieldSize(PGconn *conn, char *schema, char *table, char *fname); 95 95 int parse_commandline(int ARGC, char **ARGV); 96 void usage( int exitstatus);96 void usage(char* me, int exitstatus, FILE* out); 97 97 char *getTableOID(char *schema, char *table); 98 98 int addRecord(PGresult *res, int residx, int row); … … 195 195 if ( getenv("ROWBUFLEN") ) rowbuflen=atoi(getenv("ROWBUFLEN")); 196 196 197 if ( ARGC == 1 ) {198 usage(0);199 }200 201 197 /* 202 198 * Make sure dates are returned in ISO … … 210 206 if ( ! parse_commandline(ARGC, ARGV) ) { 211 207 printf("\n**ERROR** invalid option or command parameters\n\n"); 212 usage( 2);208 usage(ARGV[0], 2, stderr); 213 209 } 214 210 … … 2309 2305 2310 2306 void 2311 usage(int status) 2312 { 2313 printf("RCSID: %s RELEASE: %s\n", rcsid, POSTGIS_VERSION); 2314 printf("USAGE: pgsql2shp [<options>] <database> [<schema>.]<table>\n"); 2315 printf(" pgsql2shp [<options>] <database> <query>\n"); 2316 printf("\n"); 2317 printf("OPTIONS:\n"); 2318 printf(" -f <filename> Use this option to specify the name of the file\n"); 2319 printf(" to create.\n"); 2320 printf(" -h <host> Allows you to specify connection to a database on a\n"); 2321 printf(" machine other than the default.\n"); 2322 printf(" -p <port> Allows you to specify a database port other than the default.\n"); 2323 printf(" -P <password> Connect to the database with the specified password.\n"); 2324 printf(" -u <user> Connect to the database as the specified user.\n"); 2325 printf(" -g <geometry_column> Specify the geometry column to be exported.\n"); 2326 printf(" -b Use a binary cursor.\n"); 2327 printf(" -r Raw mode. Do not assume table has been created by \n"); 2328 printf(" the loader. This would not unescape attribute names\n"); 2329 printf(" and will not skip the 'gid' attribute.\n"); 2330 printf(" -k Keep postgresql identifiers case.\n"); 2331 printf("\n"); 2307 usage(char* me, int status, FILE* out) 2308 { 2309 fprintf(out,"RCSID: %s RELEASE: %s\n", rcsid, POSTGIS_VERSION); 2310 fprintf(out,"USAGE: %s [<options>] <database> [<schema>.]<table>\n", me); 2311 fprintf(out," %s [<options>] <database> <query>\n", me); 2312 fprintf(out,"\n"); 2313 fprintf(out,"OPTIONS:\n"); 2314 fprintf(out," -f <filename> Use this option to specify the name of the file\n"); 2315 fprintf(out," to create.\n"); 2316 fprintf(out," -h <host> Allows you to specify connection to a database on a\n"); 2317 fprintf(out," machine other than the default.\n"); 2318 fprintf(out," -p <port> Allows you to specify a database port other than the default.\n"); 2319 fprintf(out," -P <password> Connect to the database with the specified password.\n"); 2320 fprintf(out," -u <user> Connect to the database as the specified user.\n"); 2321 fprintf(out," -g <geometry_column> Specify the geometry column to be exported.\n"); 2322 fprintf(out," -b Use a binary cursor.\n"); 2323 fprintf(out," -r Raw mode. Do not assume table has been created by \n"); 2324 fprintf(out," the loader. This would not unescape attribute names\n"); 2325 fprintf(out," and will not skip the 'gid' attribute.\n"); 2326 fprintf(out," -k Keep postgresql identifiers case.\n"); 2327 fprintf(out," -? Display this help screen.\n"); 2328 fprintf(out,"\n"); 2332 2329 exit (status); 2333 2330 } … … 2337 2334 parse_commandline(int ARGC, char **ARGV) 2338 2335 { 2336 if ( ARGC == 1 ) { 2337 usage(ARGV[0], 0, stdout); 2338 } 2339 2339 2340 int c, curindex; 2340 2341 char buf[1024]; … … 2386 2387 break; 2387 2388 case '?': 2389 usage(ARGV[0], 0, stdout); 2388 2390 default: 2389 2391 return 0; -
trunk/loader/README.pgsql2shp
r2503 r2513 66 66 -k Keep idendifiers case (don't uppercase field names). 67 67 68 -? Display version and usage information. 69 68 70 69 71 INSTALLATION -
trunk/loader/README.shp2pgsql
r2503 r2513 89 89 Specify NULL geometries handling policy (insert,skip,abort). 90 90 91 -? Display version and usage information. 92 91 93 92 94 INSTALLATION -
trunk/loader/shp2pgsql.c
r2512 r2513 107 107 void CreateTable(void); 108 108 void CreateIndex(void); 109 void usage(char *me, int exitcode );109 void usage(char *me, int exitcode, FILE* out); 110 110 void InsertPoint(void); 111 111 void InsertPointWKT(void); … … 382 382 * Parse command line 383 383 */ 384 if ( ! ParseCmdline(ARGC, ARGV) ) usage(ARGV[0], 2 );384 if ( ! ParseCmdline(ARGC, ARGV) ) usage(ARGV[0], 2, stderr); 385 385 386 386 /* … … 732 732 733 733 void 734 usage(char *me, int exitcode) 735 { 736 fprintf(stderr, "RCSID: %s RELEASE: %s\n", rcsid, POSTGIS_VERSION); 737 fprintf(stderr, "USAGE: %s [<options>] <shapefile> [<schema>.]<table>\n", me); 738 fprintf(stderr, "\n"); 739 fprintf(stderr, "OPTIONS:\n"); 740 fprintf(stderr, " -s <srid> Set the SRID field. If not specified it defaults to -1.\n"); 741 fprintf(stderr, "\n"); 742 fprintf(stderr, " (-d|a|c|p) These are mutually exclusive options:\n"); 743 fprintf(stderr, " -d Drops the table, then recreates it and populates\n"); 744 fprintf(stderr, " it with current shape file data.\n"); 745 fprintf(stderr, " -a Appends shape file into current table, must be\n"); 746 fprintf(stderr, " exactly the same table schema.\n"); 747 fprintf(stderr, " -c Creates a new table and populates it, this is the\n"); 748 fprintf(stderr, " default if you do not specify any options.\n"); 749 fprintf(stderr, " -p Prepare mode, only creates the table\n"); 750 fprintf(stderr, "\n"); 751 fprintf(stderr, " -g <geometry_column> Specify the name of the geometry column\n"); 752 fprintf(stderr, " (mostly useful in append mode).\n"); 753 fprintf(stderr, "\n"); 754 fprintf(stderr, " -D Use postgresql dump format (defaults to sql insert\n"); 755 fprintf(stderr, " statments.\n"); 756 fprintf(stderr, "\n"); 757 fprintf(stderr, " -k Keep postgresql identifiers case.\n"); 758 fprintf(stderr, "\n"); 759 fprintf(stderr, " -i Use int4 type for all integer dbf fields.\n"); 760 fprintf(stderr, "\n"); 761 fprintf(stderr, " -I Create a GiST index on the geometry column.\n"); 762 fprintf(stderr, "\n"); 763 fprintf(stderr, " -S Generate simple geometries instead of MULTI geometries.\n"); 764 fprintf(stderr, "\n"); 765 fprintf(stderr, " -w Use wkt format (for postgis-0.x support - drops M - drifts coordinates).\n"); 734 usage(char *me, int exitcode, FILE* out) 735 { 736 fprintf(out, "RCSID: %s RELEASE: %s\n", rcsid, POSTGIS_VERSION); 737 fprintf(out, "USAGE: %s [<options>] <shapefile> [<schema>.]<table>\n", me); 738 fprintf(out, "OPTIONS:\n"); 739 fprintf(out, " -s <srid> Set the SRID field. If not specified it defaults to -1.\n"); 740 fprintf(out, " (-d|a|c|p) These are mutually exclusive options:\n"); 741 fprintf(out, " -d Drops the table, then recreates it and populates\n"); 742 fprintf(out, " it with current shape file data.\n"); 743 fprintf(out, " -a Appends shape file into current table, must be\n"); 744 fprintf(out, " exactly the same table schema.\n"); 745 fprintf(out, " -c Creates a new table and populates it, this is the\n"); 746 fprintf(out, " default if you do not specify any options.\n"); 747 fprintf(out, " -p Prepare mode, only creates the table.\n"); 748 fprintf(out, " -g <geometry_column> Specify the name of the geometry column\n"); 749 fprintf(out, " (mostly useful in append mode).\n"); 750 fprintf(out, " -D Use postgresql dump format (defaults to sql insert statments.\n"); 751 fprintf(out, " -k Keep postgresql identifiers case.\n"); 752 fprintf(out, " -i Use int4 type for all integer dbf fields.\n"); 753 fprintf(out, " -I Create a GiST index on the geometry column.\n"); 754 fprintf(out, " -S Generate simple geometries instead of MULTI geometries.\n"); 755 fprintf(out, " -w Use wkt format (for postgis-0.x support - drops M - drifts coordinates).\n"); 766 756 #ifdef USE_ICONV 767 fprintf(stderr, "\n"); 768 fprintf(stderr, " -W <encoding> Specify the character encoding of Shape's\n"); 769 fprintf(stderr, " attribute column. (default : \"ASCII\")\n"); 757 fprintf(out, " -W <encoding> Specify the character encoding of Shape's\n"); 758 fprintf(out, " attribute column. (default : \"ASCII\")\n"); 770 759 #endif 771 fprintf( stderr, "\n");772 fprintf(stderr, " -N <policy> Specify NULL geometries handling policy (insert,skip,abort)\n");760 fprintf(out, " -N <policy> Specify NULL geometries handling policy (insert,skip,abort)\n"); 761 fprintf(out, " -? Display this help screen\n"); 773 762 exit (exitcode); 774 763 } … … 1279 1268 extern char *optarg; 1280 1269 extern int optind; 1270 1271 if ( ARGC == 1 ) { 1272 usage(ARGV[0], 0, stdout); 1273 } 1281 1274 1282 1275 while ((c = getopt(ARGC, ARGV, "kcdapDs:Sg:iW:wIN:")) != EOF){ … … 1355 1348 break; 1356 1349 case '?': 1350 usage(ARGV[0], 0, stdout); 1357 1351 default: 1358 1352 return 0;
