mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 08:09:47 +02:00
MDL-17020 dml: native pgsql driver - $ bound syntax fully implemented, we do not need string for exception anymore
This commit is contained in:
parent
e4f9c142f1
commit
935956b8c2
2 changed files with 11 additions and 3 deletions
|
@ -431,8 +431,17 @@ abstract class moodle_database {
|
|||
} else if ($type == SQL_PARAMS_DOLLAR) {
|
||||
if ($target_type & SQL_PARAMS_DOLLAR) {
|
||||
return array($sql, array_values($params), SQL_PARAMS_DOLLAR); // 0-based required
|
||||
} else {
|
||||
throw new dml_exception('boundsyntaxnotsupport');
|
||||
} else if ($target_type & SQL_PARAMS_QM) {
|
||||
$sql = preg_replace('/\$[0-9]+/', '?', $sql);
|
||||
return array($sql, array_values($params), SQL_PARAMS_QM); // 0-based required
|
||||
} else { //$target_type & SQL_PARAMS_NAMED
|
||||
$sql = preg_replace('/\$([0-9]+)/', ':param\\1', $sql);
|
||||
$finalparams = array();
|
||||
foreach ($params as $key=>$param) {
|
||||
$key++;
|
||||
$finalparams['param'.$key] = $param;
|
||||
}
|
||||
return array($sql, $finalparams, SQL_PARAMS_NAMED);
|
||||
}
|
||||
|
||||
} else { // $type == SQL_PARAMS_QM
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue