Recent

Author Topic: Only one first row is returned (Lazarus + Firebird + Oracle)  (Read 1022 times)

krzynio

  • Jr. Member
  • **
  • Posts: 69
Only one first row is returned (Lazarus + Firebird + Oracle)
« on: December 20, 2018, 11:39:42 pm »
Hello!
I have been working with Lazarus trunk 2.1 on Debian testing and on Windows 10
plus Zeoslib 7.2.1-rc1 and Firebird 3.0 and Oracle
Recently I updated to Zeoslib 7.2.4-stable.
After this some queries on Lazarus return only one first row.
I went back to 7.2.3-rc and the same, only first row is returned.
The same query on Zeoslib 7.2.1-rc1 or under Flamerobin returns all rows.
Where can be the problem? Is it a bug?
Any suggestions, please?
Lazarus version: trunk. FPC version: 3.0.4. OS: Linux Debian Testing x64 with XFCE 4.12 and Windows 10 x64 version: 1709

madref

  • Hero Member
  • *****
  • Posts: 565
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Only one first row is returned (Lazarus + Firebird + Oracle)
« Reply #1 on: December 24, 2018, 12:02:22 pm »
Do you have Booleans stored as 0 and -1?
If so then look if the new one stores them as 1.


I had that problem once
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.0 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

Thaddy

  • Hero Member
  • *****
  • Posts: 7610
Re: Only one first row is returned (Lazarus + Firebird + Oracle)
« Reply #2 on: December 24, 2018, 12:48:41 pm »
Indeed, but this Boolean issue should be fixed in trunk.
« Last Edit: December 24, 2018, 01:02:18 pm by Thaddy »
Ad Brexinitum (can't help it)

Zoran

  • Hero Member
  • *****
  • Posts: 1328
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Only one first row is returned (Lazarus + Firebird + Oracle)
« Reply #3 on: December 24, 2018, 07:09:29 pm »
I experienced this with some query couple of days ago, and worked around it by redisigning the query.
I don't think I can reproduce the original query, but I am quite sure I didn't have any boolean fields at all.

I think it is a Zeos bug. Please report it in their bugtracker or in their forum.
I don't have time now, but if noone reports it, I will see tomorrow if I can make an example and report it there.

madref

  • Hero Member
  • *****
  • Posts: 565
  • ..... A day not Laughed is a day not Lived !!
    • Nursing With Humour
Re: Only one first row is returned (Lazarus + Firebird + Oracle)
« Reply #4 on: December 27, 2018, 01:26:23 pm »
Then use in ALL your queries where you use boolean the function ABS.


You get something like
Code: [Select]
SELECT * FROM Some_Table WHERE ABS(MyBoolen) = 1
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 2.0.0 / FPC 3.0.4
Lazarus Trunc / FPC 3.0.4
Mac OS X Mojave

Thaddy

  • Hero Member
  • *****
  • Posts: 7610
Re: Only one first row is returned (Lazarus + Firebird + Oracle)
« Reply #5 on: December 27, 2018, 03:34:43 pm »
The bug is that a C Bool is not false which is defined as any value except false ( = 0 ) and a Pascal Boolean (all types) were defined as either  0 or 1. This has been corrected. There is now a correct Bool type to interface with C code in trunk. This was an FPC bug ( for a relatively short - some months, a year - period only) and not a Zeos bug. Maybe Zeos needs to switch to the new Bool type, though.
A SQL query with not false instead of true should always work, though. But  FPC booleans (pascal booleans) are not suited for interfacing with C code as most database engines are written in C. The Bool type now adheres to that, as was also previously the case. It was a rather serious regression that made me at some point very angry. (Actually real anger, not grumpy, I seldom have such strong negative vibes... :o to paraphrase my fellow tank commander from Kelly's heroes. (odd ball))
« Last Edit: December 27, 2018, 04:26:28 pm by Thaddy »
Ad Brexinitum (can't help it)