Page 1 of 1

Firebird : Stored proc on insert/update

Posted: 17.04.2011, 18:07
by Darkbow
Hi,

using scenario Lazarus 0.9.31-29128 + FPC-2.4.2-20110120 + Firebird Embedded 2.1 in a Win32 environment I have following scenario:
  • TZQuery which retrieves a select that is a join of three tables.
  • I have an editable DBGrid tied to this TZQuery through a TDataSource.
  • Whenever the user inserts or updates a register, I need to call a stored procedure to perform some comprobations and do the appropiate operation at database level.
  • Using plain SQL commands in a TZUpdateSQL is not possible because I need to check for some conditions.
At work I use the ODAC components (for Oracle) which have an InsertSQL and an UpdateSQL property (similar to the TZUpdateSQL ones). To call a stored procedure I just put following into those properties:

Code: Select all

Begin
  MyStoredProc(:param1, ...);
End;
I would like to do something similar with Zeos + Firebird. Is it possible to do this with a TZUpdateSQL (tried but no luck so far)? Or will I need to program the AfterPost event of my TZQuery to call the procedure through a TZStoredProc?

Thanks in advance for any input and best regards. :)