这玩意据说跟bdb一样,嵌入式数据库,正好嵌到了PHP上边,因为写框架,框架里新添加了一个功能,就是管理模块的一个模块,本想用mysql来做,又一想,用mysql,那迁移起来可麻烦了,不运行一个install就没法部署了,不如把功能直接镶嵌,直接使用。
SQLite跟mysql一样,是关系型数据库,而且功能都类似,我直接使用原来的接口,写了一个数据抽象层,直接挂接到原框架里,很好用。
SQLite管理,我还找了两个工具,一个桌面版的,类似mysql front ,一个web版的,看来就像phpmyadmin了。
413 Request Entity Too Large
——————————————————————————–
nginx/0.5.34
FUCK Nginx HOST
那个sqlitemanager http://www.sqlitemanager.org/
代码如下,因为使用不多,临时用一下,所以细节没怎么处理,待出问题的时候再来修改。
- < ?php
- /* DB.SQLite.Class.php
- * SQLite
- * @link http://www.sunboyu.cn
- * @package OA
- * @version V1.0
- *
- * 2009 03 07 sunboyu@gmail.com
- * Demo
- */
- require_once(ROOT."/Include/Class/DB.InterFace.php");
- class SQLite implements DateBaseConnect
- {
- #连接标识
- public $handle = false;
- #结果标识
- public $query;
- #查询次数
- public $exetime;
- #数据库连接
- public function Connect( $argvs )
- {
- $this->handle = @sqlite_open( $argvs['hostname'].'/'.$argvs['datebase'] , $argvs['mode'] , $sqliteerror );
- if(!$this->handle)
- {
- die("Can't connect to the datebase ".$argvs['datebase']);
- }
- $this->exetime = 0;
- }
- #使用数据库
- public function selectDateBase( $datebase )
- {
- #此方法无用
- return true;
- }
- #执行一个查询
- public function query( $sql )
- {
- #echo $sql;
- $this->query = sqlite_query( $sql , $this->handle ) or die("query error".sqlite_last_error( $this->handle ));
- $this->exetime++;
- return true;
- }
- #取得一行
- public function fetch( $sql )
- {
- $this->query( $sql );
- while( $row = mysql_fetch_array( $this->query, MYSQL_ASSOC ) )
- {
- return $row;
- }
- return false;
- }
- #取得所有
- public function fetchAll( $sql )
- {
- $this->query( $sql );
- return sqlite_fetch_all( $this->query );
- }
- #取得影响行数
- public function affectedRow()
- {
- return true;
- }
- #取得结果行数
- public function recordCount()
- {
- return sqlite_num_rows( $this->query );
- }
- #取得上次插入ID
- public function insertID()
- {
- return false;
- }
- #释放资源
- public function close()
- {
- unset( $this->handle );
- }
- #析构函数
- /*
- function __destruct()
- {
- $this->close();
- }
- */
- }
- ?>