v5:userguide:stored_procedure
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
userguide:stored_procedure [2015/09/12 17:43] – created mnewnham | v5:userguide:stored_procedure [2018/06/07 09:26] – [Step 2: Setting Parameters] add wrap to highlight requirement to initialize variables; formatting and rewording dregad | ||
---|---|---|---|
Line 28: | Line 28: | ||
| | ||
==== Creation ==== | ==== Creation ==== | ||
- | The procedure can be created by simply creating a PHP string using the above code, then executing it | + | The procedure can be created by simply creating a PHP string using the above code, then executing it using '' |
===== Accessing The Procedure ===== | ===== Accessing The Procedure ===== | ||
==== Step 1: Preparation ==== | ==== Step 1: Preparation ==== | ||
- | The first step is to access the procedure using the [[reference: | + | The first step is to access the procedure using the [[v5:reference:connection: |
<code php> | <code php> | ||
$procedure = $db-> | $procedure = $db-> | ||
Line 38: | Line 38: | ||
die (' | die (' | ||
</ | </ | ||
- | ==== Step 2: Setting Parameters ==== | + | ==== Step 2: Setting Parameters ==== |
- | Next, the parameters must be set. Stored Procedure Parameters may be either Input, | + | |
+ | Next, the parameters must be set. Stored Procedure Parameters may be either | ||
+ | |||
+ | <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. | ||
+ | </ | ||
=== 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-> | $ok = $db-> | ||
</ | </ | ||
+ | |||
=== 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 | $parameter3Name | ||
Line 71: | Line 79: | ||
$ok = $db-> | $ok = $db-> | ||
</ | </ | ||
+ | |||
==== 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