PB V6 Beta08 mysql bug on Ubuntu 20.04

Linux specific forum
berry
New User
New User
Posts: 4
Joined: Fri Apr 24, 2020 12:06 pm

PB V6 Beta08 mysql bug on Ubuntu 20.04

Post by berry »

GetDatabaseFloat()
(or Double) does not retrieve the post decimals in Ubuntu20.04,
works fine in OSX and on RASPI with same code and same remote Mariadb,
but not in the Ubuntu 64b Version,
it only retrieves until decimal point.
Tested on different Ubuntu 20.04 PCs and both backends.
PB V6 Beta08
berry
New User
New User
Posts: 4
Joined: Fri Apr 24, 2020 12:06 pm

Re: PB V6 Beta08 mysql bug on Ubuntu 20.04

Post by berry »

Just tested:

GetDatabaseFloat() does not work also for PB5.72 on X64_Ubuntu 20.04...
PB code is simply

SQLR=DatabaseQuery(0,"SELECT TEMP FROM DATASTAUB",#PB_Database_StaticCursor)
NextDatabaseRow(0)
SV(FRIN)\TEMP=GetDatabaseFloat(0, 0)

Gives a Value of 26.00

asking via mysql gives the correct 26.85

On the RASPI with U20.04 it works fine with PB.
infratec
Always Here
Always Here
Posts: 6866
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: PB V6 Beta08 mysql bug on Ubuntu 20.04

Post by infratec »

What does GetDatabaseString() return for this field?
berry
New User
New User
Posts: 4
Joined: Fri Apr 24, 2020 12:06 pm

Re: PB V6 Beta08 mysql bug on Ubuntu 20.04

Post by berry »

Thanks infratec,

GetDatabaseString() returns the complete String /Number...as string
(correct with . as decimal seperator).
GetDatabaseColumnType() also returns correct value(3).

But now I know the origin:

-if locale is set to use "," as decimal seperator PB, floats are not retrieved.
-if locale is set to use "." as decimal seperator PB, floats are retrieved correctly.

In MacOS it does not matter on the locale settings.
So the Linux PB GetDatabaseFloat() or the libmariadb.so depends
on the decimal point locale settings...it should not.
sql always takes "." for decimal point. So bad luck for Germans.
infratec
Always Here
Always Here
Posts: 6866
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: PB V6 Beta08 mysql bug on Ubuntu 20.04

Post by infratec »

Then you can use

Code: Select all

ValD(GetDabaseString())
as a tempory solution.
berry
New User
New User
Posts: 4
Joined: Fri Apr 24, 2020 12:06 pm

Re: PB V6 Beta08 mysql bug on Ubuntu 20.04

Post by berry »

I switched all my linux PCs to C.UTF8 , that avoids problems like this (also in python)
Post Reply