PHP 5.1 RC6

faithless.man

Новичок
имеется: WIN XP SP2, PHP/5.1RC7-dev (php5.1-win32-200511220730), MySQL 5.0.15

Код:
CREATE PROCEDURE my_out (OUT a INT) set a = 1;
CREATE PROCEDURE my_inout (INOUT b INT) set b = b * 2;
Код:
$a = 1;
$b = 2;
try {
	$dbh = new PDO($dsn, $user, $password);
		
	print "Before: a = $a, b = $b\n";
	
	$stm = $dbh->prepare('call my_out (?)');
	$stm->bindParam(1, $a, PDO::PARAM_INT);
	
	if ($stm->execute()) {
		print "After: a = $a\n";
	} else {
		print_r($stm->errorInfo());
	}
	
	$stm = $dbh->prepare('call my_inout (?)');
	$stm->bindParam(1, $b, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT);
	
	if ($stm->execute()) {
		print "After: b = $b\n";
	} else {
		print_r($stm->errorInfo());
	}
} catch (PDOException $e) {
  echo 'Connection failed: ' . $e->getMessage();
}
выдает ошибку:
Array
(
[0] => HY000
[1] => 1414
[2] => OUT or INOUT argument 1 for routine test.my_out is not a variable
)

Array
(
[0] => HY000
[1] => 1414
[2] => OUT or INOUT argument 1 for routine test.my_inout is not a variable
)
 

si

Administrator
не оно ?
data_type

Explicit data type for the parameter using the PDO::pARAM_* constants. To return an INOUT parameter from a stored procedure, use the bitwise OR operator to set the PDO::pARAM_INPUT_OUTPUT bits for the data_type parameter.
-~{}~ 22.11.05 21:11:

упс, пока писал исходный вариант изменился ;)
 
Сверху