[Mapserver-users] DBF Leading Spaces

Daniel Morissette morissette at dmsolutions.ca
Tue Apr 29 13:38:21 EDT 2003


Steve Lime wrote:
> 
> Hi Shannon. It's intentional, although it was implemented long ago
> primarily to
> trim trailing spaces rather than leading spaces. I think removing
> leading spaces
> could safely be disabled. The code is in mapdbf.c if you'd care to hack
> at it
> yourself. I will make the change to the development version.
> 


This change caused side-effects for classes that used constant
expressions on numeric fields (e.g. EXPRESSION "1" on numeric fields
doesn't work any more).  When numeric values are stored to DBF, they
contain at least one and sometimes two leading spaces.  So classes that 
used something like EXPRESSION "1" would not work any more and would
have to be changed to EXPRESSION /1/ or something similar which is
slower.

To solve this, I have modified mapxbase.c (in CVS) to re-enable trimming
leading spaces for numeric field types only (DBF types N, F and D).  In
the case of character fields (strings) and other types, the leading
spaces are left untouched.

Daniel
-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------



More information about the mapserver-users mailing list