Permalink
Browse files

Merge from master

  • Loading branch information...
vrana committed Nov 12, 2010
2 parents d8c7ea9 + af0cacb commit 9802869d0a32bf5c7d9cace3b8b9fdff2f81f070
Showing with 1,437 additions and 704 deletions.
  1. +7 −2 adminer/call.inc.php
  2. +2 −2 adminer/create.inc.php
  3. +3 −2 adminer/database.inc.php
  4. +4 −7 adminer/drivers/mssql.inc.php
  5. +7 −12 adminer/drivers/mysql.inc.php
  6. +3 −6 adminer/drivers/oracle.inc.php
  7. +5 −8 adminer/drivers/pgsql.inc.php
  8. +64 −70 adminer/drivers/sqlite.inc.php
  9. +18 −14 adminer/dump.inc.php
  10. +1 −1 adminer/edit.inc.php
  11. +2 −2 adminer/foreign.inc.php
  12. +216 −24 adminer/include/adminer.inc.php
  13. +7 −7 adminer/include/auth.inc.php
  14. +2 −2 adminer/include/bootstrap.inc.php
  15. +4 −0 adminer/include/connect.inc.php
  16. +2 −2 adminer/include/design.inc.php
  17. +15 −0 adminer/include/editing.inc.php
  18. +0 −176 adminer/include/export.inc.php
  19. +20 −11 adminer/include/functions.inc.php
  20. +1 −0 adminer/include/lang.inc.php
  21. +0 −1 adminer/include/pdo.inc.php
  22. +1 −1 adminer/include/version.inc.php
  23. +3 −2 adminer/index.php
  24. +1 −1 adminer/indexes.inc.php
  25. +268 −0 adminer/lang/ar.inc.php
  26. +16 −10 adminer/lang/ca.inc.php
  27. +214 −199 adminer/lang/cs.inc.php
  28. +7 −0 adminer/lang/de.inc.php
  29. +1 −0 adminer/lang/en.inc.php
  30. +7 −0 adminer/lang/es.inc.php
  31. +7 −0 adminer/lang/et.inc.php
  32. +7 −1 adminer/lang/hu.inc.php
  33. +7 −0 adminer/lang/nl.inc.php
  34. +279 −0 adminer/lang/pl.inc.php
  35. +7 −0 adminer/lang/ru.inc.php
  36. +7 −0 adminer/lang/sk.inc.php
  37. +6 −0 adminer/lang/ta.inc.php
  38. +14 −7 adminer/lang/zh-tw.inc.php
  39. +6 −2 adminer/processlist.inc.php
  40. +15 −17 adminer/schema.inc.php
  41. +2 −2 adminer/script.inc.php
  42. +26 −21 adminer/select.inc.php
  43. +44 −31 adminer/sql.inc.php
  44. +6 −0 adminer/static/default.css
  45. +7 −7 adminer/static/editing.js
  46. BIN adminer/static/favicon.ico
  47. +17 −3 adminer/static/functions.js
  48. +1 −1 adminer/trigger.inc.php
  49. +17 −0 changes.txt
  50. +4 −1 editor/example.php
  51. +40 −12 editor/include/adminer.inc.php
  52. +0 −23 editor/include/export.inc.php
  53. +2 −1 editor/index.php
  54. +9 −6 lang.php
  55. +2 −2 readme.txt
  56. +4 −5 todo.txt
