summaryrefslogtreecommitdiffstats
path: root/codebase/db_phpci.php
diff options
context:
space:
mode:
authorStanislav <stanislau.wolski@gmail.com>2012-05-22 01:25:12 +0300
committerStanislav <stanislau.wolski@gmail.com>2012-05-22 01:25:12 +0300
commitb33829f06ced3f35a4463f84f769b753faf70ab4 (patch)
tree638c9af7d2dc0c8f3f1c69046cf1c736a417e887 /codebase/db_phpci.php
parent05ad07fee439616159c687a806270fd587af9abc (diff)
downloadconnector-php-b33829f06ced3f35a4463f84f769b753faf70ab4.zip
connector-php-b33829f06ced3f35a4463f84f769b753faf70ab4.tar.gz
connector-php-b33829f06ced3f35a4463f84f769b753faf70ab4.tar.bz2
[add] ability to define extra data attributes
Diffstat (limited to 'codebase/db_phpci.php')
-rw-r--r--codebase/db_phpci.php65
1 files changed, 65 insertions, 0 deletions
diff --git a/codebase/db_phpci.php b/codebase/db_phpci.php
new file mode 100644
index 0000000..288a815
--- /dev/null
+++ b/codebase/db_phpci.php
@@ -0,0 +1,65 @@
+<?php
+/*
+ @author dhtmlx.com
+ @license GPL, see license.txt
+*/
+require_once("db_common.php");
+
+DataProcessor::$action_param ="dhx_editor_status";
+
+/*! 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