Ticket #2141 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

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

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

Change History

  Changed 6 years ago by unicoletti

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.

follow-up: ↓ 3   Changed 6 years ago by 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

in reply to: ↑ 2   Changed 6 years ago by unicoletti

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   Changed 6 years ago by sdlime

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   Changed 6 years ago by unicoletti

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.

Changed 6 years ago by unicoletti

Cumulative patch for 2123 and 2141

  Changed 6 years ago by unicoletti

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

  Changed 6 years ago by unicoletti

  • status changed from new to closed
  • resolution set to fixed

Fixed in revision 6277.

Note: See TracTickets for help on using tickets.