boaPHP开发手册v5.5

存储过程

pdo

使用预处理查询执行存储过程,出参必须指定最大长度


$db = boa::db();

$stmt = $db->execute('CALL sp_test');

$stmt = $db->stmt_query('CALL sp_test(?, ?, ?)');
$param = [
	'in',
	[10, PDO::PARAM_INT],
	['@out', PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 4000]
];
$stmt->execute($param);
$arr = $stmt->one();

mysqli


$db = boa::db();

$res = $db->execute('CALL sp_test');

$arr = $db->query('CALL sp_test(?, ?, @out)', 'in', 10);