getMysql

获取Mysql的同步实例。

注意,在1.7版本后我们推荐统一使用协程的方式调用Redis,Mysql。使用协程的API调用可以自动分配异步客户端或者是同步客户端。

协程的例子:

    /**
     * mysql Insert 命令
     * @return \Generator
     */
    public function testMysqlInsert()
    {
        $value = yield $this->mysql_pool->dbQueryBuilder->insert('MysqlTest')
            ->option('HIGH_PRIORITY')
            ->set('firstname', 'White')
            ->set('lastname', 'Cat')
            ->set('age', '25')
            ->set('townid', '10000')->coroutineSend();
    }

results matching ""

    No results matching ""