diff options
author | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2017-01-31 18:38:36 +0300 |
---|---|---|
committer | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2017-01-31 18:38:36 +0300 |
commit | ae92cf850550a9be965db867ba4bfb5651a18e5f (patch) | |
tree | bbf70ce45cc6e608def6e9a81570febe4528208b /codebase/connector/db_phpci2.php | |
parent | 2e509c1f562c4f471d766c9b3532370f847f0839 (diff) | |
download | scheduler-ae92cf850550a9be965db867ba4bfb5651a18e5f.zip scheduler-ae92cf850550a9be965db867ba4bfb5651a18e5f.tar.gz scheduler-ae92cf850550a9be965db867ba4bfb5651a18e5f.tar.bz2 |
[update] version 4.4.0
Diffstat (limited to 'codebase/connector/db_phpci2.php')
-rw-r--r-- | codebase/connector/db_phpci2.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/codebase/connector/db_phpci2.php b/codebase/connector/db_phpci2.php new file mode 100644 index 0000000..e963211 --- /dev/null +++ b/codebase/connector/db_phpci2.php @@ -0,0 +1,65 @@ +<?php +/* + @author dhtmlx.com + @license GPL, see license.txt +*/ +require_once("db_common.php"); + +/*! Implementation of DataWrapper for PDO + +if you plan to use it for Oracle - use Oracle connection type instead +**/ +class PHPCI2DBDataWrapper extends DBDataWrapper{ + private $last_result;//!< store result or last operation + + public function query($sql){ + LogMaster::log($sql); + + $res=$this->connection->query($sql); + if ($res===false) { + throw new Exception("CI - sql execution failed"); + } + + if (is_object($res)) + return new PHPCIResultSet($res); + return new ArrayQueryWrapper(array()); + } + + public function get_next($res){ + $data = $res->next(); + return $data; + } + + public function get_new_id(){ + return $this->connection->insert_id(); + } + + public function escape($str){ + return $this->connection->escape_str($str); + } + + public function escape_name($data){ + return $this->connection->protect_identifiers($data); + } +} + +class PHPCIResultSet{ + private $res; + private $start; + private $count; + + public function __construct($res){ + $this->res = $res; + $this->start = $res->current_row; + $this->count = $res->num_rows; + } + public function next(){ + if ($this->start != $this->count){ + return $this->res->row($this->start++,'array'); + } else { + $this->res->free_result(); + return null; + } + } +} +?>
\ No newline at end of file |