From df38f2882d52df522515feae62bbf59eed747de9 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 11 Oct 2004 14:34:40 +0000 Subject: [PATCH] Added endiannes specification for postgis-1.0.0+ git-svn-id: http://svn.osgeo.org/postgis/trunk@985 b70326c6-7e19-0410-871a-916f4a2858ee --- loader/pgsql2shp.c | 47 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/loader/pgsql2shp.c b/loader/pgsql2shp.c index 202ac93f5..54bc03e31 100644 --- a/loader/pgsql2shp.c +++ b/loader/pgsql2shp.c @@ -1828,6 +1828,8 @@ addRecord(PGresult *res, int residx, int row) int nFields = PQnfields(res); int flds = 0; /* number of dbf field */ char *val; + char *v; + int junk; for (j=0; j 0 ) { - int junk; - char *v = PQgetvalue(res, residx, j); val = PQunescapeBytea(v, &junk); - //printf("Unescaped %d bytes\n", junk); } - -#else - char *v = PQgetvalue(res, residx, j); - val = HexDecode(v); + else + { + val = HexDecode(v); + } #endif // HEXWKB #if VERBOSE > 2 dump_wkb(val); @@ -2637,21 +2640,14 @@ initialize() #ifdef HEXWKB + sprintf(buf, "asbinary(\"%s\", 'XDR')", + mainscan_flds[i]); +#else if ( pgis_major_version > 0 ) - { - sprintf(buf, "\"%s\"", - mainscan_flds[i]); - } - else { sprintf(buf, "asbinary(\"%s\", 'XDR')", mainscan_flds[i]); } -#else - if ( pgis_major_version > 0 ) - { - sprintf(buf, "asbinary(\"%s\")", mainscan_flds[i]); - } else { sprintf(buf, "asbinary(\"%s\", 'XDR')::bytea", mainscan_flds[i]); @@ -2663,20 +2659,12 @@ initialize() { #ifdef HEXWKB - if ( pgis_major_version > 0 ) - { - sprintf(buf, "\"%s\"", - mainscan_flds[i]); - } - else - { - sprintf(buf, "asbinary(\"%s\", 'NDR')", - mainscan_flds[i]); - } + sprintf(buf, "asbinary(\"%s\", 'NDR')", + mainscan_flds[i]); #else // ndef HEXWKB if ( pgis_major_version > 0 ) { - sprintf(buf, "asbinary(\"%s\")", + sprintf(buf, "asbinary(\"%s\", 'NDR')", mainscan_flds[i]); } else @@ -2970,6 +2958,9 @@ shapetypename(int num) } /********************************************************************** * $Log$ + * Revision 1.63 2004/10/11 14:34:40 strk + * Added endiannes specification for postgis-1.0.0+ + * * Revision 1.62 2004/10/07 21:51:05 strk * Fixed a bug in 4d handling * -- 2.40.0