diff options
Diffstat (limited to 'codebase/db_common.php')
-rw-r--r-- | codebase/db_common.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/codebase/db_common.php b/codebase/db_common.php index 53f1999..76748e7 100644 --- a/codebase/db_common.php +++ b/codebase/db_common.php @@ -964,7 +964,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"); |