]> granicus.if.org Git - postgis/commitdiff
Transformed NULL numeric values to 0 as it was before the introduction
authorSandro Santilli <strk@keybit.net>
Thu, 13 May 2004 12:24:15 +0000 (12:24 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 13 May 2004 12:24:15 +0000 (12:24 +0000)
of bigint bug workaround.

git-svn-id: http://svn.osgeo.org/postgis/trunk@552 b70326c6-7e19-0410-871a-916f4a2858ee

loader/pgsql2shp.c

index 57bdffc700f279dd25e57fc61d123144a4635540..e268c74d28b138f793f57c90c2287b72b9300a34 100644 (file)
  * 
  **********************************************************************
  * $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