• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/db/commonhelper.php
  • Класс: BitrixSaleLocationDBCommonHelper
  • Вызов: CommonHelper::prepareSql
static function prepareSql($row, $fields, $map)
{
	if (!is_array($row) || empty($row) || !is_array($fields) || empty($fields) || !is_array($map) || empty($map))
	{
		return '';
	}

	$connection = MainHttpApplication::getConnection();
	$sqlHelper = $connection->getSqlHelper();
	unset($connection);

	$sql = [];
	foreach ($fields as $fld => $none)
	{
		$val = $row[$fld];

		// only numeric and literal fields supported at the moment
		if (
			isset($map[$fld]['data_type'])
			&& $map[$fld]['data_type'] == 'integer'
		)
		{
			$sql[] = (int)$val;
		}
		else
		{
			$sql[] = "'" . $sqlHelper->forSql($val) . "'";
		}
	}

	return '(' . implode(',', $sql) . ')';
}