Subject RE: [firebird-support] Creating a stored procedure in a Delphi application
Author Clay Shannon
Luis,

I use FIB+ components with Delphi:

http://www.devrace.com/en/fibplus/index.php

IBeXpress is good for Delphi and IB, but "going forward," as the expression
goes, IB and FB are diverging like the proverbial path in the woods. The one
you take may make "all the difference" (apologies to Frost) as to which
components you should use.

Personally, I create the stored procedures using Database Workbench:

http://www.upscene.com/

(DB WB is an awesome product that makes creating StoredProcs and everything
else practically "child's play.")

and then use the TpFIBStoredProc component like this:

var
sp: TpFIBStoredProc;
trans: TpFIBTransaction;
begin
sp := TpFIBStoredProc.Create(nil);
try
trans := TpFIBTransaction.Create(nil);
try
sp.Database := dm.FIBDB;
sp.Transaction := trans;
trans.DefaultDatabase := dm.FIBDB;
trans.Active := True;
sp.StoredProcName := 'P_UPDATE_PHYSICIAN';
sp.ParamByName('FIRSTNAME').AsString := AFirstName;
sp.ParamByName('LASTNAME').AsString := ALastName;
sp.ParamByName('ADDRESS1').AsString := AAddress1;
sp.ParamByName('ADDRESS2').AsString := AAddress2;
sp.ParamByName('CITY').AsString := ACity;
sp.ParamByName('STATE').AsString := AState;
sp.ParamByName('ZIP').AsString := AZip;
sp.ParamByName('PHONE1').AsString := APhone1;
sp.ParamByName('PHONE2').AsString := APhone2;
sp.ParamByName('PHYSICIAN_ID').AsInteger := APhysID;
try
sp.ExecProc;
trans.Commit;
except
on e: Exception do begin
InsertExceptionData(Application.ExeName, Application.Title,
e.ClassName, e.Message,
SysErrorMessage(GetLastError), GetLastError,
TPFIBDatabase(sp.Database));
trans.Rollback;
end;
end;
finally
trans.Free;
end;
finally
sp.Free;
end;
end;

<< Las Rozas - Madrid (Spain)>>
Tell Miguel Cervantes "hi" for me the next time you see him.

Clay Shannon,
Dimension 4 Software

-----Original Message-----
From: lmmolinerocasares [mailto:soporte@...]
Sent: Thursday, March 03, 2005 11:29 AM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] Creating a stored procedure in a Delphi
application



In a Delphi application I need to update some of the objects of a
database in the client location, I use the standar IBExpress Delphi
component TIBSQL, I assign the SQL property with the command, call
ExecQuery, and everything is almost fine. I can add new columns to an
existing table, I can create new tables, new foreing keys, new
indexes, etc.
But I can't create a new stored procedure. If I include the SET TERM
statement I got an error message 'TERM token unknown', and of course
if I do not include the statement I got an error -104.

Does anyone know how can I create a new stored procedure in Delphi?
Which component should I use?

Luis Miguel Molinero
Las Rozas - Madrid (Spain)






Yahoo! Groups Links