HI
What is the proper way to check if sql query has 'Empty set'?
I think I have missed something from FPC's changelog as I have started to receive "Field 'xxxx' not found" errors from program that used to work before.
dmData.CQ.SQL.Text :=
'select count(callsign) as rate from cqrlog_main where timestampdiff(minute,concat(qsodate," ",time_off),utc_timestamp())<60';
dmData.CQ.Open();
- if (dmData.CQ.FieldCount > 0) then
+ if (dmData.CQ.Fields.FindField('rate')<> nil) then
lblRate60.Caption:=dmData.CQ.FieldByName('rate').AsString+'/60';]
dmData.CQ.Close;
Originally I did not have check at all before used "FieldByName(xxxxx).AsYyyyy",it worked.
After problems appeared I added "check .FieldCount > 0" (here seen as diff's "-" line) but it seems to fail randomly.
Then I changed to "Fields.FindField" (here seen as diff's "+" line) but I am not sure if this works either.
What bothers me is that similar queries are in many places and it seems that some of them randomly fail "field not found" error even it is now always checked before use.
Fedora release 40 (Forty)
Free Pascal Compiler version 3.2.2 [2024/07/28] for x86_64
mysql Ver 15.1 Distrib 10.11.10-MariaDB, for Linux (x86_64) using EditLine wrapper