[GRASS-SVN] r33868 -
grass/branches/releasebranch_6_3/vector/v.out.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Oct 14 06:12:37 EDT 2008
Author: neteler
Date: 2008-10-14 06:12:37 -0400 (Tue, 14 Oct 2008)
New Revision: 33868
Modified:
grass/branches/releasebranch_6_3/vector/v.out.ogr/main.c
Log:
Roger Bivand, Frank Warmerdam, Dylan Beaudette: prevent writing NULL values (trac #333)
Modified: grass/branches/releasebranch_6_3/vector/v.out.ogr/main.c
===================================================================
--- grass/branches/releasebranch_6_3/vector/v.out.ogr/main.c 2008-10-14 10:12:03 UTC (rev 33867)
+++ grass/branches/releasebranch_6_3/vector/v.out.ogr/main.c 2008-10-14 10:12:37 UTC (rev 33868)
@@ -686,25 +686,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;
+
+ /* fix to 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