Hi, libdbi uses standard sprintf or asprintf and it is defenatelly not something simple to fix.
As standard C library does not provide any "reasonable" tool to format and parse double without connection with current locale (atof would fail to parse "1.3" in "de_DE.UTF-8") I think you would have to use C locale at least when you call libdbi (if your program is single threaded it would be ok to swich locale in run time). setlocale(LC_ALL,"C"); do queries setlocale(LC_ALL,""); If you program in C++ it would be simpler as it has things to do this correctly. Note: I'm not libdbi developer. Artyom ----- Original Message ---- > From: Christoph Holtermann <c.holterm...@gmx.de> > To: libdbi-devel@lists.sourceforge.net > Sent: Thu, January 27, 2011 3:17:12 PM > Subject: Re: [libdbi-devel] locale > > Hello ! > > Further information can be found at: > > http://www.mail-archive.com/gnucash-devel@gnucash.org/msg28150.html > and > https://bugzilla.gnome.org/show_bug.cgi?id=611936 > > regards, > > Christoph Holtermann > > Am 27.01.2011 14:10, schrieb Christoph Holtermann: > > Hello ! > > > > I'm using GnuCash with a MySql backend using libdbi. There are some > > strange errors with some versions of libdbi for which a workaround has > > been >built > > which says one should change the version of libdbi. This error message has >just > > been included and it stops me from using my financial data. Because of that > > i tried to find the error. At the moment it seems to me that it is linked to > > dbi_conn_queryf. > > The test in Gnucash calls it with > > result = dbi_conn_queryf( conn, > > "INSERT INTO numtest VALUES (%lld, %llu, >%17e)", > > testlonglong, testulonglong, testdouble ); > > where > > gint64 testlonglong = -9223372036854775807LL, resultlonglong = 0; > > guint64 testulonglong = 9223372036854775807LLU, resultulonglong = 0; > > gdouble testdouble = 1.7976921348623157E+307, resultdouble = 0.0; > > > > This fails at my system. The logfile of MySql states > > > > 110127 13:40:28 21 Connect christoph@localhost on gnucash > > 21 Query CREATE TEMPORARY TABLE numtest ( test_int >BIGINT, test_unsigned BIGINT, test_double FLOAT8 ) > > 21 Query INSERT INTO numtest VALUES >(-9223372036854775807, 9223372036854775807, 1,797692e+307) > > > > The last row is wrong because it is 1,797692e+307 instead of > > 1.797692e+307. >The separator is wrong. I guess this is because > > the locale for germany where i live puts it that way. > > > > I don't know if this is a feature or a bug. But i guess it would make life >simpler if printf in that function wouldn't be so locale specific ;-) > > > > I'm not a C programmer and I'm not sure if the solution should be a change >of libdbi or GnuCash. > > > > regards, > > > > Christoph Holtermann > > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > libdbi-devel mailing list > libdbi-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libdbi-devel > ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ libdbi-devel mailing list libdbi-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libdbi-devel