Recent

Author Topic: IBSQL - CheckClosed  (Read 696 times)

sydenis

  • New Member
  • *
  • Posts: 39
IBSQL - CheckClosed
« on: February 09, 2025, 05:41:42 pm »
Lazarus 3.8 IBX 2.7.2.1650

Why do we need the CheckClosed check at the beginning of TIBSQL.ExecQuery?
It doesn't seem to have been there before...
I have a procedure for inserting records into a table that returns the id of the new record.

I run through the grid lines and call the procedure:

Code: Pascal  [Select][+][-]
  1. IBSQL1.SQL.Text:='select id from from ins_proc(:fld1)';
  2. IBSQL1.Prepare;
  3.  
  4. with grid do
  5. for r := 1 to RowCount - 1 do
  6. begin
  7.   IBSQL1.Params[0].AsString:=Cells[1, r];  
  8.   IBSQL1.ExecQuery;
  9.   newId := IBSQL1.Fields[0].AsInteger;  //optional  
  10.   ....
  11. end;

It worked in the old project. But now on the second iteration it says that: IBSQL Open
CheckClosed checks whether the previous ExecQuery has a result.
In my case, it's always there.
I had to comment out the check. Is this the right thing?

Zoran

  • Hero Member
  • *****
  • Posts: 1911
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: IBSQL - CheckClosed
« Reply #1 on: February 09, 2025, 10:36:43 pm »
As IBX is now in github repository, perhaps it's better to report there, as Tony (the IBX author) might miss this post.
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

Zvoni

  • Hero Member
  • *****
  • Posts: 2921
Re: IBSQL - CheckClosed
« Reply #2 on: February 10, 2025, 08:10:43 am »
Since when do you use "ExecQuery" on a SELECT?!?!?!
And isn't that method called "ExecSQL"?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

sydenis

  • New Member
  • *
  • Posts: 39
Re: IBSQL - CheckClosed
« Reply #3 on: February 10, 2025, 08:40:40 am »
Since when do you use "ExecQuery" on a SELECT?!?!?!
And isn't that method called "ExecSQL"?
No. See paragraph 5.4.2.2 in IBX4LazarusGuide.pdf

tonyw

  • Sr. Member
  • ****
  • Posts: 332
    • MWA Software
Re: IBSQL - CheckClosed
« Reply #4 on: February 15, 2025, 05:25:32 pm »
Please go to https://github.com/MWASoftware/ibx4lazarus/issues/2 to read my response.

 

TinyPortal © 2005-2018