• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/migration/migrate.php
  • Класс: BitrixSaleLocationMigrationCUpdaterLocationPro
  • Вызов: CUpdaterLocationPro::TableExists
public function TableExists($tableName)
{
	if (!in_array("DATABASE", $this->callType))
		return False;

	$tableName = preg_replace("/[^A-Za-z0-9%_]+/i", "", $tableName);
	$tableName = Trim($tableName);

	if ($tableName == '')
		return False;

	global $DB;

	if($this->UsingMysql())
	{
		return $DB->query('select * from '.$DB->ForSql($tableName).' where 1=0', true);
	}
	else
	{
		$strSql = '';
		if($this->UsingOracle())
			$strSql = "SELECT TABLE_NAME FROM USER_TABLES WHERE TABLE_NAME LIKE UPPER('".mb_strtoupper($DB->ForSql($tableName))."')";
		elseif($this->UsingMssql())
			$strSql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE '".mb_strtoupper($DB->ForSql($tableName))."'";

		return !!$DB->Query($strSql)->fetch();
	}
}