[fdo-users] FDO SHP + dotNet help : managing the decimal separator

Dan Stoica dan.stoica at autodesk.com
Thu Nov 15 13:24:45 EST 2007


I'll send you a ShapeDBF.cpp file containing an easy change and I'll let you testing.
Your primary problem is on Select, right?

Note: I think your solution to set the locale on the connection has a flaw, that is we may end up with DBF containing both styles of decimal formats.

-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of ytse
Sent: Thursday, November 15, 2007 1:11 PM
To: fdo-users at lists.osgeo.org
Subject: RE: [fdo-users] FDO SHP + dotNet help : managing the decimal separator



Dan Stoica wrote:
>
> Hmm, managed code calling unmanaged code... it might explain.
>
> In any case, here is what I suggest to do instead of setting the locale on
> the connection.
>
> In idea is that the provider should be able to figure out the
> correct/consistent string format for decimals. That is, given the LDID
> (see EsriCodePageMapper[] in ShapeDBF.h) you  can tell if the '.' or ','
> should be used. This would make the provider locale independent.
>
> Therefore:
> - on insert/update:  check the sprintf() return value. In case the
> delimiter is different from the correct one, do a substitution before
> writing to file.
> - on select: check atof() output. In case it's 0.0 and the input is not
> "0..." then we know we have a locale mismatch and perform a substitution
> '.' <-> ',' before trying atof() again.
>
> I believe this would work with no side effects.
>
> What do you think?
>
> Dan.
>
Well, I don't know if that would be the most efficient way of resolving the
issue (checking each decimal value vs forcing the locale once) but that
sounds more appropriate.
I actually don't know how to debug the FDO sources, I've just read the
sources up to this point (I don't know much about C++ => I'm able to read
the source and add a couple instructions here and there and recompile
everything but that's it, so I won't try your solution by myself)

If you (or someone else) could continue to help me this way I would really
appreciate it.

Thanks for your support anyway.
--
View this message in context: http://www.nabble.com/FDO-SHP-%2B-dotNet-help-%3A-managing-the-decimal-separator-tf4766129s18162.html#a13778124
Sent from the fdo-users mailing list archive at Nabble.com.

_______________________________________________
fdo-users mailing list
fdo-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-users


More information about the fdo-users mailing list