Lazarus

Programming => Databases => Topic started by: ebizz on July 14, 2020, 01:48:16 pm

Title: (FIXED)after update Lararus 2.0.10 TQuery.FieldByName (UUID-FIELD) messing up
Post by: ebizz on July 14, 2020, 01:48:16 pm
Hi Everyone!

After Update from 2.0.8 to 2.0.10 TQuery Function FieldByName is not working anymore, I get back totally wrong values sometimes. (UUID as String, instead I receive parts of the value from the call before).

Reinstalled 2.0.8 everything is fine again. Does anyone else have this problem? So far only looked into it under Linux. How to report this bug? Is it a free Pascal bug or a lazarus problem?

Title: Re: after update Lararus 2.0.10 TQuery.FieldByName messing up, running under Linux
Post by: JuhaManninen on July 14, 2020, 02:05:26 pm
I don't think it is a Lazarus issue. This is the list of changes between 2.0.8 and 2.0.10 :
 https://wiki.freepascal.org/Lazarus_2.0_fixes_branch#Fixes_for_2.0.10_.28merged.29
No DB component related changes.
So the problem may be in FPC 3.2.
It is also possible the update failed. Did you remove all remains of FPC 3.0.4? Try uninstalling everything (Lazarus + FPC) and then installing again.
Title: Re: after update Lararus 2.0.10 TQuery.FieldByName messing up, running under Linux
Post by: TRon on July 14, 2020, 02:29:48 pm
According to this thread (https://forum.lazarus.freepascal.org/index.php/topic,50517.0.html) some things did change with FreePascal 3.2, although it is also reported that this was not mentioned anywhere (of course the svn log would show it).

Have you tried recreating your database, if only for testing if this occurs only between different versions of Free Pascal ?

Title: Re: after update Lararus 2.0.10 TQuery.FieldByName messing up, running under Linux
Post by: ebizz on July 14, 2020, 02:57:44 pm
I setup a clean/empty XUbuntu without any old 3.0.4 and just installed Lazarus 2.0.10, same problem. It seems to be only UUID related, all other fields are handled well. Using TQuery.Fields[0].AsString results in the same mess, by the way.


PS: man, who invented the second verification stuff....
Title: Re: after update Lararus 2.0.10 TQuery.FieldByName messing up, running under Linux
Post by: TRon on July 14, 2020, 04:44:58 pm
@ebizz:
How do you store those guids in your table ?

A simple test with FreePascal generating some GUID's, converting them to string, then storing and retrieving them from a SQLite table seem to work as intended for me (Debian Linux 32-bit)
Title: Re: after update Lararus 2.0.10 TQuery.FieldByName messing up, running under Linux
Post by: ebizz on July 14, 2020, 05:36:45 pm
Postgres Default UUID Field:

fieldnametest UUID DEFAULT uuid_generate_v4() NOT NULL PRIMARY KEY

Just ported a little of the code to a console app under lazarus, same error on windows32 and linux, newly installed machine. All other None-UUID fields are handled correctly.
giving up for today....

Title: Re: after update Lararus 2.0.10 TQuery.FieldByName messing up, running under Linux
Post by: ebizz on July 14, 2020, 07:16:19 pm
The problem is the UUID, casting the SQL Field to for example varchar everything works fine. As soon it is supposed to be a UUID it goes nirvana.

Working:

   SQLString := 'SELECT contact_uuid::varchar FROM contact;';

Not working:
   
   SQLString := 'SELECT contact_uuid::uuid FROM contact;';


.....
   SQLQuery.SQL.Text := SQLString;
   SQLQuery.Open();
 
   while not SQLQuery.EOF do
   begin
     Writeln(IntToStr(i) + ' - ' + SQLQuery.Fields[0].AsString);   
   ......

Same on linux as on windows. Someone from the fpc-database team must have messed up the UUID support for postgresql. Anyone know where to report this bug?
Title: Re: after update Lararus 2.0.10 TQuery.FieldByName messing up, running under Linux
Post by: TRon on July 14, 2020, 08:03:17 pm
Anyone know where to report this bug?
Bugs can be reported in the bugtracker http://bugs.freepascal.org/set_project.php?project_id=6

Because you were able to reproduce in a simple console program and afaik, it should be filed under FPC.
Title: Re: after update Lararus 2.0.10 TQuery.FieldByName (UUID-FIELD) messing up
Post by: ebizz on July 15, 2020, 02:41:33 pm
It was a FPC Bug, got to put it into the bugtracker yesterday and today it was already fixed... The fix is pushed as of FPC Revision 45791 (3.2.x) from today :-)
Thanks everyone giving help and comments.

 8-)
TinyPortal © 2005-2018