|
Found a strange behavior with float values.
import mariadb
|
import locale
|
|
conn = {'host': '192.168.1.2', 'user': 'test', 'password': 'test'}
|
|
db = mariadb.connect(**conn)
|
qr = db.cursor()
|
|
latitude = -24.971077771106
|
longitude = -53.95170397719726
|
|
qr.execute('set @lat=?, @lng=?', (latitude, longitude))
|
|
qr.execute('select @lat, @lng')
|
lat, lng = qr.fetchone()
|
print(lat, lng)
|
# Here, returns what's expected: -24.971077771106 -53.95170397719726
|
|
locale.setlocale(locale.LC_ALL, 'pt_BR.utf8')
|
|
qr.execute('select @lat, @lng')
|
lat2, lng2 = qr.fetchone()
|
print(lat2, lng2)
|
# But here, returns: -24.0 -53.0
|
|