Page 1 of 1

TZSQLProcessor

Posted: 17.03.2010, 12:38
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!

Posted: 17.03.2010, 14:14
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

Posted: 17.03.2010, 14:21
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!

Posted: 17.03.2010, 14:44
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.

Posted: 17.03.2010, 14:55
by emils
great! thank you Wild_Pointer :)