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)

2123-2141-cumulative.patch (8.6 KB ) - added by unicoletti 17 years ago.
Cumulative patch for 2123 and 2141

Download all attachments as: .zip

Change History (8)

comment:1 by unicoletti, 17 years ago

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.

comment:2 by sdlime, 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

in reply to:  2 comment:3 by unicoletti, 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.

comment:4 by sdlime, 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

in reply to:  4 comment:5 by unicoletti, 17 years ago

Replying to sdlime:

Might check with the SDE and Oracle Spatial leads too. I agree, would be a nice addition... Would you do the impementation?

For DBF, yes. I will send a cumulative patch for this and #2123.

by unicoletti, 17 years ago

Attachment: 2123-2141-cumulative.patch added

Cumulative patch for 2123 and 2141

comment:6 by unicoletti, 17 years ago

The patch works for me. I'll delay the commit until the segfault caused by msAddLabel is fixed.

comment:7 by unicoletti, 17 years ago

Resolution: fixed
Status: newclosed

Fixed in revision 6277.

Note: See TracTickets for help on using tickets.