- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/db/sqlhelper.php
- Класс: BitrixMainDBSqlHelper
- Вызов: SqlHelper::prepareUpdate
public function prepareUpdate($tableName, array $fields)
{
$update = array();
$tableFields = $this->connection->getTableFields($tableName);
// one registry
$tableFields = array_change_key_case($tableFields, CASE_UPPER);
$fields = array_change_key_case($fields, CASE_UPPER);
foreach ($fields as $columnName => $value)
{
if (isset($tableFields[$columnName]))
{
$update[] = $this->quote($columnName).' = '.$this->convertToDb($value, $tableFields[$columnName]);
}
else
{
trigger_error("Column `{$columnName}` is not found in the `{$tableName}` table", E_USER_WARNING);
}
}
$binds = $this->prepareBinds($tableFields, $fields);
return array(
implode(", ", $update),
$binds
);
}