Make select(..., , , ) optional
This commit is contained in:
parent
e9b5616657
commit
60c8ec61e3
|
@ -105,7 +105,7 @@ if (isset($_GET["elastic"])) {
|
||||||
|
|
||||||
class Min_Driver extends Min_SQL {
|
class Min_Driver extends Min_SQL {
|
||||||
|
|
||||||
function select($table, $select, $where, $group, $order, $limit, $page, $print = false) {
|
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
|
||||||
global $adminer;
|
global $adminer;
|
||||||
$data = array();
|
$data = array();
|
||||||
$query = "$table/_search";
|
$query = "$table/_search";
|
||||||
|
|
|
@ -120,7 +120,7 @@ if (isset($_GET["mongo"])) {
|
||||||
return ($value === null ? $value : parent::quote($value));
|
return ($value === null ? $value : parent::quote($value));
|
||||||
}
|
}
|
||||||
|
|
||||||
function select($table, $select, $where, $group, $order, $limit, $page, $print = false) {
|
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
|
||||||
$select = ($select == array("*")
|
$select = ($select == array("*")
|
||||||
? array()
|
? array()
|
||||||
: array_fill_keys($select, true)
|
: array_fill_keys($select, true)
|
||||||
|
|
|
@ -150,7 +150,7 @@ if (isset($_GET["simpledb"])) {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function select($table, $select, $where, $group, $order, $limit, $page, $print = false) {
|
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
|
||||||
global $connection;
|
global $connection;
|
||||||
$connection->next = $_GET["next"];
|
$connection->next = $_GET["next"];
|
||||||
$return = parent::select($table, $select, $where, $group, $order, $limit, $page, $print);
|
$return = parent::select($table, $select, $where, $group, $order, $limit, $page, $print);
|
||||||
|
|
|
@ -89,7 +89,7 @@ if ($_POST["save"]) {
|
||||||
$select = array("*");
|
$select = array("*");
|
||||||
}
|
}
|
||||||
if ($select) {
|
if ($select) {
|
||||||
$result = $driver->select($TABLE, $select, array($where), $select, array(), (isset($_GET["select"]) ? 2 : 1), 0);
|
$result = $driver->select($TABLE, $select, array($where), $select, array(), (isset($_GET["select"]) ? 2 : 1));
|
||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
if (!$row) { // MySQLi returns null
|
if (!$row) { // MySQLi returns null
|
||||||
$row = false;
|
$row = false;
|
||||||
|
@ -102,7 +102,7 @@ if ($_POST["save"]) {
|
||||||
|
|
||||||
if (!support("table") && !$fields) {
|
if (!support("table") && !$fields) {
|
||||||
if (!$where) { // insert
|
if (!$where) { // insert
|
||||||
$result = $driver->select($TABLE, array("*"), $where, array("*"), array(), 1, 0);
|
$result = $driver->select($TABLE, array("*"), $where, array("*"));
|
||||||
$row = ($result ? $result->fetch_assoc() : false);
|
$row = ($result ? $result->fetch_assoc() : false);
|
||||||
if (!$row) {
|
if (!$row) {
|
||||||
$row = array($driver->primary => "");
|
$row = array($driver->primary => "");
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
* @param bool whether to print the query
|
* @param bool whether to print the query
|
||||||
* @return Min_Result
|
* @return Min_Result
|
||||||
*/
|
*/
|
||||||
function select($table, $select, $where, $group, $order, $limit, $page, $print = false) {
|
function select($table, $select, $where, $group, $order = array(), $limit = 1, $page = 0, $print = false) {
|
||||||
global $adminer, $jush;
|
global $adminer, $jush;
|
||||||
$is_group = (count($group) < count($select));
|
$is_group = (count($group) < count($select));
|
||||||
$query = $adminer->selectQueryBuild($select, $where, $group, $order, $limit, $page);
|
$query = $adminer->selectQueryBuild($select, $where, $group, $order, $limit, $page);
|
||||||
|
|
|
@ -41,7 +41,7 @@ if ($_GET["val"] && is_ajax()) {
|
||||||
$as = convert_field($fields[key($row)]);
|
$as = convert_field($fields[key($row)]);
|
||||||
$select = array($as ? $as : idf_escape(key($row)));
|
$select = array($as ? $as : idf_escape(key($row)));
|
||||||
$where[] = where_check($unique_idf, $fields);
|
$where[] = where_check($unique_idf, $fields);
|
||||||
$return = $driver->select($TABLE, $select, $where, $select, array(), 1, 0);
|
$return = $driver->select($TABLE, $select, $where, $select);
|
||||||
if ($return) {
|
if ($return) {
|
||||||
echo reset($return->fetch_row());
|
echo reset($return->fetch_row());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue