public function FrxOracle::format in Forena Reports 7.2
Same name and namespace in other branches
- 6.2 plugins/FrxOracle.inc \FrxOracle::format()
- 6 plugins/FrxOracle.inc \FrxOracle::format()
- 7 plugins/FrxOracle.inc \FrxOracle::format()
- 7.3 plugins/FrxOracle.inc \FrxOracle::format()
- 7.4 plugins/FrxOracle.inc \FrxOracle::format()
Implement custom SQL formatter to make sure that strings are properly escaped. Ideally we'd replace this with something that handles prepared statements, but it wouldn't work for
Parameters
unknown_type $value:
unknown_type $key:
unknown_type $data:
File
- plugins/
FrxOracle.inc, line 280 - Oracle specific driver that takes advantage of oracles native XML support
Class
- FrxOracle
- @file Oracle specific driver that takes advantage of oracles native XML support
Code
public function format($value, $key, $data) {
if ($value == '' || $value == array()) {
$value = 'NULL';
}
else {
if (is_array($value)) {
if ($value == array()) {
$value = 'NULL';
}
else {
// Build a array of values string
$i = 0;
$val = '';
foreach ($value as $v) {
$i++;
if ($i == 1) {
$val .= '(';
}
else {
$val .= ',';
}
$val .= "'" . str_replace("'", "''", $v) . "'";
}
$value = $val . ')';
}
}
else {
$value = trim($value);
$value = "'" . str_replace("'", "''", $value) . "'";
}
}
return $value;
}