method getUpdate documentation in bbn\Db\Languages\Pgsql
function(array $cfg)
{
$res = '';
$fields_to_put = [
'values' => [],
'fields' => [],
];
foreach ($cfg['fields'] as $alias => $f) {
if (isset($cfg['available_fields'][$f], $cfg['models'][$cfg['available_fields'][$f]])) {
$model = $cfg['models'][$cfg['available_fields'][$f]];
$csn = $this->colSimpleName($f);
$is_uid = false;
if (isset($model['fields'][$csn])) {
$column = $model['fields'][$csn];
if (($column['type'] === 'binary') && ($column['maxlength'] === 16)) {
$is_uid = true;
}
$fields_to_put['fields'][] = $this->colSimpleName($f, true);
$fields_to_put['values'][] = '?';
}
} else {
$this->error("Error(bool) The column '$f' doesn't exist in '" . implode(', ', $cfg['tables']));
}
}
if (count($fields_to_put['fields']) && (count($cfg['tables']) === 1)) {
$res .= 'UPDATE ' . $this->tableFullName(current($cfg['tables']), true) . ' SET ';
$last = count($fields_to_put['fields']) - 1;
foreach ($fields_to_put['fields'] as $i => $f) {
$res .= $f . ' = ' . $fields_to_put['values'][$i];
if ($i < $last) {
$res .= ',';
}
$res .= PHP_EOL;
}
}
return $res;
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions