[GRASS-SVN] r34049 - grass/branches/develbranch_6/vector/v.out.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Oct 29 05:57:10 EDT 2008
Author: neteler
Date: 2008-10-29 05:57:10 -0400 (Wed, 29 Oct 2008)
New Revision: 34049
Modified:
grass/branches/develbranch_6/vector/v.out.ogr/main.c
Log:
Roger Bivand, Frank Warmerdam, Dylan Beaudette: prevent writing NULL values (trac #327) (merge from trunk, r33866)
Modified: grass/branches/develbranch_6/vector/v.out.ogr/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.out.ogr/main.c 2008-10-29 09:54:53 UTC (rev 34048)
+++ grass/branches/develbranch_6/vector/v.out.ogr/main.c 2008-10-29 09:57:10 UTC (rev 34049)
@@ -717,25 +717,29 @@
colsqltype = db_get_column_sqltype(Column);
colctype = db_sqltype_to_Ctype(colsqltype);
G_debug(2, " colctype = %d", colctype);
- switch (colctype) {
- case DB_C_TYPE_INT:
- OGR_F_SetFieldInteger(Ogr_feature, j,
- db_get_value_int(Value));
- break;
- case DB_C_TYPE_DOUBLE:
- OGR_F_SetFieldDouble(Ogr_feature, j,
- db_get_value_double(Value));
- break;
- case DB_C_TYPE_STRING:
- OGR_F_SetFieldString(Ogr_feature, j,
- db_get_value_string(Value));
- break;
- case DB_C_TYPE_DATETIME:
- db_convert_column_value_to_string(Column,
- &dbstring);
- OGR_F_SetFieldString(Ogr_feature, j,
- db_get_string(&dbstring));
- break;
+
+ /* prevent writing NULL values */
+ if (!db_test_value_isnull(Value)) {
+ switch (colctype) {
+ case DB_C_TYPE_INT:
+ OGR_F_SetFieldInteger(Ogr_feature, j,
+ db_get_value_int(Value));
+ break;
+ case DB_C_TYPE_DOUBLE:
+ OGR_F_SetFieldDouble(Ogr_feature, j,
+ db_get_value_double(Value));
+ break;
+ case DB_C_TYPE_STRING:
+ OGR_F_SetFieldString(Ogr_feature, j,
+ db_get_value_string(Value));
+ break;
+ case DB_C_TYPE_DATETIME:
+ db_convert_column_value_to_string(Column,
+ &dbstring);
+ OGR_F_SetFieldString(Ogr_feature, j,
+ db_get_string(&dbstring));
+ break;
+ }
}
}
}
More information about the grass-commit
mailing list