Invalid type cast in file ZDatasetUtils

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
renabor
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 25.08.2020, 17:01

Invalid type cast in file ZDatasetUtils

Post by renabor »

Hi all,

After the last update of zeos (svn rev 6794), my project crashes with message "Invalid type cast"

in line 1734, file ZDatasetUtils

ConSettings := TZAbstractRODataset(THackParam(Param).DataSet).Connection.DbcConnection.GetConSettings;


the code that trigger the error is:

ZROQueryCodiciInterventi.ParamByName('FILTRO').AsString := s;

where s is a String
latest running version of zeos was 6758

thanks in advance for any advice,
renabor

FPC 3.2.1, Lazarus 2.0.10, Linux
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: Invalid type cast in file ZDatasetUtils

Post by marsupilami »

Hello renabor,

thank you for the bug report. I created a bug report on Source Forge for this problem: https://sourceforge.net/p/zeoslib/tickets/440/

Currently I can only suggest to go back to the latest working version. A fix can take some weekes because nearly everybody is on holidays right now. You might want to subscribe to the sourceforge bug report.

Best regards,

Jan
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: Invalid type cast in file ZDatasetUtils

Post by EgonHugeist »

Hello renabor,

that's weird, i can't see something wrong. So i added an assertiation See: https://sourceforge.net/p/zeoslib/code-0/6809/.
If the assertiation is triggered, than the DataSet of the Parameter is not an Descendant of the Zeos-TZAbstractRODataset.

So plz update. Is the assertiation triggered? What's the FieldType of the Parameter?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
renabor
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 25.08.2020, 17:01

Re: Invalid type cast in file ZDatasetUtils

Post by renabor »

Hello EgonHugeist,
the parameter is defined simply as:

sql:='select distinct codice_novo from oc_cup where codice_novo like (:FILTRO) order by codice_novo';
ZROQueryCodiciInterventi.SQL.Text:=SQL;

I've tried to compile the program with target Windows and it run fine!
Same code compiled with target Linux triggered the error.

Linux is case sensitive so I suppose the problem is related to the name of a unit, which mix of upper-lower case does not match corresponding name in the uses clause, or something similar

Best regards,
renabor
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: Invalid type cast in file ZDatasetUtils

Post by marsupilami »

Hello renabor,
renabor wrote: 11.09.2020, 07:25 I've tried to compile the program with target Windows and it run fine!
Same code compiled with target Linux triggered the error.

Linux is case sensitive so I suppose the problem is related to the name of a unit, which mix of upper-lower case does not match corresponding name in the uses clause, or something similar
Do you get this error during compile time or when you run the program? I wonder about this because we currently compile Zeos on Linux (FPC 3.0.4 / Lazarus 2.0.0 x86_64) on a regular basis as part of our automated tests. And we don't get errors during the compilation.

Also - usually the error message you posted happens at runtime. This is why we need a small sample program that can reproduce the error. Otherwise it will be hard to track down the problem. So:
- Please create a small sample program that reproduces the error.
- Please supply a create scrip that creates the necessary tables and inserts data that is needed for the program to run.
- Please tell us which database you use including version numbers for the client and the server.

Best regards,

Jan
renabor
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 25.08.2020, 17:01

Re: Invalid type cast in file ZDatasetUtils

Post by renabor »

Hello marsupilami,
yes, problem occurs at runtime.
As you asked, I created a small program with all the code involved but I can't reproduce the error. The test program run as expected, so I think that somewhere in my code there is something bad.
Perhaps a lack of a parameter, or a parameter that is not needed, I don't know.
For now I've resolved switching back using filter instead of parameter,
thankyou anyway for all,
Best regards
renabor
Post Reply