View
@@ -57,8 +57,13 @@
$name = $field["field"];
echo "<tr><th>" . $adminer->fieldName($field);
$value = $_POST["fields"][$name];
- if ($value != "" && ereg("enum|set", $field["type"])) {
- $value = intval($value);
+ if ($value != "") {
+ if ($field["type"] == "enum") {
+ $value = +$value;
+ }
+ if ($field["type"] == "set") {
+ $value = array_sum($value);
+ }
}
input($field, $value, (string) $_POST["function"][$name]); // param name can be empty
echo "\n";
View
@@ -65,7 +65,7 @@
}
$partitioning .= "\nPARTITION BY $_POST[partition_by]($_POST[partition])" . ($partitions // $_POST["partition"] can be expression, not only column
? " (" . implode(",", $partitions) . "\n)"
- : ($_POST["partitions"] ? " PARTITIONS " . intval($_POST["partitions"]) : "")
+ : ($_POST["partitions"] ? " PARTITIONS " . (+$_POST["partitions"]) : "")
);
} elseif ($TABLE != "" && support("partitioning")) {
$partitioning .= "\nREMOVE PARTITIONING";
@@ -83,7 +83,7 @@
$_POST["Comment"],
($_POST["Engine"] && $_POST["Engine"] != $orig_status["Engine"] ? $_POST["Engine"] : ""),
($_POST["Collation"] && $_POST["Collation"] != $orig_status["Collation"] ? $_POST["Collation"] : ""),
- ($_POST["Auto_increment"] != "" ? preg_replace('~\\D+~', '', $_POST["Auto_increment"]) : ""),
+ ($_POST["Auto_increment"] != "" ? +$_POST["Auto_increment"] : ""),
$partitioning
));
}
View
@@ -57,10 +57,11 @@
<p>
<?php
echo ($_POST["add_x"] || strpos($name, "\n")
- ? '<textarea name="name" rows="10" cols="40" onkeydown="return textareaKeydown(this, event);">' . h($name) . '</textarea><br>'
- : '<input name="name" value="' . h($name) . '" maxlength="64">'
+ ? '<textarea id="name" name="name" rows="10" cols="40" onkeydown="return textareaKeydown(this, event);">' . h($name) . '</textarea><br>'
+ : '<input id="name" name="name" value="' . h($name) . '" maxlength="64">'
) . "\n" . ($collations ? html_select("collation", array("" => "(" . lang('collation') . ")") + $collations, $collate) : "");
?>
+<script type='text/javascript'>document.getElementById('name').focus();</script>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php
@@ -5,13 +5,10 @@
* @author Jakub Vrana
*/
-$possible_drivers[] = "SQLSRV";
-$possible_drivers[] = "MSSQL";
-if (extension_loaded("sqlsrv") || extension_loaded("mssql")) {
- $drivers["mssql"] = "MS SQL";
-}
+$drivers["mssql"] = "MS SQL";
if (isset($_GET["mssql"])) {
+ $possible_drivers = array("SQLSRV", "MSSQL");
define("DRIVER", "mssql");
if (extension_loaded("sqlsrv")) {
class Min_DB {
@@ -309,7 +306,7 @@ function fk_support($table_status) {
return true;
}
- function fields($table, $hidden = false) {
+ function fields($table) {
$return = array();
foreach (get_rows("SELECT c.*, t.name type, d.definition [default]
FROM sys.all_columns c
@@ -399,7 +396,7 @@ function rename_database($name, $collation) {
}
function auto_increment() {
- return " IDENTITY" . ($_POST["Auto_increment"] != "" ? "(" . preg_replace('~\\D+~', '', $_POST["Auto_increment"]) . ",1)" : "");
+ return " IDENTITY" . ($_POST["Auto_increment"] != "" ? "(" . (+$_POST["Auto_increment"]) . ",1)" : "");
}
function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
@@ -1,12 +1,8 @@
<?php
-$possible_drivers[] = "MySQLi";
-$possible_drivers[] = "MySQL";
-$possible_drivers[] = "PDO_MySQL";
-if (extension_loaded("mysqli") || extension_loaded("mysql") || extension_loaded("pdo_mysql")) {
- $drivers = array("server" => "MySQL") + $drivers;
-}
+$drivers = array("server" => "MySQL") + $drivers;
if (!defined("DRIVER")) {
+ $possible_drivers = array("MySQLi", "MySQL", "PDO_MySQL");
define("DRIVER", "server"); // server - backwards compatibility
// MySQLi supports everything, MySQL doesn't support multiple result sets, PDO_MySQL doesn't support orgtable
if (extension_loaded("mysqli")) {
@@ -164,7 +160,7 @@ function result($query, $field = 0) {
class Min_Result {
var
$num_rows, ///< @var int number of rows in the result
- $_result ///< @access private
+ $_result, $_offset = 0 ///< @access private
;
/** Constructor
@@ -193,7 +189,7 @@ function fetch_row() {
* @return object properties: name, type, orgtable, orgname, charsetnr
*/
function fetch_field() {
- $return = mysql_fetch_field($this->_result);
+ $return = mysql_fetch_field($this->_result, $this->_offset++); // offset required under certain conditions
$return->orgtable = $return->table;
$return->orgname = $return->name;
$return->charsetnr = ($return->blob ? 63 : 0);
@@ -212,7 +208,7 @@ class Min_DB extends Min_PDO {
var $extension = "PDO_MySQL";
function connect($server, $username, $password) {
- $this->dsn("mysql:host=" . str_replace(":", ";unix_socket=", preg_replace('~:([0-9])~', ';port=\\1', $server)), $username, $password);
+ $this->dsn("mysql:host=" . str_replace(":", ";unix_socket=", preg_replace('~:(\\d)~', ';port=\\1', $server)), $username, $password);
$this->query("SET NAMES utf8"); // charset in DSN is ignored
return true;
}
@@ -397,10 +393,9 @@ function fk_support($table_status) {
/** Get information about fields
* @param string
- * @param bool display hidden table columns
* @return array array($name => array("field" => , "full_type" => , "type" => , "length" => , "unsigned" => , "default" => , "null" => , "auto_increment" => , "on_update" => , "collation" => , "privileges" => , "comment" => , "primary" => ))
*/
- function fields($table, $hidden = false) {
+ function fields($table) {
$return = array();
foreach (get_rows("SHOW FULL COLUMNS FROM " . table($table)) as $row) {
preg_match('~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~', $row["Type"], $match);
@@ -820,7 +815,7 @@ function create_sql($table, $auto_increment) {
global $connection;
$return = $connection->result("SHOW CREATE TABLE " . table($table), 1);
if (!$auto_increment) {
- $return = preg_replace('~ AUTO_INCREMENT=[0-9]+~', '', $return); //! skip comments
+ $return = preg_replace('~ AUTO_INCREMENT=\\d+~', '', $return); //! skip comments
}
return $return;
}
@@ -1,11 +1,8 @@
<?php
-$possible_drivers[] = "OCI8";
-$possible_drivers[] = "PDO_OCI";
-if (extension_loaded("oci8") || extension_loaded("pdo_oci")) {
- $drivers["oracle"] = "Oracle";
-}
+$drivers["oracle"] = "Oracle";
if (isset($_GET["oracle"])) {
+ $possible_drivers = array("OCI8", "PDO_OCI");
define("DRIVER", "oracle");
if (extension_loaded("oci8")) {
class Min_DB {
@@ -206,7 +203,7 @@ function fk_support($table_status) {
return true;
}
- function fields($table, $hidden = false) {
+ function fields($table) {
$return = array();
foreach (get_rows("SELECT * FROM all_tab_columns WHERE table_name = " . q($table) . " ORDER BY column_id") as $row) {
$type = $row["DATA_TYPE"];
@@ -1,11 +1,8 @@
<?php
-$possible_drivers[] = "PgSQL";
-$possible_drivers[] = "PDO_PgSQL";
-if (extension_loaded("pgsql") || extension_loaded("pdo_pgsql")) {
- $drivers["pgsql"] = "PostgreSQL";
-}
+$drivers["pgsql"] = "PostgreSQL";
if (isset($_GET["pgsql"])) {
+ $possible_drivers = array("PgSQL", "PDO_PgSQL");
define("DRIVER", "pgsql");
if (extension_loaded("pgsql")) {
class Min_DB {
@@ -218,7 +215,7 @@ function fk_support($table_status) {
return true;
}
- function fields($table, $hidden = false) {
+ function fields($table) {
$return = array();
foreach (get_rows("SELECT a.attname AS field, format_type(a.atttypid, a.atttypmod) AS full_type, d.adsrc AS default, a.attnotnull, col_description(c.oid, a.attnum) AS comment
FROM pg_class c
@@ -228,8 +225,8 @@ function fields($table, $hidden = false) {
WHERE c.relname = " . q($table) . "
AND n.nspname = current_schema()
AND NOT a.attisdropped
-" . ($hidden ? "" : "AND a.attnum > 0") . "
-ORDER BY a.attnum < 0, a.attnum"
+AND a.attnum > 0
+ORDER BY a.attnum"
) as $row) {
//! collation, primary
ereg('(.*)(\\((.*)\\))?', $row["full_type"], $match);
Oops, something went wrong.

0 comments on commit 9802869

Please sign in to comment.