Subject | Re: [IBO] Using DDL in ib objects |
---|---|
Author | peter@cyionics.com |
Post date | 2003-11-12T20:00:52Z |
Hi all
I sorted it using a TIB_Script component.
Rgds
Peter
I sorted it using a TIB_Script component.
Rgds
Peter
----- Original Message -----
From: peter@...
To: IBObjects@yahoogroups.com
Sent: Wednesday, November 12, 2003 6:09 PM
Subject: [IBO] Using DDL in ib objects
Hi all
I am writing an application that will update the structure for mone release to the next.
I plan to include a file with the upgrade info in, the application will check the release of the database it is about to upgrade by looking in a release table, if all is ok it will run the DDL/SQL to modify the tables / procedures etc.
My problem is I am not sure of the syntax
I have been trying to create a dummy procedure as a test, I extracted the DDL using workbench.
I have tried both an IB_DSQL and an IB_Query but I am obviously doing something major wrong.
Could somebody point me in the right direction.
After this I want to modify existing stored procedures and tables.
Rgds
Peter
My delphi code using an IB_Query is
with IB_Query1 do
begin
sql.LoadFromFile('sql\update2-3.sql');
If not prepared then Prepare;
ExecSQL;
close;
end;
or using an IB_DSQL
with IB_DSQL1 do
begin
sql.LoadFromFile('sql\update2-3.sql');
If not prepared then Prepare;
ExecSQL;
close;
end;
The DDL for the stored procedure is (saved in file update203.sql)
SET TERM ^^;
CREATE PROCEDURE P_DUMMY_SELL_PIN (
INDEX_ID Integer)
returns (
RETURN_VAL Integer)
AS
/*
Procedure:
Author : PJC
Date : 14/08/2003
Purpose : alter status of pin to sold
Params
------
<param> : INDEX_ID unique key-id to pin
*/
begin
/* code */
RETURN_VAL = 0;
IF (EXISTS ( SELECT ID FROM PINS WHERE ID = :INDEX_ID and STATUS = 1 )) THEN
BEGIN
UPDATE PINS SET
STATUS = 4,
STATUS_CHANGED = 'NOW'
WHERE ID = :INDEX_ID;
RETURN_VAL = :INDEX_ID;
END
end
^^
SET TERM; ^^
[Non-text portions of this message have been removed]
Yahoo! Groups Sponsor
ADVERTISEMENT
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]