首頁  >  文章  >  後端開發  >  SQLite操作指南 PHP SQLite類

SQLite操作指南 PHP SQLite類

WBOY
WBOY原創
2016-07-29 08:39:51900瀏覽

複製程式碼 程式碼如下:



/**
* SQLite類
* 2009-5-6
* 連萬春
*
*/
class SQLite {
    // 當前SQL指令
    public $_mQueryStr = '';
    // 目前結果
    public $pResult = null; _mSqlite;
// 警告訊息
    protected $_mErrorInfo;
    /**
     * 資料庫連接 建構類別
     *
     * @param string $databaseFile 資料庫檔案
   */
    public  🎜>            $this ->_mSqlite = new PDO('sqlite:'.$databaseFile);
        }else{
            return false;
        }
    }
    /**
     * 資料庫有回傳結果的語句操作
     *
     * @param srting $sql SQL語句
     * @param srting $sql SQL語句
     * @param srting $sql SQL語句
   */
    public function getAll($sql){
     this->_mErrorInfo="SQL語句錯誤" ;
            return false;
        }
      if ( false === $result) {
            return array() ;
        }
        $result->execute();
      ( false === $this->_mResult) {
            return array();
        }
     /**
     * 執行INSERT,DELETE,UPDATA操作
     *
     * @param srting $sql SQL語句      * @param srting $sql SQL語句     public function query($sql){
if (empty($sql)) {
            $this->_mErrorInfo="SQL語句錯誤";
              //$this->_mSqlite->exec($sql )or die(print_r($this->_mSqlite->errorInfo()));
        $this->_mSqlite->exec($sql  /* *
     * 回傳錯誤訊息
     *
     * @return unknown
    */
    public function setError(){
        return $this->_mErrorInfo>
以上就介紹了SQLite操作指南 PHP SQLite類,包含了SQLite操作指南方面的內容,希望對PHP教學有興趣的朋友有幫助。


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn