Exemple #1
0
function __construct ($configs)
{
	parent::__construct($configs);

	coren::handler('on_redirect', null, null, null, 'redirect');
	coren::handler('on_shutdown', ''  , ''  , ''  , 'shutdown');
}
Exemple #2
0
public function set ($data)
{
	if (!$this->wasset || !$this->autolock)
	{
		if (!$this->wasset) coren::handler('send', coren::event_for_stage_epiwork);
		$this->wasset = true;
		$this->value  = isset($data['value' ]) ? $data['value' ] : null;
		$this->expire = isset($data['expire']) ? $data['expire'] : null;
	}
}
Exemple #3
0
function handle ($data)
{
	if (!is_null($this->handle)) return $this->handle;

	// Connect. Throw on error.
	$handle = $this->persistent
		? @mysql_pconnect($this->host . (isset($this->port) ? ':'.$this->port : ''), $this->user, $this->pass)
		: @mysql_connect ($this->host . (isset($this->port) ? ':'.$this->port : ''), $this->user, $this->pass, true);
	if ($handle === false) throw new exception(mysql_error(), mysql_errno());//NB: without argument.

	// Select active database.
	if (isset($this->base))
	{
		$res = @mysql_select_db($this->base, $handle);
		if ($res === false) throw new exception(mysql_error($handle), mysql_errno($handle));
	}

	// Select codepage for client connection.
	if (isset($this->charset))
	{
		$res = @mysql_query("set names `" . str_replace('`', '``', $this->charset) . "`", $handle);
		if ($res === false) throw new exception(mysql_error($handle), mysql_errno($handle));
	}

//	// Start a new transaction.
//	$res = @mysql_query('start transaction with consistent snapshot', $handle);
//	if ($res === false) throw new exception(mysql_error($handle), mysql_errno($handle));

	coren::handler('disconnect', coren::event_for_stage_free);

	return $this->handle = $handle;
}