if (function_exists('json_decode') && ini_bool('allow_url_fopen')) {
class Min_DB {
- var $extension = "JSON", $server_info, $errno, $error, $_url;
+ var $extension = "JSON", $server_info, $errno, $error, $_url, $_db;
/** Performs query
* @param string
function tables_list() {
global $connection;
+
+ if (min_version(6)) {
+ return array('_doc' => 'table');
+ }
+
$return = $connection->query('_mapping');
if ($return) {
$return = array_fill_keys(array_keys($return[$connection->_db]["mappings"]), 'table');
function fields($table) {
global $connection;
- $result = $connection->query("$table/_mapping");
- $return = array();
- if ($result) {
- $mappings = $result[$table]['properties'];
- if (!$mappings) {
- $mappings = $result[$connection->_db]['mappings'][$table]['properties'];
+
+ $mappings = array();
+ if (min_version(6)) {
+ $result = $connection->query("_mapping");
+ if ($result) {
+ $mappings = $result[$connection->_db]['mappings']['properties'];
}
- if ($mappings) {
- foreach ($mappings as $name => $field) {
- $return[$name] = array(
- "field" => $name,
- "full_type" => $field["type"],
- "type" => $field["type"],
- "privileges" => array("insert" => 1, "select" => 1, "update" => 1),
- );
- if ($field["properties"]) { // only leaf fields can be edited
- unset($return[$name]["privileges"]["insert"]);
- unset($return[$name]["privileges"]["update"]);
- }
+ } else {
+ $result = $connection->query("$table/_mapping");
+ if ($result) {
+ $mappings = $result[$table]['properties'];
+ if (!$mappings) {
+ $mappings = $result[$connection->_db]['mappings'][$table]['properties'];
+ }
+ }
+ }
+
+ $return = array();
+ if ($mappings) {
+ foreach ($mappings as $name => $field) {
+ $return[$name] = array(
+ "field" => $name,
+ "full_type" => $field["type"],
+ "type" => $field["type"],
+ "privileges" => array("insert" => 1, "select" => 1, "update" => 1),
+ );
+ if ($field["properties"]) { // only leaf fields can be edited
+ unset($return[$name]["privileges"]["insert"]);
+ unset($return[$name]["privileges"]["update"]);
}
}
}
PostgreSQL 11: Create PRIMARY KEY for auto increment columns
SQLite: Set busy_timeout to 500
MS SQL: Don't truncate comments to 30 chars (PR #376)
+Elasticsearch 6: Fix displaying type mapping (PR #402)
MongoDB: Fix password-less check in the mongo extension (PR #405)
Editor: Cast to string when searching (bug #325)
Re-enable PHP warnings (regression from 4.7.8)