<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # Coroutine\\MySQL [TOC] ## 啟用協程MySQL客戶端 * **請勿同時使用異步回調和協程`MySQL`** ## 使用示例 ~~~ $swoole_mysql = new Swoole\Coroutine\MySQL(); $swoole_mysql->connect([ 'host' => '127.0.0.1', 'port' => 3306, 'user' => 'user', 'password' => 'pass', 'database' => 'test', ]); $res = $swoole_mysql->query('select sleep(1)'); ~~~ ## defer特性 請參考[并發Client](并發調用.md)一節。 ## 存儲過程 從`4.0.0`版本后, 支持`MySQL`存儲過程和多結果集獲取 ## MySQL8.0 `Swoole-4.0.1`或更高版本支持了`MySQL8`所有的安全驗證能力, 可以直接正常使用客戶端,而無需回退密碼設定 * * * #### 4.0.1 以下版本 `MySQL-8.0`默認使用了安全性更強的`caching_sha2_password`插件, 如果是從`5.x`升級上來的, 可以直接使用所有`MySQL`功能, 如是新建的`MySQL`, 需要進入`MySQL`命令行執行以下操作來兼容: ~~~ ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; flush privileges; ~~~ 將語句中的`'root'@'localhost'`替換成你所使用的用戶,`password`替換成其密碼. 如仍無法使用, 應在my.cnf中設置`default_authentication_plugin = mysql_native_password` ## SQL 文件 ~~~ function read_sql_file(string $file) { $comment_regex = '/(?<!:)\/\/.*|\/\\*(\s|.)*?\*\/|--[^\n]+/'; $lines = explode("\n", preg_replace($comment_regex, '', co::readFile($file))); $init_sql = []; $multi = false; foreach ($lines as $index => $line) { if (strlen($line) === 0) { continue; } if (substr($line, -1, 1) !== ';') { if (!$multi) { $multi = true; goto _new_line; } else { _append: $end_line = &$init_sql[count($init_sql) - 1]; $end_line = $end_line . $line . "\n"; } } else { if ($multi) { $multi = false; goto _append; } else { $multi = false; _new_line: $init_sql[] = "{$line}"; } } } return $init_sql; } $sql_file = read_sql_file(__DIR__ . '/test.sql'); foreach ($sql_file as $line) { if (!$mysql->query($line)) { echo "Failed! Error#{$mysql->errno}: {$mysql->error}\n"; exit(1); } } ~~~
                  <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>

                              哎呀哎呀视频在线观看