久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='yo9pT'></small><noframes id='yo9pT'>

    <i id='yo9pT'><tr id='yo9pT'><dt id='yo9pT'><q id='yo9pT'><span id='yo9pT'><b id='yo9pT'><form id='yo9pT'><ins id='yo9pT'></ins><ul id='yo9pT'></ul><sub id='yo9pT'></sub></form><legend id='yo9pT'></legend><bdo id='yo9pT'><pre id='yo9pT'><center id='yo9pT'></center></pre></bdo></b><th id='yo9pT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='yo9pT'><tfoot id='yo9pT'></tfoot><dl id='yo9pT'><fieldset id='yo9pT'></fieldset></dl></div>
    <tfoot id='yo9pT'></tfoot>
    1. <legend id='yo9pT'><style id='yo9pT'><dir id='yo9pT'><q id='yo9pT'></q></dir></style></legend>
      • <bdo id='yo9pT'></bdo><ul id='yo9pT'></ul>

        mysqli_multi_query 是異步的嗎?

        Is mysqli_multi_query asynchronous?(mysqli_multi_query 是異步的嗎?)

            <tbody id='z7Ypi'></tbody>
        • <legend id='z7Ypi'><style id='z7Ypi'><dir id='z7Ypi'><q id='z7Ypi'></q></dir></style></legend>

            <i id='z7Ypi'><tr id='z7Ypi'><dt id='z7Ypi'><q id='z7Ypi'><span id='z7Ypi'><b id='z7Ypi'><form id='z7Ypi'><ins id='z7Ypi'></ins><ul id='z7Ypi'></ul><sub id='z7Ypi'></sub></form><legend id='z7Ypi'></legend><bdo id='z7Ypi'><pre id='z7Ypi'><center id='z7Ypi'></center></pre></bdo></b><th id='z7Ypi'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='z7Ypi'><tfoot id='z7Ypi'></tfoot><dl id='z7Ypi'><fieldset id='z7Ypi'></fieldset></dl></div>
            1. <tfoot id='z7Ypi'></tfoot>
                  <bdo id='z7Ypi'></bdo><ul id='z7Ypi'></ul>
                • <small id='z7Ypi'></small><noframes id='z7Ypi'>

                  本文介紹了mysqli_multi_query 是異步的嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  $databases = array();
                  $path = '/Path/To/Directory';
                  $main_link = mysqli_connect('localhost', 'USERNAME', 'PASSWORD');
                  $files = scandir($path);
                  $ignore_files = array();
                  
                  foreach($files as $file)
                  {
                      if (!in_array($file, $ignore_files))
                      {
                          $database = substr($file, 0, strpos($file,'.'));
                          $databases[] = $database;
                          mysqli_query($main_link, "DROP DATABASE IF EXISTS $database") or die ("$database 1" . mysqli_error($main_link));
                          mysqli_query($main_link, "CREATE DATABASE $database") or die ("$database 2" .mysqli_error($main_link));
                          $db_link = mysqli_connect('localhost', 'USERNAME', 'PASSWORD', $database);
                          //In here a whole database dump with scheam + data is executed. 
                          mysqli_multi_query($db_link, file_get_contents($path.'/'.$file)) or die ("$database 4" .mysqli_error($db_link));        
                      }   
                  }
                  

                  當運行這個腳本時,它完成得非常快(返回瀏覽器),但在瀏覽器說它完成后它仍在運行查詢.這是為什么?

                  When running this script it was done very quickly (returned to browser), but it was still running queries after the browser said it was done. Why is this?

                  推薦答案

                  mysqli_query 支持異步查詢.請參閱 mysqli_query 上的變更日志.mysqli_multi_query 在手冊頁上沒有特別提到異步.mysqli_multi_query 唯一要做的就是告訴 MySQL 執行一組查詢.等待結果由 PHP 決定.

                  mysqli_query supports async queries. See changelog on mysqli_query. mysqli_multi_query does not mention async on the manual page specifically. Only thing mysqli_multi_query does is tell MySQL to execute a bulk set of queries. It's up to PHP to wait for the results.

                  就您的代碼而言,您向 MySQL 發送大量 SQL 語句而不等待任何結果.只有當第一條語句失敗時,您的 mysqli_multi_query 才會消亡.因此,該函數在第一條語句之后立即返回 true 并移動到下一行.這就是在 PHP 完成后執行查詢的原因.MySQL 仍在工作.PHP 已經向前發展.

                  As your code stands, your sending a bulk set of SQL statements to MySQL and not waiting for any results. Only time your mysqli_multi_query will ever die is when the first statement fails. So, that function returns true immediately after the first statement and moves on to the next line. That's why the queries are executing after the PHP is finished. MySQL is still working. PHP has moved on.

                  在繼續執行代碼之前,最好循環查看每個語句的結果.如果查詢在批處理中的任何地方失敗,以下內容將死亡.

                  It's best that you loop through the results of each statement before moving on with your code. The following will die if a query fails anywhere in your batch.

                  mysqli_multi_query($db_link, file_get_contents($path.'/'.$file)) or die ("$database 4" .mysqli_error($db_link)); 
                  
                  do {
                      if($result = mysqli_store_result($db_link)){
                          mysqli_free_result($result);
                      }
                  } while(mysqli_next_result($db_link));
                  
                  if(mysqli_error($db_link)) {
                      die(mysqli_error($db_link));
                  }
                  

                  這篇關于mysqli_multi_query 是異步的嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  store_result() and get_result() in mysql returns false(mysql 中的 store_result() 和 get_result() 返回 false)
                  Call to undefined function mysqli_result::num_rows()(調用未定義的函數 mysqli_result::num_rows())
                  PHP Prepared Statement Problems(PHP 準備好的語句問題)
                  mysqli_fetch_array returning only one result(mysqli_fetch_array 只返回一個結果)
                  PHP MySQLi Multiple Inserts(PHP MySQLi 多次插入)
                  How do I make sure that values from MySQL keep their type in PHP?(如何確保 MySQL 中的值在 PHP 中保持其類型?)
                    1. <i id='p9gTX'><tr id='p9gTX'><dt id='p9gTX'><q id='p9gTX'><span id='p9gTX'><b id='p9gTX'><form id='p9gTX'><ins id='p9gTX'></ins><ul id='p9gTX'></ul><sub id='p9gTX'></sub></form><legend id='p9gTX'></legend><bdo id='p9gTX'><pre id='p9gTX'><center id='p9gTX'></center></pre></bdo></b><th id='p9gTX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='p9gTX'><tfoot id='p9gTX'></tfoot><dl id='p9gTX'><fieldset id='p9gTX'></fieldset></dl></div>
                      <legend id='p9gTX'><style id='p9gTX'><dir id='p9gTX'><q id='p9gTX'></q></dir></style></legend>
                      <tfoot id='p9gTX'></tfoot>
                    2. <small id='p9gTX'></small><noframes id='p9gTX'>

                          <bdo id='p9gTX'></bdo><ul id='p9gTX'></ul>
                            <tbody id='p9gTX'></tbody>
                            主站蜘蛛池模板: 国产成人免费观看 | www.一区 | 亚洲在线一区 | 日韩欧美国产高清91 | 欧美激情精品 | 91久久久久久久久久 | 中文字幕在线网站 | 97人人艹 | 欧美日韩综合 | 伊人激情网 | 日韩在线一区二区三区 | 久久精品国产亚洲 | 日韩一级免费 | 欧美视频亚洲视频 | 日本黄色三级视频 | 午夜影院福利 | 亚洲国产三级 | 另类小说第一草 | 男人午夜影院 | 欧美精品一区二区在线观看 | 欧美一级淫片bbb一84 | 日本韩国欧美中文字幕 | 欧美国产日韩在线 | 福利片国产 | 成人在线网站 | 性色av一区二区三区 | 欧美中文字幕在线观看 | 在线观看亚洲视频 | 精品一区在线播放 | 男人影院在线观看 | 中文字幕日本 | 嫩草嫩草嫩草嫩草 | 五月婷婷综合激情 | 成人高潮片免费网站 | 国产黄网 | 国产小视频网站 | 日韩欧美黄色 | 极品新婚夜少妇真紧 | 青青青草视频在线观看 | 日韩一级免费视频 | 麻豆一区二区三区 |