diff options
author | Kirylka <kirylanoshko@gmail.com> | 2015-03-31 17:56:47 +0300 |
---|---|---|
committer | Kirylka <kirylanoshko@gmail.com> | 2015-03-31 17:56:47 +0300 |
commit | f5f99c335707d9b11d40f1eb0f6ddb5a993fd31a (patch) | |
tree | d9c0d3532ec9f0f2fb68e31d2611282ae0642181 /codebase/DataStorage/ArrayDBDataWrapper.php | |
parent | 458f0aead573842f1df00ce2ae00334c27f66585 (diff) | |
download | connector-php-f5f99c335707d9b11d40f1eb0f6ddb5a993fd31a.zip connector-php-f5f99c335707d9b11d40f1eb0f6ddb5a993fd31a.tar.gz connector-php-f5f99c335707d9b11d40f1eb0f6ddb5a993fd31a.tar.bz2 |
Creating a new connector for yii2.
Diffstat (limited to 'codebase/DataStorage/ArrayDBDataWrapper.php')
-rw-r--r-- | codebase/DataStorage/ArrayDBDataWrapper.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/codebase/DataStorage/ArrayDBDataWrapper.php b/codebase/DataStorage/ArrayDBDataWrapper.php new file mode 100644 index 0000000..a806161 --- /dev/null +++ b/codebase/DataStorage/ArrayDBDataWrapper.php @@ -0,0 +1,50 @@ +<?php + +namespace DHTMLX\Connector\DataStorage; + +class ArrayDBDataWrapper extends DBDataWrapper +{ + public function get_next($res) + { + if ($res->index < sizeof($res->data)) + return $res->data[$res->index++]; + } + + public function select($sql) + { + if ($this->config->relation_id["db_name"] == "") { + if ($sql->get_relation() == "0" || $sql->get_relation() == "") { + return new ArrayQueryWrapper($this->connection); + } else { + return new ArrayQueryWrapper(array()); + } + } + + $relation_id = $this->config->relation_id["db_name"]; + + for ($i = 0; $i < count($this->connection); $i++) { + $item = $this->connection[$i]; + if (!isset($item[$relation_id])) continue; + if ($item[$relation_id] == $sql->get_relation()) + $result[] = $item; + + } + + return new ArrayQueryWrapper($result); + } + + 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"); + } +}
\ No newline at end of file |