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

  • <legend id='kRESL'><style id='kRESL'><dir id='kRESL'><q id='kRESL'></q></dir></style></legend>

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

        <tfoot id='kRESL'></tfoot>

        PDO 無緩沖查詢

        PDO Unbuffered queries(PDO 無緩沖查詢)
          <bdo id='FeVNj'></bdo><ul id='FeVNj'></ul>
          <i id='FeVNj'><tr id='FeVNj'><dt id='FeVNj'><q id='FeVNj'><span id='FeVNj'><b id='FeVNj'><form id='FeVNj'><ins id='FeVNj'></ins><ul id='FeVNj'></ul><sub id='FeVNj'></sub></form><legend id='FeVNj'></legend><bdo id='FeVNj'><pre id='FeVNj'><center id='FeVNj'></center></pre></bdo></b><th id='FeVNj'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FeVNj'><tfoot id='FeVNj'></tfoot><dl id='FeVNj'><fieldset id='FeVNj'></fieldset></dl></div>
            <tbody id='FeVNj'></tbody>

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

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

            <tfoot id='FeVNj'></tfoot>

                1. 本文介紹了PDO 無緩沖查詢的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試了解 PDO 的詳細信息.所以我編碼了這個:

                  I'm trying to get into PDO details. So I coded this:

                  $cn = getConnection();
                  
                  // get table sequence
                  $comando = "call p_generate_seq('bitacora')";
                  $id = getValue($cn, $comando);
                  
                  //$comando = 'INSERT INTO dsa_bitacora (id, estado, fch_creacion) VALUES (?, ?, ?)';
                  $comando = 'INSERT INTO dsa_bitacora (id, estado, fch_creacion) VALUES (:id, :estado, :fch_creacion)';
                  $parametros = array (
                      ':id'=> (int)$id,
                      ':estado'=>1,
                      ':fch_creacion'=>date('Y-m-d H:i:s')
                  );
                  execWithParameters($cn, $comando, $parametros);
                  

                  我的 getValue 函數工作正常,我得到了表的下一個序列.但是當我進入 execWithParameters 時,我得到了這個異常:

                  my getValue function works fine, and I get the next sequence for the table. But when I get into execWithParameters, i get this exception:

                  PDOException:SQLSTATE[HY000]:一般錯誤:2014 無法執行查詢,而其他未緩沖的查詢處于活動狀態.考慮使用 PDOStatement::fetchAll().或者,如果您的代碼只針對 mysql 運行,您可以通過設置 PDO::MYSQL_ATTR_USE_BUFFERED_QUERY 屬性來啟用查詢緩沖.在 D:Servidorxampp_1_7_1htdocsitacorafunc_db.php 第 77 行

                  PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in D:Servidorxampp_1_7_1htdocsitacorafunc_db.php on line 77

                  我試圖修改連接屬性,但它不起作用.

                  I tried to modify the connection attributes but it doesn't work.

                  這些是我的核心數據庫函數:

                  These are my core db functions:

                  function getConnection() {
                      try {
                          $cn = new PDO("mysql:host=$host;dbname=$bd", $usuario, $clave, array(
                                  PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
                              ));
                  
                          $cn->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
                          return $cn;
                      } catch (PDOException $e) {
                          print "Error!: " . $e->getMessage() . "<br/>";
                          die();
                      }
                  }
                  function getValue($cn, $comando) {
                      $resul = $cn->query($comando);
                          if (!$resul) return null;
                          while($res = $resul->fetch()) {
                              $retorno = $res[0][0];
                              break;
                          }
                          return $retorno;
                  }
                  function execWithParameters($cn, $comando, $parametros) {
                      $q = $cn->prepare($comando);
                      $q->execute($parametros);
                      if ($q->errorInfo() != null) {
                          $e = $q->errorInfo();
                          echo $e[0].':'.$e[1].':'.$e[2];
                      }
                  }
                  

                  有人可以為此提供幫助嗎?PD.請不要建議做 autonumeric id,因為我是從另一個系統移植的.

                  Somebody who can shed a light for this? PD. Please do not suggest doing autonumeric id, cause i am porting from another system.

                  推薦答案

                  問題是 mysql 在給定時間只允許一個未完成的游標.通過使用 fetch() 方法而不消耗所有掛起的數據,您將保持游標打開.

                  The issue is that mysql only allows for one outstanding cursor at a given time. By using the fetch() method and not consuming all the pending data, you are leaving a cursor open.

                  推薦的方法是使用 fetchAll() 方法消耗所有數據.另一種方法是使用 closeCursor() 方法.

                  The recommended approach is to consume all the data using the fetchAll() method. An alternative is to use the closeCursor() method.

                  如果你改變這個功能,我想你會更開心:

                  If you change this function, I think you will be happier:

                  <?php
                  function getValue($cn, $comando) {
                      $resul = $cn->query($comando);
                      if (!$resul) return null;
                      foreach ($resul->fetchAll() as $res) {
                              $retorno = $res[0];
                              break;
                      }
                      return $retorno;
                  }
                  ?>
                  

                  這篇關于PDO 無緩沖查詢的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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的訪問被拒絕)
                  <i id='wDk7U'><tr id='wDk7U'><dt id='wDk7U'><q id='wDk7U'><span id='wDk7U'><b id='wDk7U'><form id='wDk7U'><ins id='wDk7U'></ins><ul id='wDk7U'></ul><sub id='wDk7U'></sub></form><legend id='wDk7U'></legend><bdo id='wDk7U'><pre id='wDk7U'><center id='wDk7U'></center></pre></bdo></b><th id='wDk7U'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wDk7U'><tfoot id='wDk7U'></tfoot><dl id='wDk7U'><fieldset id='wDk7U'></fieldset></dl></div>
                2. <small id='wDk7U'></small><noframes id='wDk7U'>

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

                      <tfoot id='wDk7U'></tfoot>
                      <legend id='wDk7U'><style id='wDk7U'><dir id='wDk7U'><q id='wDk7U'></q></dir></style></legend>
                        <tbody id='wDk7U'></tbody>

                          • 主站蜘蛛池模板: 成人精品一区二区三区中文字幕 | 国产在线精品一区二区三区 | 欧洲性生活视频 | 亚洲a视频| 午夜影院 | 欧美久久一区二区三区 | 日韩中文在线观看 | av中文网| 亚洲美女一区二区三区 | 免费亚洲婷婷 | 日韩欧美二区 | 亚洲国产激情 | 1区2区视频 | 亚洲一区二区三区视频 | 久久成人一区 | 狠狠爱免费视频 | 亚洲视频在线免费观看 | 秋霞电影院午夜伦 | 欧洲视频一区二区 | 亚洲国产精品日韩av不卡在线 | 国产精品欧美日韩 | 日韩精品久久久久 | 一区欧美 | 欧美国产日韩一区 | 久久久久www | 国产99小视频 | 亚洲高清在线 | 亚洲 欧美 另类 日韩 | 在线a视频| 男女爱爱福利视频 | 久久99精品久久久久久 | 免费观看av | 国产一级在线 | 国产一级片91 | 欧美一区视频 | 天堂成人av | 黄色永久免费 | 国产综合久久 | 91美女视频| 蜜桃视频成人 | 欧美区在线|