lithium\data\source\database\adapter\MySql::_init()

protected method

Initializer. Adds MySQL-specific operators to $_operators. Constructs a DSN from configuration.

Returns

void

Source

	protected function _init() {
		if (!$this->_config['host']) {
			throw new ConfigException('No host configured.');
		}

		if (HostString::isSocket($this->_config['host'])) {
			$this->_config['dsn'] = sprintf(
				'mysql:unix_socket=%s;dbname=%s',
				$this->_config['host'],
				$this->_config['database']
			);
		} else {
			$host = HostString::parse($this->_config['host']) + [
				'host' => static::DEFAULT_HOST,
				'port' => static::DEFAULT_PORT
			];
			$this->_config['dsn'] = sprintf(
				'mysql:host=%s;port=%s;dbname=%s',
				$host['host'],
				$host['port'],
				$this->_config['database']
			);
		}
		parent::_init();

		$this->_operators += [
			'REGEXP' => [],
			'NOT REGEXP' => [],
			'SOUNDS LIKE' => []
		];
	}