This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository pgsql-ogr-fdw.

commit dd54788fba50e30087c8bced0a3d8e55e5d6dc4b
Author: Michael Fladischer <[email protected]>
Date:   Tue Oct 17 16:48:16 2017 +0200

    New upstream version 1.0.4
---
 .travis.yml |  5 +++++
 README.md   |  4 +---
 ogr_fdw.c   | 26 ++++++++++++--------------
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 8129835..9ff02bc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,6 +17,10 @@ matrix:
       language: cpp
       env:
         - GDAL_VERSION=21
+    - os: linux
+      language: cpp
+      env:
+        - GDAL_VERSION=22
 
 before_script:
   - sudo /etc/init.d/postgresql stop
@@ -41,6 +45,7 @@ before_script:
   - if test "$GDAL_VERSION" = "11"; then sudo apt-get install libgdal1h 
libgdal-dev; fi
   - if test "$GDAL_VERSION" = "20"; then wget 
http://download.osgeo.org/gdal/2.0.3/gdal-2.0.3.tar.xz; tar xJf 
gdal-2.0.3.tar.xz; cd gdal-2.0.3; ./configure --prefix=/usr --enable-debug 
--without-libtool; make -j4 >/dev/null; sudo make install >/dev/null; cd ..; 
gdalinfo --version; fi
   - if test "$GDAL_VERSION" = "21"; then wget 
http://download.osgeo.org/gdal/2.1.4/gdal-2.1.4.tar.xz; tar xJf 
gdal-2.1.4.tar.xz; cd gdal-2.1.4; ./configure --prefix=/usr --enable-debug 
--without-libtool; make -j4 >/dev/null; sudo make install >/dev/null; cd ..; 
gdalinfo --version; fi
+  - if test "$GDAL_VERSION" = "22"; then wget 
http://download.osgeo.org/gdal/2.2.2/gdal-2.2.2.tar.xz; tar xJf 
gdal-2.2.2.tar.xz; cd gdal-2.2.2; ./configure --prefix=/usr --enable-debug 
--without-libtool; make -j4 >/dev/null; sudo make install >/dev/null; cd ..; 
gdalinfo --version; fi
 
 script:
   - make
diff --git a/README.md b/README.md
index a40e0fd..8be2276 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,4 @@
-Travis:
- [![Build Status](https://secure.travis-ci.org/pramsey/pgsql-ogr-fdw.png)]
- (http://travis-ci.org/pramsey/pgsql-ogr-fdw)
+Travis: [![Build 
Status](https://secure.travis-ci.org/pramsey/pgsql-ogr-fdw.png)](http://travis-ci.org/pramsey/pgsql-ogr-fdw)
 
 # PostgreSQL OGR Foreign Data Wrapper
 
diff --git a/ogr_fdw.c b/ogr_fdw.c
index 78965ac..beb4ea0 100644
--- a/ogr_fdw.c
+++ b/ogr_fdw.c
@@ -1544,11 +1544,17 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot 
*slot, const OgrFdwExecS
                }
                else if ( ogrvariant == OGR_FIELD )
                {
+#if (GDAL_VERSION_MAJOR > 2 || (GDAL_VERSION_MAJOR >= 2 && GDAL_VERSION_MINOR 
>= 2))
+                       int field_not_null = OGR_F_IsFieldSet(feat, ogrfldnum) 
&& ! OGR_F_IsFieldNull(feat, ogrfldnum);
+#else
+                       int field_not_null = OGR_F_IsFieldSet(feat, ogrfldnum);
+#endif
+
                        /* Ensure that the OGR data type fits the destination 
Pg column */
                        ogrCanConvertToPg(ogrfldtype, pgtype, pgname, 
tbl->tblname);
 
                        /* Only convert non-null fields */
-                       if ( OGR_F_IsFieldSet(feat, ogrfldnum) )
+                       if ( field_not_null )
                        {
                                switch(ogrfldtype)
                                {
@@ -1579,18 +1585,11 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot 
*slot, const OgrFdwExecS
                                                 * Handling numbers directly 
would be faster, but require a lot of extra code.
                                                 * For now, we go via text.
                                                 */
-                                               const char *cstr = 
OGR_F_GetFieldAsString(feat, ogrfldnum);
-                                               size_t cstr_len = strlen(cstr);
-                                               if ( cstr && cstr_len > 0 )
-                                               {
-                                                       char *cstr_decoded = 
pg_any_to_server(cstr, cstr_len, PG_UTF8);
-                                                       nulls[i] = false;
-                                                       values[i] = 
pgDatumFromCString(cstr_decoded, pgtype, pgtypmod, pginputfunc);
-                                               }
-                                               else
-                                               {
-                                                       ogrNullSlot(values, 
nulls, i);
-                                               }
+                                               const char *cstr_in = 
OGR_F_GetFieldAsString(feat, ogrfldnum);
+                                               size_t cstr_len = cstr_in ? 
strlen(cstr_in) : 0;
+                                               char *cstr_decoded = 
pg_any_to_server(cstr_in, cstr_len, PG_UTF8);
+                                               nulls[i] = false;
+                                               values[i] = 
pgDatumFromCString(cstr_decoded, pgtype, pgtypmod, pginputfunc);
                                                break;
                                        }
                                        case OFTDate:
@@ -1621,7 +1620,6 @@ ogrFeatureToSlot(const OGRFeatureH feat, TupleTableSlot 
*slot, const OgrFdwExecS
                                                {
                                                        snprintf(cstr, 256, 
"%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, second);
                                                }
-
                                                nulls[i] = false;
                                                values[i] = 
pgDatumFromCString(cstr, pgtype, pgtypmod, pginputfunc);
                                                break;

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-grass/pgsql-ogr-fdw.git

_______________________________________________
Pkg-grass-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to