|
FORUM MESSAGE
|
|
You are reading a General forum message.
Stored Procedures ...how work with arguments and returned values
Author: Israel Luengo
Date Posted: 2005-10-10 09:46:21
Well, recently....coding in Interbase (do not test with Firebird, sorry)
i discover the Stored Procedures? what's this?
It like a small process into the Database Engine....that makes a defined work
and it's called by the client application, but with a component dedicated to this work
the benefit it's that for example, you can have flexibility for queries that must return values
used here throught the PARAMS property and defined as Parameters in IBEasy+
which component? IBStoredProc at InterBase component tab....
if (supposed) we have the TIBDatabase connected to our database file (GDB framework)
and inserted the TIBStoredProc component + the TIBTransaction component and all linked properly
Step 1) used IBEasy+ of Marc Grange (it's freeware) for declare the parameter variables (kind Input or Output) and the Stored Procedure itself
Step 2) with the TIBStoredProc component....we select the name of procedure in StoredProcName property
Step 3) we call initialize the procedure by for example as follow....
//code of example previously, we must have the connection to
//database assigned correctly and we're logged in IBX server
///The code for execute the procedure and get the output results
void __fastcall TForm1::Button1Click(TObject *Sender)
{
float returned_value = 0;
IBStoredProc1->ExecProc(); //call to execute the procedure
//for example, here at position 0 of Item array, is the
//variable TOTAL (defined as output float value in IBEasy+ (as parameters))
returned_value = IBStoredProc1->Params->Items[0]->AsFloat;
ShowMessage(returned_value);
}
//---------------------------------------------------------------------------
Hope it helps to understand Stored Procedures and how use it.
Israel
NAME: TOTALIZE
REPLY TO THIS MESSAGE?
Top
You can post a reply to this General message using the form below:
|
|