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

        如何防止 SQLITE SQLSTATE[HY000] [14]?

        时间:2023-10-05
        <legend id='AhzIW'><style id='AhzIW'><dir id='AhzIW'><q id='AhzIW'></q></dir></style></legend>
          <tbody id='AhzIW'></tbody>

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

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

                1. 本文介绍了如何防止 SQLITE SQLSTATE[HY000] [14]?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有时会收到以下错误:

                  I receive sometimes the following error:

                  SQLSTATE[HY000] [14] 无法打开数据库文件

                  SQLSTATE[HY000] [14] unable to open database file

                  我使用

                  new PDO("sqlite:database/datbase.db","","",array(
                      PDO::ATTR_PERSISTENT => true
                  ));
                  

                  每次我想从数据库读取数据或向数据库写入数据时.打开过程是如下函数:

                  everytime I want read or write data from or to the database. The open process is the following function:

                  function opendatabase(){
                  try{
                      return new PDO("sqlite:database/database.db","","",array(
                          PDO::ATTR_PERSISTENT => true
                      ));
                  }catch(PDOException $e){
                      logerror($e->getMessage(), "opendatabase");
                      print "Error in openhrsedb ".$e->getMessage();
                  }
                  }
                  

                  一段时间后(有时一个多小时,有时几分钟后,我收到帖子开头的错误消息.我该如何防止此类错误?

                  After some time (sometime more than an hour, some times after some minutes I get the error message at the beginning of the post. How can I prevent such error?

                  推荐答案

                  这是来自 SQLlite 的错误:

                  This is an error from SQLlite :

                  #define SQLITE_CANTOPEN 14/* 无法打开数据库文件 */

                  好像你打开了很多连接,建议你打开的连接重用.

                  It seems like you have opened to many connections, I suggest you to reuse the connection if it is open.

                  创建属性:

                  private $pdo;
                  

                  并在创建新对象之前检查它是否为空:

                  And check if it's null before creating a new object:

                  function opendatabase(){
                      try{
                          if($this->pdo==null){
                            $this->pdo =new PDO("sqlite:database/database.db","","",array(
                                  PDO::ATTR_PERSISTENT => true
                              ));
                          }
                          return $this->pdo;
                      }catch(PDOException $e){
                          logerror($e->getMessage(), "opendatabase");
                          print "Error in openhrsedb ".$e->getMessage();
                      }
                  }
                  

                  这篇关于如何防止 SQLITE SQLSTATE[HY000] [14]?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:PDO 'LIKE' 查询 下一篇:清理和验证表单 php

                  相关文章

                  最新文章

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

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

                      • <bdo id='fTCwQ'></bdo><ul id='fTCwQ'></ul>

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