Commit 47d358a4 authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Merge branch 'Typo3integrated' of systemvcs.math.uzh.ch:it/qfq-jqw into Typo3integrated

parents 4db42a02 432b6ba4
......@@ -308,6 +308,7 @@ class Database {
throw new DbException('[ mysqli: ' . $this->mysqli->errno . ' ] ' . $this->mysqli->error, ERROR_DB_PREPARE);
}
if (count($parameterArray) > 0) {
if (false === $this->fakeCallUserFunc($parameterArray)) {
throw new DbException('[ mysqli: ' . $this->mysqli_stmt->errno . ' ] ' . $this->mysqli_stmt->error, ERROR_DB_BIND);
......@@ -391,44 +392,52 @@ class Database {
*/
private function fakeCallUserFunc($arr) {
$type = '';
// $type = '';
//
// foreach ($arr as $value) {
// if (is_int($value)) {
// $type .= 'i';
// } elseif (is_double($value)) {
// $type .= 'd';
// } else {
// $type .= 's';
// }
// }
foreach ($arr as $value) {
if (is_int($value)) {
$type .= 'i';
} elseif (is_double($value)) {
$type .= 'd';
} else {
$type .= 's';
}
}
switch (count($arr)) {
case 0:
break;
case 1:
$this->mysqli_stmt->bind_param($type, $arr[0]);
break;
case 2:
$this->mysqli_stmt->bind_param($type, $arr[0], $arr[1]);
break;
case 3:
$this->mysqli_stmt->bind_param($type, $arr[0], $arr[1], $arr[2]);
break;
case 4:
$this->mysqli_stmt->bind_param($type, $arr[0], $arr[1], $arr[2], $arr[3]);
break;
case 5:
$this->mysqli_stmt->bind_param($type, $arr[0], $arr[1], $arr[2], $arr[3], $arr[4]);
break;
case 6:
$this->mysqli_stmt->bind_param($type, $arr[0], $arr[1], $arr[2], $arr[3], $arr[4], $arr[5]);
break;
case 7:
$this->mysqli_stmt->bind_param($type, $arr[0], $arr[1], $arr[2], $arr[3], $arr[4], $arr[5], $arr[6]);
break;
default:
throw new DbException('Oops, too many parameter in prepared statement.', 0);
$bindParam = new BindParam();
for ($ii = 0; $ii < count($arr); $ii++) {
$bindParam->add($arr[$ii]);
}
call_user_func_array([$this->mysqli_stmt, 'bind_param'], $bindParam->get());
// switch (count($arr)) {
// case 0:
// break;
// case 1:
// $this->mysqli_stmt->bind_param($type, $arr[0]);
// break;
// case 2:
// $this->mysqli_stmt->bind_param($type, $arr[0], $arr[1]);
// break;
// case 3:
// $this->mysqli_stmt->bind_param($type, $arr[0], $arr[1], $arr[2]);
// break;
// case 4:
// $this->mysqli_stmt->bind_param($type, $arr[0], $arr[1], $arr[2], $arr[3]);
// break;
// case 5:
// $this->mysqli_stmt->bind_param($type, $arr[0], $arr[1], $arr[2], $arr[3], $arr[4]);
// break;
// case 6:
// $this->mysqli_stmt->bind_param($type, $arr[0], $arr[1], $arr[2], $arr[3], $arr[4], $arr[5]);
// break;
// case 7:
// $this->mysqli_stmt->bind_param($type, $arr[0], $arr[1], $arr[2], $arr[3], $arr[4], $arr[5], $arr[6]);
// break;
// default:
// throw new DbException('Oops, too many parameter in prepared statement.', 0);
// }
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment