TZSQLProcessor

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
emils
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 08.09.2008, 10:33

TZSQLProcessor

Post by emils »

Hi, i have a problem with CREATE PROCEDURE statement:

ZSQLProcessor.Script.Clear;
ZSQLProcessor.Script.Add('CREATE PROCEDURE NPOD_INSERT ( PODIME VARCHAR(50) ) RETURNS ( PODID DOUBLE PRECISION ) AS BEGIN PODID = GEN_ID(GEN_PODID,1); INSERT INTO NPOD (PODID,PODIME) VALUES (:PODID,:PODIME); SUSPEND; END^');
TRY
ZSQLProcessor.Execute;
EXCEPT Raise End;

which component can i use to create procedures, trigers, tables ... at runtime ?

thanks!
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

For stored procedure use ZStoredProc component
ZUpdateSQL works like UpdateSQL

If you want ot insert table/trigger at runtime you can use ZQuery.SQL
emils
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 08.09.2008, 10:33

Post by emils »

thank you for replay :)
but i cant understand how to create stored procedure at runtime yet

statement: CREATE PROCEDURE NPOD_INSERT ( PODIME VARCHAR(50) ) RETURNS ( PODID DOUBLE PRECISION ) AS BEGIN PODID = GEN_ID(GEN_PODID,1); INSERT INTO NPOD (PODID,PODIME) VALUES (:PODID,:PODIME); SUSPEND; END^

on which component can put this statement and NOT receive an error ? i think that with the trigers will be the same...
thanks!
Wild_Pointer
Expert Boarder
Expert Boarder
Posts: 164
Joined: 18.03.2008, 13:03
Contact:

Post by Wild_Pointer »

emils,

please try something like that:

Code: Select all

  ZConnection1.Connect;
  ZConnection1.ExecuteDirect('CREATE DATABASE jt_test;') ;
  ZConnection1.Disconnect;
It works with postgresql, so I guess it will work for firebird too.
emils
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 08.09.2008, 10:33

Post by emils »

great! thank you Wild_Pointer :)
Post Reply