Home > Backend Development > PHP Tutorial > PHP SQLite Class_PHP Tutorial

PHP SQLite Class_PHP Tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:46:28
Original
1036 people have browsed it

Copy code The code is as follows:

/**
* SQLite class
* 2009-5-6
* Lian Wanchun
*
*/
class SQLite {
// Current SQL command
public $_mQueryStr = '';
// Current result
public $_mResult = null;
// SQLite connection handle
protected $_mSqlite;
// Warning message
protected $_mErrorInfo;
/**
* Database connection construction class
*
* @param string $databaseFile database file
* @return unknown
*/
public function __construct($databaseFile){
if(file_exists($databaseFile)){
$ this->_mSqlite = new PDO('sqlite:'.$databaseFile);
                                                                                                                                                                }
}
/**
* The database has statement operations that return results
*
* @param srting $sql SQL statement
* @return unknown
*/
public function getAll($sql){
if (empty($sql)) {
$this->_mErrorInfo=" SQL statement error";
              return false;               ; 🎜> return array();
}
execute(); $this->_mResult = $result->fetchAll();
if ( false == = $this->_mResult) {
return array();
}
return $this->_mResult;
}
/**
* Perform INSERT, DELETE, UPDATA operations
*
* @param srting $sql SQL statement
* @return unknown
*/
public function query($sql){
                                                                                                                  / /$this->_mSqlite->exec($sql)or die(print_r($this->_mSqlite->errorInfo()));
$this->_mSqlite->exec($ sql);
return true;
}
/**
* Return error message
*
* @return unknown
*/
public function setError(){
return $this->_mErrorInfo;
}
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320137.htmlTechArticleCopy the code as follows: ? /*** SQLite class * 2009-5-6 * Lian Wanchun **/ class SQLite { // Current SQL command public $ _mQueryStr = ''; // Current result public $_mResult = null; // SQLi...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template