DbServer::onStart PHP Method

onStart() public method

public onStart ( $serv )
    public function onStart($serv)
    {
        for ($i = 0; $i < $this->pool_size; $i++) {
            $db = new swoole_mysql();
            $db->connect(array('host' => $this->config['host'], 'user' => $this->config['user'], 'password' => $this->config['pwd'], 'database' => $this->config['name']), function ($db, $result) {
                //var_dump($result);
                //print_r($db);
            });
            //设置数据库编码
            $db_sock = $db->sock;
            //print_r($db->sock);
            //swoole_event_add($db_sock, array(&$this, 'onSQLReady'));
            /*$db->query("SET NAMES '".$this->config['charset']."'",function($link,$result){
                  var_dump($result);
              });*/
            $this->idle_pool[] = array('mysqli' => $db, 'db_sock' => $db_sock, 'fd' => 0);
        }
    }