ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:stored_procedure

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
v5:userguide:stored_procedure [2017/04/21 11:50]
127.0.0.1 external edit
v5:userguide:stored_procedure [2018/06/07 09:26]
dregad [Step 2: Setting Parameters] add wrap to highlight requirement to initialize variables; formatting and rewording
Line 38: Line 38:
     die ('​Invalid or inaccessible stored procedure name'​);​     die ('​Invalid or inaccessible stored procedure name'​);​
 </​code>​ </​code>​
-==== Step 2: Setting Parameters ====     +==== Step 2: Setting Parameters ==== 
-Next, the parameters must be set. Stored Procedure Parameters may be either Input,​Output or Input-Output parameters. ADOdb provides access to input-output parameters via the outParameter method. The parameter names must match the names of the input/​output parameters ​defined in the stored procedure.+ 
 +Next, the parameters must be set. Stored Procedure Parameters may be either ​//Input////Output// or //Input-Output// parameters. ADOdb provides access to input-output parameters via the [[v5:​reference:​connection:​outparameter|outParameter()]] method. The parameter names must match those defined in the stored procedure. 
 + 
 +<WRAP right round important>​ 
 +Because both the parameter names and values are passed by reference, the variables used to hold them must be created and initialized before they are passed on to the methods. 
 +</​WRAP>​ 
 === Input Parameters === === Input Parameters ===
-Because both the parameter names and values are passed by reference, they must be initialized as strings before passing to the methods ​+ 
 <code php> ​ <code php> ​
 /* /*
Line 63: Line 70:
 $ok = $db->​inParameter($procedure,'​PARAMETER2','​ACCOUNT NAME'​);​ $ok = $db->​inParameter($procedure,'​PARAMETER2','​ACCOUNT NAME'​);​
 </​code>​ </​code>​
 +
 === Output Parameters === === Output Parameters ===
-Output and Input-Output Parameters are passed by reference, the variables used to hold them must be created and initialized before the stored procedure is executed.+
 <code php> <code php>
 $parameter3Name ​ = '​PARAMETER3';​ $parameter3Name ​ = '​PARAMETER3';​
Line 71: Line 79:
 $ok = $db->​outParameter($procedure,​$parameter3Name,​$parameter3Value);​ $ok = $db->​outParameter($procedure,​$parameter3Name,​$parameter3Value);​
 </​code>​ </​code>​
 +
 ==== Executing The Stored Procedure ==== ==== Executing The Stored Procedure ====
 The stored procedure is executed by passing the handle of the procedure to the execute statement. The stored procedure is executed by passing the handle of the procedure to the execute statement.
v5/userguide/stored_procedure.txt · Last modified: 2019/01/22 01:11 by mnewnham