summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--codebase/base_connector.php2
-rw-r--r--codebase/db_common.php20
2 files changed, 20 insertions, 2 deletions
diff --git a/codebase/base_connector.php b/codebase/base_connector.php
index 2f5c5ca..ab11cb5 100644
--- a/codebase/base_connector.php
+++ b/codebase/base_connector.php
@@ -445,7 +445,7 @@ class Connector {
public function render_array($data, $id, $fields, $extra=false, $relation_id=false){
$this->configure("-",$id,$fields,$extra,$relation_id);
- $this->sql = new ArrayDBDataWrapper($data, null);
+ $this->sql = new ArrayDBDataWrapper($data, $this->config);
return $this->render();
}
diff --git a/codebase/db_common.php b/codebase/db_common.php
index 8929631..19365f3 100644
--- a/codebase/db_common.php
+++ b/codebase/db_common.php
@@ -962,7 +962,25 @@ class ArrayDBDataWrapper extends DBDataWrapper{
return $res->data[$res->index++];
}
public function select($sql){
- return new ArrayQueryWrapper($this->connection);
+ 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");