<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # MysqlAsynPool 異步mysql連接池 ## 普通用法 示例: ```php /** * mysql 測試 * @throws \Server\CoreBase\SwooleException */ public function mysql_test() { $this->mysql_pool->dbQueryBuilder->select('*')->from('account')->where('sex', 1); $this->mysql_pool->query(function ($result) { print_r($result); }); $this->destroy(); } ``` 其中dbQueryBuilder對應的是Miner,關于用法參考[Miner](https://github.com/jstayton/Miner) 參考類ServerMysqlTest.php,可以在test文件夾中找到。 ## 協程事務 非協程版事務相對復雜不建議使用。 ```php /** * mysql 事務協程測試 */ public function http_mysql_begin_coroutine_test() { $id = yield $this->mysql_pool->coroutineBegin($this); $update_result = yield $this->mysql_pool->dbQueryBuilder->update('user_info') ->set('sex', '0') ->where('uid', 36) ->coroutineSend($id); $result = yield $this->mysql_pool->dbQueryBuilder->select('*') ->from('user_info') ->where('uid', 36) ->coroutineSend($id); if ($result['result'][0]['channel'] == 888) { $this->http_output->end('commit'); yield $this->mysql_pool->coroutineCommit($id); } else { $this->http_output->end('rollback'); yield $this->mysql_pool->coroutineRollback($id); } } ``` ## 協程模式 示例: ```php $mySqlCoroutine = $this->mysql_pool->dbQueryBuilder->select('*') ->from('account') ->where('uid', 10303) ->coroutineSend(); $mysql_result = yield $mySqlCoroutine; $redisCoroutine = $this->redis_pool->coroutineSend('get', 'test'); $redis_result = yield $redisCoroutine; ``` 使用協程會大大簡化代碼的書寫,提高代碼的可讀性。 上面的代碼通過yield關鍵字返回了異步回調的值。 執行順序 mysql\_send-&gt;mysql\_rev-&gt;redis\_send-&gt;redis\_rev; ```php $mySqlCoroutine = $this->mysql_pool->dbQueryBuilder->select('*') ->from('account') ->where('uid', 10303) ->coroutineSend(); $redisCoroutine = $this->redis_pool->coroutineSend('get', 'test'); $mysql_result = yield $mySqlCoroutine; $redis_result = yield $redisCoroutine; ``` 執行順序 mysql\_send-&gt;redis\_send-&gt;mysql\_rev-&gt;redis\_rev; ## 獲取mysql語句 ```php $value = $this->mysql_pool->dbQueryBuilder ->insertInto('account') ->intoColumns(['uid', 'static']) ->intoValues([[36, 0], [37, 0]]) ->getStatement(true); ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看