mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@957 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
d0df72c603
commit
b2f81c120e
1 changed files with 16 additions and 16 deletions
|
|
@ -1,20 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class DBSqlite
|
* @class DBSqlite3
|
||||||
* @author zero (zero@nzeo.com)
|
* @author zero (zero@nzeo.com)
|
||||||
* @brief MySQL DBMS를 이용하기 위한 class
|
* @brief MySQL DBMS를 이용하기 위한 class
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*
|
*
|
||||||
* sqlite handling class
|
* sqlite3 handling class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class DBSqlite extends DB {
|
class DBSqlite3 extends DB {
|
||||||
|
|
||||||
var $database = NULL; ///< database
|
var $database = NULL; ///< database
|
||||||
var $prefix = 'zb'; ///< 제로보드에서 사용할 테이블들의 prefix (한 DB에서 여러개의 제로보드 설치 가능)
|
var $prefix = 'zb'; ///< 제로보드에서 사용할 테이블들의 prefix (한 DB에서 여러개의 제로보드 설치 가능)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief sqlite 에서 사용될 column type
|
* @brief sqlite3 에서 사용될 column type
|
||||||
*
|
*
|
||||||
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
|
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
|
||||||
* 각 DBMS에 맞게 replace 해주어야 한다
|
* 각 DBMS에 맞게 replace 해주어야 한다
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
/**
|
/**
|
||||||
* @brief constructor
|
* @brief constructor
|
||||||
**/
|
**/
|
||||||
function DBSqlite() {
|
function DBSqlite3() {
|
||||||
$this->_setDBInfo();
|
$this->_setDBInfo();
|
||||||
$this->_connect();
|
$this->_connect();
|
||||||
}
|
}
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
if(!$this->database) return;
|
if(!$this->database) return;
|
||||||
|
|
||||||
// 데이터 베이스 파일 접속 시도
|
// 데이터 베이스 파일 접속 시도
|
||||||
$this->fd = sqlite_open($this->database, 0666, &$error);
|
$this->fd = sqlite3_open($this->database, 0666, &$error);
|
||||||
if(!file_exists($this->database) || $error) {
|
if(!file_exists($this->database) || $error) {
|
||||||
//$this->setError(-1,'permission denied to access database');
|
//$this->setError(-1,'permission denied to access database');
|
||||||
$this->setError(-1,$error);
|
$this->setError(-1,$error);
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
function close() {
|
function close() {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
|
||||||
sqlite_close($this->fd);
|
sqlite3_close($this->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -100,14 +100,14 @@
|
||||||
$this->query = $query;
|
$this->query = $query;
|
||||||
$this->setError(0,'success');
|
$this->setError(0,'success');
|
||||||
|
|
||||||
@sqlite_query("BEGIN;", $this->fd);
|
@sqlite3_query("BEGIN;", $this->fd);
|
||||||
$result = @sqlite_query($query, $this->fd);
|
$result = @sqlite3_query($query, $this->fd);
|
||||||
if(sqlite_last_error($this->fd)) {
|
if(sqlite3_last_error($this->fd)) {
|
||||||
@sqlite_query("ROLLBACK;", $this->fd);
|
@sqlite3_query("ROLLBACK;", $this->fd);
|
||||||
$this->setError(sqlite_last_error($this->fd), sqlite_error_string(sqlite_last_error($this->fd)));
|
$this->setError(sqlite3_last_error($this->fd), sqlite3_error_string(sqlite3_last_error($this->fd)));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@sqlite_query("COMMIT;", $this->fd);
|
@sqlite3_query("COMMIT;", $this->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
@ -119,7 +119,7 @@
|
||||||
function _fetch($result) {
|
function _fetch($result) {
|
||||||
if($this->errno!=0 || !$result) return;
|
if($this->errno!=0 || !$result) return;
|
||||||
|
|
||||||
while($tmp = sqlite_fetch_array($result, SQLITE_ASSOC)) {
|
while($tmp = sqlite3_fetch_array($result, SQLITE_ASSOC)) {
|
||||||
unset($obj);
|
unset($obj);
|
||||||
foreach($tmp as $key => $val) $obj->{$key} = $val;
|
foreach($tmp as $key => $val) $obj->{$key} = $val;
|
||||||
$output[] = $obj;
|
$output[] = $obj;
|
||||||
|
|
@ -135,7 +135,7 @@
|
||||||
function getNextSequence() {
|
function getNextSequence() {
|
||||||
$query = sprintf("insert into %ssequence (seq) values ('')", $this->prefix);
|
$query = sprintf("insert into %ssequence (seq) values ('')", $this->prefix);
|
||||||
$this->_query($query);
|
$this->_query($query);
|
||||||
return sqlite_last_insert_rowid($this->fd);
|
return sqlite3_last_insert_rowid($this->fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -144,7 +144,7 @@
|
||||||
function isTableExists($target_name) {
|
function isTableExists($target_name) {
|
||||||
$query = sprintf('pragma table_info(%s%s)', $this->prefix, $this->addQuotes($target_name));
|
$query = sprintf('pragma table_info(%s%s)', $this->prefix, $this->addQuotes($target_name));
|
||||||
$result = $this->_query($query);
|
$result = $this->_query($query);
|
||||||
if(sqlite_num_rows($result)==0) return false;
|
if(sqlite3_num_rows($result)==0) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue