Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[07002]: [Microsoft][SQL Server Native Client 11.0]COUNT field incorrect or syntax error' in .../db.php:46 Stack trace: #0 .../db.php(46): PDOStatement->execute() #1 .../tests/testDb.php(12): ReportsDB->runSP('CALL ...', Array) #2 {main} thrown in .../db.php on line 46
我正在处理的一些代码上出现此错误。我在调试此特定错误消息时遇到问题。
这是封装第 46 行的内容(我将突出显示实际行)。
public function runSP ($sp, array $args) {
$returnParams = array();
if ($sp) {
$s = explode(" ", $sp);
if ($s[0] != "CALL") {
$sp = "CALL " . $sp;
}
$stmt = $this->_db->prepare($sp);
if (sizeof($args) > 0) {
for ($i = 0; $i > sizeof($args); $i++) {
$stmt->bindParam($i, $args[$i]["value"], $args[$i]["type"]);
$t = explode("|", $args[$i]["type"]);
if ($t[1] == "PDO::PARAM_INPUT_OUTPUT") {
$returnParams[] = $args[$i]["value"];
}
}
Line 46 $stmt->execute();
return $returnParams;
} else {
}
}