I am using some stored procedures against a datastore shared by more than one application and need to call a stored procedure that has an
From documentation this would work something like
$prob_param = null; $stmt = $pdo->prepare('CALL obnoxiousStoredProc(:problem_param)'); $stmt->bindParam(':problem_param', $prob_param, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 11); $stmt->execute(); echo 'Prob param: ' . var_export($prob_param, true);
And we would see something like
Prob param: int(420)
BUT There is a bug that prevents this from working as expected See this answer.
So instead we get
Syntax error or access violation: 1414 OUT or INOUT argument $parameter_number for routine $procedure_name is not a variable or NEW pseudo-variable
The workaround, as described in the answer is two-fold, separate your input and output parameters (which I can get my DBA to do) and use local variables
$stmt = $pdo->prepare('CALL obnoxiousStoredProc(@problem_param)');
and then use a second query
To get your value.
My question is: what is the scope of this "local variable" in PDO? Am I setting myself for a race condition if my php code is getting simultaneously?