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

<small id='Mt9rn'></small><noframes id='Mt9rn'>

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

        <legend id='Mt9rn'><style id='Mt9rn'><dir id='Mt9rn'><q id='Mt9rn'></q></dir></style></legend>

        我可以用 PHP 檢測和處理 MySQL 警告嗎?

        Can I detect and handle MySQL Warnings with PHP?(我可以用 PHP 檢測和處理 MySQL 警告嗎?)

            <bdo id='RRKbx'></bdo><ul id='RRKbx'></ul>

            • <tfoot id='RRKbx'></tfoot>
                <tbody id='RRKbx'></tbody>
              1. <small id='RRKbx'></small><noframes id='RRKbx'>

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

                1. <legend id='RRKbx'><style id='RRKbx'><dir id='RRKbx'><q id='RRKbx'></q></dir></style></legend>
                2. 本文介紹了我可以用 PHP 檢測和處理 MySQL 警告嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在處理一個 MySQL 表,該表將 JobName 列定義為 UNIQUE.如果有人嘗試使用數據庫中已有的 JobName 將新 Job 保存到數據庫中,MySQL 會拋出警告.

                  I'm dealing with a MySQL table that defines the JobName column as UNIQUE. If somebody tries to save a new Job to the database using a JobName that is already in the database, MySQL throws a warning.

                  我希望能夠在我的 PHP 腳本中檢測到這個警告,就像一個錯誤一樣,并進行適當的處??理.理想情況下,我想知道 MySQL 拋出了什么樣的警告,以便我可以分支代碼來處理它.

                  I would like to be able to detect this warning, just like an error, in my PHP script and deal with it appropriately. Ideally I would like to know what kind of warning MySQL has thrown so that I can branch the code to handle it.

                  這可能嗎?如果沒有,是因為MySQL沒有這個能力,PHP沒有這個能力,還是兩者都有?

                  Is this possible? If not, is it because MySQL doesn't have this ability, PHP doesn't have this ability, or both?

                  推薦答案

                  對于本地標記"到 PHP 的警告需要更改 mysql/mysqli 驅動程序,這顯然超出了本問題的范圍.相反,您將不得不基本上檢查您對數據庫所做的每個查詢是否有警告:

                  For warnings to be "flagged" to PHP natively would require changes to the mysql/mysqli driver, which is obviously beyond the scope of this question. Instead you're going to have to basically check every query you make on the database for warnings:

                  $warningCountResult = mysql_query("SELECT @@warning_count");
                  if ($warningCountResult) {
                      $warningCount = mysql_fetch_row($warningCountResult );
                      if ($warningCount[0] > 0) {
                          //Have warnings
                          $warningDetailResult = mysql_query("SHOW WARNINGS");
                          if ($warningDetailResult ) {
                              while ($warning = mysql_fetch_assoc($warningDetailResult) {
                                  //Process it
                              }
                          }
                      }//Else no warnings
                  }
                  

                  顯然,使用整體應用會非常昂貴,因此您可能需要仔細考慮警告可能出現的時間和方式(這可能會導致您進行重構以消除它們).

                  Obviously this is going to be hideously expensive to apply en-mass, so you might need to carefully think about when and how warnings may arise (which may lead you to refactor to eliminate them).

                  作為參考,MySQL 顯示警告

                  當然,您可以省去對 SELECT @@warning_count 的初始查詢,這樣可以為您每次執行節省一個查詢,但我為了迂腐的完整性而包含它.

                  Of course, you could dispense with the initial query for the SELECT @@warning_count, which would save you a query per execution, but I included it for pedantic completeness.

                  這篇關于我可以用 PHP 檢測和處理 MySQL 警告嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)
                      <bdo id='76hNY'></bdo><ul id='76hNY'></ul>

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

                          <small id='76hNY'></small><noframes id='76hNY'>

                          1. <tfoot id='76hNY'></tfoot>
                            主站蜘蛛池模板: 国产日韩91 | 欧美亚洲视频在线观看 | 亚洲一区播放 | 日本欧美在线视频 | 欧美一区2区三区4区公司二百 | 找个黄色片 | 精品欧美一区二区久久久伦 | 国产91在线 | 欧美 | 久久国内精品 | 国产精品1区2区 | 日韩国产在线 | 国产日韩精品在线 | 色橹橹欧美在线观看视频高清 | 国产日韩久久 | 国产福利在线视频 | 欧美日本久久 | 欧美精品一区二区蜜桃 | 欧美久久视频 | 九九九久久国产免费 | www.99热.com| 99精品网 | 欧美精品久久久 | 亚洲麻豆 | 91麻豆精品国产91久久久久久久久 | 最新日韩在线视频 | 日韩理论电影在线观看 | 国产精品永久 | 日韩欧美中文字幕在线视频 | 人干人人 | 一区二区三区日韩精品 | 黄色片在线免费看 | 18成人在线观看 | 日本一区二区不卡视频 | 亚洲人a| 91精品国产一区二区三区 | 2019天天干夜夜操 | 久久中文视频 | www.中文字幕.com | 一级免费毛片 | 亚洲成av| 婷婷久久综合 |