From: Sandro Santilli Date: Thu, 13 May 2004 12:24:15 +0000 (+0000) Subject: Transformed NULL numeric values to 0 as it was before the introduction X-Git-Tag: pgis_0_8_2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=733f5b73be34ab8781c0c22a4963e1e17769ddb0;p=postgis Transformed NULL numeric values to 0 as it was before the introduction of bigint bug workaround. git-svn-id: http://svn.osgeo.org/postgis/trunk@552 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/loader/pgsql2shp.c b/loader/pgsql2shp.c index 57bdffc70..e268c74d2 100644 --- a/loader/pgsql2shp.c +++ b/loader/pgsql2shp.c @@ -10,6 +10,10 @@ * ********************************************************************** * $Log$ + * Revision 1.51 2004/05/13 12:24:15 strk + * Transformed NULL numeric values to 0 as it was before the introduction + * of bigint bug workaround. + * * Revision 1.50 2004/05/13 12:13:01 strk * Used DBFWriteAttributeDirectly interface for writing attributes. * This way we are not affected by shapelib long-integer bug. @@ -2004,7 +2008,22 @@ addRecord(PGresult *res, int residx, int row) /* Default (not geometry) attribute */ if (type_ary[j] != 9) { - val = PQgetvalue(res, residx, j); + /* + * Transform NULL numbers to '0' + * This is because the shapelibe + * won't easly take care of setting + * nulls unless paying the acquisition + * of a bug in long integer values + */ + if ( PQgetisnull(res, residx, j) && + ( type_ary[j] == 1 || type_ary[j] == 2 ) ) + { + val = "0"; + } + else + { + val = PQgetvalue(res, residx, j); + } #if VERBOSE > 1 fprintf(stdout, "s"); fflush(stdout); #endif