X-Git-Url: http://git.dj3c1t.com/index.cgi?p=mtweb;a=blobdiff_plain;f=mw%2Fapp%2Fdata%2Fimpl%2Fmw_pdo_sqlite.php;fp=mw%2Fapp%2Fdata%2Fimpl%2Fmw_pdo_sqlite.php;h=8fd7debfc8ea7f891912687e8d8655f8c8307282;hp=1e4f68eff97cd1776721911a9329fd89f529dcc5;hb=5abc9d5fca28ef86dee6148bb96780d1a7b670f3;hpb=ed558d720ebf6985290c99297f5b1d2c86d1f60a diff --git a/mw/app/data/impl/mw_pdo_sqlite.php b/mw/app/data/impl/mw_pdo_sqlite.php index 1e4f68e..8fd7deb 100644 --- a/mw/app/data/impl/mw_pdo_sqlite.php +++ b/mw/app/data/impl/mw_pdo_sqlite.php @@ -2,34 +2,38 @@ class mw_pdo_sqlite{ - var $link; - - var $host; - var $base; - var $user; - var $password; - - var $EXTENTION_OK; + public $link; + public $host; + public $base; + public $user; + public $password; + public $EXTENTION_OK; + + public function __construct($params = array()){ + $this->host = isset($params["host"]) ? $params["host"] : "content/data/sqlite"; + $this->base = isset($params["base"]) ? $params["base"] : "mtweb.db"; + $this->user = isset($params["user"]) ? $params["user"] : ""; + $this->password = isset($params["password"]) ? $params["password"] : ""; + $this->EXTENTION_OK = (extension_loaded("pdo") && extension_loaded("pdo_sqlite")); + } - function get_link(){ + public function get_link(){ return $this->link; } - function extention_ok(&$env) { return $this->EXTENTION_OK; } - - function authentication_required() { return false; } + public function extention_ok(&$env){ + return $this->EXTENTION_OK; + } - function sgbd_name() { return "PDO SQLite"; } + public function authentication_required(){ + return false; + } - function mw_pdo_sqlite($params = array()){ - $this->host = isset($params["host"]) ? $params["host"] : "content/data/sqlite"; - $this->base = isset($params["base"]) ? $params["base"] : "mtweb.db"; - $this->user = isset($params["user"]) ? $params["user"] : ""; - $this->password = isset($params["password"]) ? $params["password"] : ""; - $this->EXTENTION_OK = (extension_loaded("pdo") && extension_loaded("pdo_sqlite")); + public function sgbd_name(){ + return "PDO SQLite"; } - function connect($host, $base, $user, $password){ + public function connect($host, $base, $user, $password){ if($host) $host .= substr($host, -1) != "/" ? "/" : ""; try{ $this->link = null; @@ -43,12 +47,12 @@ return true; } - function select_db($db_name){ + public function select_db($db_name){ $this->base = $db_name; return $this->connect($this->host, $this->base, $this->user, $this->password); } - function desc_table($table_name){ + public function desc_table($table_name){ if(strpos($table_name, "'") !== false){ throw new Exception($this->exception_out("nom de table avec un simple quote")); } @@ -73,7 +77,7 @@ return $desc; } - function table_exists($table_name){ + public function table_exists($table_name){ if(!$this->link) $this->connect($this->host, $this->base, $this->user, $this->password); $EXISTS = false; try{ @@ -92,7 +96,7 @@ return $EXISTS; } - function field_exists($table_name, $field_name){ + public function field_exists($table_name, $field_name){ if(!$this->link) $this->connect($this->host, $this->base, $this->user, $this->password); if(!($desc = $this->desc_table($table_name))){ throw new Exception($this->exception_out("Impossible de lire la description de la table")); @@ -107,7 +111,7 @@ return $EXISTS; } - function query($query_string){ + public function query($query_string){ if(!$this->link) $this->connect($this->host, $this->base, $this->user, $this->password); if(!($result = $this->link->query($query_string))){ throw new Exception($this->exception_out("Syntaxe invalide dans une requete")); @@ -115,7 +119,7 @@ return $result; } - function fetch_assoc($rst){ + public function fetch_assoc($rst){ if(!$this->link){ throw new Exception($this->exception_out("fetch_assoc sans connexion")); } @@ -131,7 +135,7 @@ return $tuple; } - function insert_id(){ + public function insert_id(){ if(!$this->link){ throw new Exception($this->exception_out("insert_id sans connexion")); } @@ -144,7 +148,7 @@ return $id; } - function free_result($rst){ + public function free_result($rst){ if(!$this->link){ throw new Exception($this->exception_out("free_result sans connexion")); } @@ -161,15 +165,13 @@ return true; } - function close(){ + public function close(){ $this->link = null; return true; } - function exception_out($message){ + public function exception_out($message){ return "[erreur] sqlite : ".$message; } } - -?> \ No newline at end of file