echo " <input type='submit' name='search' value='" . lang('Search') . "'>\n";
echo "</div></fieldset>\n";
if ($_POST["search"] && $_POST["query"] != "") {
- $_GET["where"][0]["op"] = "LIKE %%";
+ $_GET["where"][0]["op"] = $driver->convertOperator("LIKE %%");
search_tables();
}
}
* @return mixed
*/
function query($path, $content = array(), $method = 'GET') {
+ // Support for global search through all tables
+ if ($path != "" && $path[0] == "S" && preg_match('/SELECT 1 FROM ([^ ]+) WHERE (.+) LIMIT ([0-9]+)/', $path, $matches)) {
+ global $driver;
+
+ $where = explode(" AND ", $matches[2]);
+
+ return $driver->select($matches[1], array("*"), $where, null, array(), $matches[3]);
+ }
return $this->rootQuery(($this->_db != "" ? "$this->_db/" : "/") . ltrim($path, '/'), $content, $method);
}
}
function fetch_row() {
- return array_values($this->fetch_assoc());
+ $row = $this->fetch_assoc();
+
+ return $row ? array_values($row) : false;
}
}
}
return $this->_conn->affected_rows;
}
+
+ function convertOperator($operator) {
+ return $operator == "LIKE %%" ? "should" : $operator;
+ }
}
return $return;
}
+ function limit($query, $where, $limit, $offset = 0, $separator = " ") {
+ return " $query$where" . ($limit !== null ? $separator . "LIMIT $limit" . ($offset ? " OFFSET $offset" : "") : "");
+ }
+
function collations() {
return array();
}
return $idf;
}
+ /** Convert operator so it can be used in search
+ * @param string $operator
+ * @return string
+ */
+ function convertOperator($operator) {
+ return $operator;
+ }
+
/** Convert value returned by database to actual value
* @param string
* @param array