• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/update_class.php
  • Класс: CUpdater
  • Вызов: CUpdater::Query
function Query($query, $tableName = "")
{
	if (!in_array("DATABASE", $this->callType))
		return false;

	$bCanUpdate = true;
	if ($tableName <> '')
		if (!$this->TableExists($tableName))
			$bCanUpdate = false;

	$result = false;

	$strQuery = '';
	if ($bCanUpdate)
	{
		$strQuery = "";

		if (is_array($query))
		{
			foreach ($query as $key => $value)
			{
				if ($this->dbType == StrToUpper($key))
				{
					$strQuery = $value;
					break;
				}
			}
		}
		else
		{
			$strQuery = $query;
		}

		if ($strQuery == '')
			$bCanUpdate = false;
	}

	CUpdateSystem::AddMessage2Log("Run updater '".$this->updater."': Query(".$strQuery.", ".$tableName.")", "CRUPDCDF2");

	if ($bCanUpdate)
	{
		$result = $GLOBALS["DB"]->Query($strQuery, true);

		if (!$result)
			$this->errorMessage[] = $GLOBALS["DB"]->db_Error;
	}

	return $result;
}