summaryrefslogtreecommitdiffstats
path: root/codebase/db_phpci.php
diff options
context:
space:
mode:
authorStanislav-Wolski <stanislau.wolski@gmail.com>2012-05-23 19:44:42 +0300
committerStanislav-Wolski <stanislau.wolski@gmail.com>2012-05-23 19:44:42 +0300
commit6c5b0c64092ad095d55412b5765c14bd121b508c (patch)
tree9b2e598d9556f72e1eadc89f231074d7e7072085 /codebase/db_phpci.php
parent97ec6d0772ca2123f54fb0cf558e9fe8a9b72115 (diff)
parent5b2915c991c6fd26503accfc7218256917bff0d3 (diff)
downloadconnector-php-6c5b0c64092ad095d55412b5765c14bd121b508c.zip
connector-php-6c5b0c64092ad095d55412b5765c14bd121b508c.tar.gz
connector-php-6c5b0c64092ad095d55412b5765c14bd121b508c.tar.bz2
Merge branch 'frameworks'
Conflicts: codebase/base_connector.php codebase/data_connector.php codebase/grid_connector.php codebase/scheduler_connector.php
Diffstat (limited to 'codebase/db_phpci.php')
-rw-r--r--codebase/db_phpci.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/codebase/db_phpci.php b/codebase/db_phpci.php
new file mode 100644
index 0000000..3f4221b
--- /dev/null
+++ b/codebase/db_phpci.php
@@ -0,0 +1,63 @@
+<?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 PHPCIDBDataWrapper 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");
+ }
+
+ return new PHPCIResultSet($res);
+ }
+
+ public function get_next($res){
+ $data = $res->next();
+ return $data;
+ }
+
+ protected 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