summaryrefslogtreecommitdiffstats
path: root/codebase
diff options
context:
space:
mode:
authorStanislav-Wolski <stanislau.wolski@gmail.com>2012-05-22 17:41:19 +0300
committerStanislav-Wolski <stanislau.wolski@gmail.com>2012-05-22 17:41:19 +0300
commitfc6240c00fb8acba8700749ebb2b2e40dd85fc41 (patch)
tree52952a7d3815006c856a00496f3b430fb1b94cd1 /codebase
parent8bb27b287fc8d51e628f4f99ee651643c9eb8369 (diff)
downloadconnector-php-fc6240c00fb8acba8700749ebb2b2e40dd85fc41.zip
connector-php-fc6240c00fb8acba8700749ebb2b2e40dd85fc41.tar.gz
connector-php-fc6240c00fb8acba8700749ebb2b2e40dd85fc41.tar.bz2
[update] better model support for codeigniter
Diffstat (limited to 'codebase')
-rw-r--r--codebase/base_connector.php10
-rw-r--r--codebase/db_common.php23
-rw-r--r--codebase/db_phpci.php2
3 files changed, 29 insertions, 6 deletions
diff --git a/codebase/base_connector.php b/codebase/base_connector.php
index 66f1f4c..f21cfc7 100644
--- a/codebase/base_connector.php
+++ b/codebase/base_connector.php
@@ -284,7 +284,7 @@ class Connector {
protected $encoding="utf-8";//!< assigned encoding (UTF-8 by default)
protected $editing=false;//!< flag of edit mode ( response for dataprocessor )
- protected $model=false;
+ public $model=false;
private $updating=false;//!< flag of update mode ( response for data-update )
private $db; //!< db connection resource
@@ -470,9 +470,11 @@ class Connector {
$wrap->store();
- if ($this->model && method_exists($this->model, "get"))
- $this->output_as_xml( call_user_func(array($this->model, "get"), $this->request));
- else
+ if ($this->model && method_exists($this->model, "get")){
+ $this->sql = new ArrayDBDataWrapper();
+ $result = new ArrayQueryWrapper(call_user_func(array($this->model, "get"), $this->request));
+ $this->output_as_xml($result);
+ } else
$this->output_as_xml($this->get_resource());
}
}
diff --git a/codebase/db_common.php b/codebase/db_common.php
index 996feda..7d738ee 100644
--- a/codebase/db_common.php
+++ b/codebase/db_common.php
@@ -924,6 +924,29 @@ abstract class DBDataWrapper extends DataWrapper{
}
}
+
+class ArrayDBDataWrapper extends DBDataWrapper{
+ public function get_next($res){
+ if ($res->index < sizeof($res->data))
+ return $res->data[$res->index++];
+ }
+ public function query($sql){
+ throw new Exception("Not implemented");
+ }
+ public function escape($value){
+ throw new Exception("Not implemented");
+ }
+ public function get_new_id(){
+ throw new Exception("Not implemented");
+ }
+}
+
+class ArrayQueryWrapper{
+ public function __construct($data){
+ $this->data = $data;
+ $this->index = 0;
+ }
+}
/*! Implementation of DataWrapper for MySQL
**/
class MySQLDBDataWrapper extends DBDataWrapper{
diff --git a/codebase/db_phpci.php b/codebase/db_phpci.php
index 288a815..3f4221b 100644
--- a/codebase/db_phpci.php
+++ b/codebase/db_phpci.php
@@ -5,8 +5,6 @@
*/
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