method getUpdate documentation in bbn\Db\Languages\Sql

function(array $cfg) { $res = ''; $fields_to_put = [ 'values' => [], 'fields' => [], ]; foreach ($cfg['fields'] as $i => $f) { if (isset($cfg['available_fields'][$f], $cfg['models'][$cfg['available_fields'][$f]])) { $model = $cfg['models'][$cfg['available_fields'][$f]]; $csn = $this->colSimpleName($f); if (isset($model['fields'][$csn])) { $fields_to_put['fields'][] = $this->colSimpleName($f, true); if ($cfg['values_desc'][$i] && ($cfg['values_desc'][$i]['type'] === 'exp')) { $fields_to_put['values'][] = $cfg['values'][$i][1]; } else { $fields_to_put['values'][] = '?'; } } else { $this->error(X::_("Impossible to retrieve the column %s", $f), false); } } else { $this->error(X::_("The column '%s' doesn't exist in %s", $f, implode(', ', $cfg['tables'])), false); } } if (count($fields_to_put['fields']) && (count($cfg['tables']) === 1)) { $res .= 'UPDATE ' . (!empty($cfg['ignore']) ? $this->getIgnore() : '') . $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.