Opened 17 years ago
Closed 17 years ago
#2141 closed defect (fixed)
Handling of DBF NULL values
Reported by: | unicoletti | Owned by: | sdlime |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Shapefile Utilities | Version: | |
Severity: | normal | Keywords: | |
Cc: |
Description
The dbf code in mapserver does not handle correctly null numeric values (and possibly other types too, though I haven't checked) and returns which is the internal dbf representation for a null value. This has undesired side effects on filters and leads to parse errors which are translated in exceptions in java mapscript eventually blocking the generation of the map.
As an example implementation see the DBFIsAttributeNULL() in shapelib/dbfopen.c
Attachments (1)
Change History (8)
comment:1 by , 17 years ago
follow-up: 3 comment:2 by , 17 years ago
What do other data sources do with NULLs? I don't think shapefiles are alone with this. Would be nice to be consistent across all providers.
Steve
comment:3 by , 17 years ago
Replying to sdlime:
What do other data sources do with NULLs? I don't think shapefiles are alone with this. Would be nice to be consistent across all providers.
Steve
Postgis seems to return an empty string (as that's the default behaviour of PQgetvalue) in all cases (numbers, strings, etc). Have not cheked other providers. As a quick fix we could convert null strings in empty strings and null numbers in 0. This would leave the parser untouched and expression evaluation will always work. This one and #2123 would be a nice addition to 5.0.
follow-up: 5 comment:4 by , 17 years ago
Might check with the SDE and Oracle Spatial leads too. I agree, would be a nice addition... Would you do the impementation?
Steve
comment:5 by , 17 years ago
comment:6 by , 17 years ago
The patch works for me. I'll delay the commit until the segfault caused by msAddLabel is fixed.
I suggest the following change and volunteer to help:
modify msDBFGetValueList so that it returns the "NULL" string for null values, then modify the lexer to handle the special NULL string. NULL would be a new keyword.