Delphi32.com - Home!
| Home/News | Downloads | Forums | D32 Magazine | Resources | Info and Facts |  
 
 How do I execute a stored procedure with TIBSQL?


How do I execute a stored procedure with TIBSQL?   

    To take advantage of the light weight TIBSQL component for executing stored procedures, execute the procedure with the SQL statement 'execute procedure procedure_name'. The results are passed back through a TIBXSQLDA object. A TIBXSQLDA is an object which encapsulates an InterBase API data type and contains all of the return parameters for the stored procedure. TIBSQL.Current returns the current TIBXSQLDA object associated with the TIBSQL.

    The following code example executes a stored procedure, new_key, that does not take any parameters but does return a value. The 'new_key' procedure is defined as follows:

    create procedure new_key returns (newkey integer) as begin newkey = gen_id(vote_pui_gen, ); end

    For more information on creating stored procedures refer to the InterBase "Data Definition Guide", and "Programmer's Guide".

    procedure TForm .Button Click(Sender: TObject); begin IBSQL .SQL.Clear; IBSQL .SQL.Add('execute procedure new_key'); IBSQL .ExecQuery; Form .Caption := IBSQL .Current.Vars ;0].AsString; end;

    If the procedure returns multiple parameters, you can iterate through the Vars array to extract all of the parameters.  



  << Previous Faq     Complete List     Next Faq >>  



 
 Hits/month  2,500,000+ 
 Downloads
 (Since May 2000)
 7,393,709 
 Total Files  6,023 
 Forum msgs  7,670 
 Articles/FAQs  70+/900+ 
Kylix
Tips n Tricks
FAQs
Knowledge Base
Bug Listings
Articles
Books
Newsgroups
Links
Submissions
Testimonials
Advertising
Contact Us
About Us
Search Amazon:
Top Selling Software at Amazon

| Home/News | Downloads | Forums | Resources | Info and Facts | Testimonials |
  Site Search:
 


Comments/Problems: Webmaster@delphi32.com
Copyright © 1998-2006, Delphi32.com. All rights reserved.
Terms of Use