改名
This commit is contained in:
@@ -67,9 +67,8 @@ class Connection extends Component
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$event = Snowflake::app()->getEvent();
|
||||
$event->on(Event::SYSTEM_RESOURCE_CLEAN, [$this, 'disconnect']);
|
||||
$event->on(Event::SYSTEM_RESOURCE_RELEASES, [$this, 'clear_connection']);
|
||||
Event::on(Event::SYSTEM_RESOURCE_CLEAN, [$this, 'disconnect']);
|
||||
Event::on(Event::SYSTEM_RESOURCE_RELEASES, [$this, 'clear_connection']);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,9 +82,8 @@ class Connection extends Component
|
||||
}
|
||||
$this->beginTransaction();
|
||||
|
||||
$event = Snowflake::app()->getEvent();
|
||||
$event->on(Connection::TRANSACTION_COMMIT, [$this, 'commit'], false, true);
|
||||
$event->on(Connection::TRANSACTION_ROLLBACK, [$this, 'rollback'], false, true);
|
||||
Event::on(Connection::TRANSACTION_COMMIT, [$this, 'commit'], false, true);
|
||||
Event::on(Connection::TRANSACTION_ROLLBACK, [$this, 'rollback'], false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,8 +33,7 @@ class DatabasesProviders extends Providers
|
||||
{
|
||||
$application->set('db', $this);
|
||||
|
||||
$event = Snowflake::app()->getEvent();
|
||||
$event->on(Event::SERVER_WORKER_START, [$this, 'createPool']);
|
||||
Event::on(Event::SERVER_WORKER_START, [$this, 'createPool']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+5
-6
@@ -12,6 +12,7 @@ namespace Database;
|
||||
use Database\Traits\QueryTrait;
|
||||
use Exception;
|
||||
use HttpServer\Http\Context;
|
||||
use Snowflake\Event;
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -49,9 +50,8 @@ class Db
|
||||
if (!static::transactionsActive()) {
|
||||
return;
|
||||
}
|
||||
$event = Snowflake::app()->getEvent();
|
||||
$event->trigger(Connection::TRANSACTION_COMMIT);
|
||||
$event->offName(Connection::TRANSACTION_COMMIT);
|
||||
Event::trigger(Connection::TRANSACTION_COMMIT);
|
||||
Event::offName(Connection::TRANSACTION_COMMIT);
|
||||
static::$_inTransaction = false;
|
||||
}
|
||||
|
||||
@@ -63,9 +63,8 @@ class Db
|
||||
if (!static::transactionsActive()) {
|
||||
return;
|
||||
}
|
||||
$event = Snowflake::app()->getEvent();
|
||||
$event->trigger(Connection::TRANSACTION_ROLLBACK);
|
||||
$event->offName(Connection::TRANSACTION_ROLLBACK);
|
||||
Event::trigger(Connection::TRANSACTION_ROLLBACK);
|
||||
Event::offName(Connection::TRANSACTION_ROLLBACK);
|
||||
static::$_inTransaction = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
defined('CONNECT_HOST') or define('CONNECT_HOST', '');
|
||||
defined('CONNECT_USER') or define('CONNECT_USER', '');
|
||||
defined('CONNECT_PASS') or define('CONNECT_PASS', '');
|
||||
|
||||
return [
|
||||
'cache' => [
|
||||
|
||||
'file' => [
|
||||
'path' => strpos(null, 'data')
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => '6379',
|
||||
'prefix' => 'cache_',
|
||||
'auth' => '',
|
||||
'databases' => '0',
|
||||
'timeout' => -1,
|
||||
'read_timeout' => -1,
|
||||
],
|
||||
],
|
||||
'databases' => [
|
||||
'db' => [
|
||||
'id' => 'db',
|
||||
'cds' => 'mysql:dbname=aircraftwar;host=' . CONNECT_HOST,
|
||||
'username' => CONNECT_USER,
|
||||
'password' => CONNECT_PASS,
|
||||
'tablePrefix' => 'aircraftwar_',
|
||||
'maxNumber' => 100,
|
||||
'slaveConfig' => [
|
||||
'cds' => 'mysql:dbname=aircraftwar;host=' . CONNECT_HOST,
|
||||
'username' => CONNECT_USER,
|
||||
'password' => CONNECT_PASS
|
||||
],
|
||||
],
|
||||
'server' => [
|
||||
'id' => 'server',
|
||||
'cds' => 'mysql:dbname=server;host=' . CONNECT_HOST,
|
||||
'username' => CONNECT_USER,
|
||||
'password' => CONNECT_PASS,
|
||||
'tablePrefix' => 'master_',
|
||||
'maxNumber' => 100,
|
||||
'slaveConfig' => [
|
||||
'cds' => 'mysql:dbname=server;host=' . CONNECT_HOST,
|
||||
'username' => CONNECT_USER,
|
||||
'password' => CONNECT_PASS
|
||||
],
|
||||
],
|
||||
'game' => [
|
||||
'id' => 'game',
|
||||
'cds' => 'mysql:dbname=game;host=' . CONNECT_HOST,
|
||||
'username' => CONNECT_USER,
|
||||
'password' => CONNECT_PASS,
|
||||
'maxNumber' => 100,
|
||||
'tablePrefix' => 'game_',
|
||||
'slaveConfig' => [
|
||||
'cds' => 'mysql:dbname=game;host=' . CONNECT_HOST,
|
||||
'username' => CONNECT_USER,
|
||||
'password' => CONNECT_PASS
|
||||
],
|
||||
],
|
||||
]
|
||||
];
|
||||
Reference in New Issue
Block a user