• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/db/sqlhelper.php
  • Класс: BitrixMainDBSqlHelper
  • Вызов: SqlHelper::castToChar
public function castToChar($fieldName);

/**
 * Returns expression for text field being used in group or order
 * @see BitrixMainORMQueryQuery::buildGroup
 * @see BitrixMainORMQueryQuery::buildOrder
 *
 * @param string $fieldName
 *
 * @return string
 */
abstract public function softCastTextToChar($fieldName);

/**
 * Transforms Sql according to $limit and $offset limitations.
 * 

* You must specify $limit when $offset is set. * * @param string $sql Sql text. * @param integer $limit Maximum number of rows to return. * @param integer $offset Offset of the first row to return, starting from 0. * * @return string * @throws MainArgumentException */ abstract public function getTopSql($sql, $limit, $offset = 0); /** * Builds the strings for the SQL INSERT command for the given table. * * @param string $tableName A table name. * @param array $fields Array("column" => $value)[]. * * @param bool $returnAsArray * * @return array (columnList, valueList, binds) */ public function prepareInsert($tableName, array $fields, $returnAsArray = false) { $columns = array(); $values = 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])) { $columns[] = $this->quote($columnName); $values[] = $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( $returnAsArray ? $columns : implode(", ", $columns), $returnAsArray ? $values : implode(", ", $values), $binds ); }