Re: [gnome-db] MySQL and floats

Vivien Malerba <[email protected]>
Newsgroups gmane.comp.gnome.db
Message-ID <[email protected]>
On 5 May 2010 12:55, Piotr Pokora <[email protected]> wrote:
> Stian Skjelstad pisze:
>
>>> I checked new_row_from_mysql_stmt and for G_TYPE_FLOAT and G_TYPE_DOUBLE
>>> case, mysql_bind_result[i].buffer is always 0,0000.
>>>
>>> column is: `created` float NOT NULL DEFAULT '0',
>>>
>>> Do I miss anything while getting data?
>> Just trowing in a quick-question just to check one thing. Is your local
>> language set to a language which uses "," as decimal mark?
>
> I am not sure if this is the case.
> GDA sets locale to be always C for floating types.
> So floats are stored with dot as decimal in MySQL table.
> Which is correct.
>
> On data fetching there's locale change too, but point is, MySQL buffer
> holds invalid (seems so) data. I used to use MySQL C API, and never had
> such problem. Though, I have never used prepared statements.
>
> I wonder if gda_mysql_provider_statement_execute prepare statement
> correctly. Neither float nor double is taken into account in this routine.

I've found the problem: I thought float and double could be handled
with the same code, which was wrong. I've committed a correction for
that in git/master. It seems to work correctly now for both FLOAT and
DOUBLE types.

Please let me know if you have any more problem.

Vivien
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.