adminer-svn Mailing List for Adminer (Page 3)
Database management in a single PHP file
Brought to you by:
jakubvrana
You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(83) |
Sep
(104) |
Oct
(66) |
Nov
(36) |
Dec
(26) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(16) |
Feb
(35) |
Mar
(19) |
Apr
(155) |
May
(14) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2011 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <jak...@us...> - 2010-04-22 19:43:42
|
Revision: 1479
http://adminer.svn.sourceforge.net/adminer/?rev=1479&view=rev
Author: jakubvrana
Date: 2010-04-22 19:43:36 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
Detect trigger type
Modified Paths:
--------------
trunk/adminer/drivers/pgsql.inc.php
Modified: trunk/adminer/drivers/pgsql.inc.php
===================================================================
--- trunk/adminer/drivers/pgsql.inc.php 2010-04-22 15:53:42 UTC (rev 1478)
+++ trunk/adminer/drivers/pgsql.inc.php 2010-04-22 19:43:36 UTC (rev 1479)
@@ -397,7 +397,7 @@
function trigger($name) {
global $connection;
- $result = $connection->query('SELECT trigger_name AS "Trigger", condition_timing AS "Timing", event_manipulation AS "Event", action_statement AS "Statement" FROM information_schema.triggers WHERE event_object_table = ' . $connection->quote($_GET["trigger"]) . ' AND trigger_name = ' . $connection->quote($name)); //! detect Type
+ $result = $connection->query('SELECT trigger_name AS "Trigger", condition_timing AS "Timing", event_manipulation AS "Event", \'FOR EACH \' || action_orientation AS "Type", action_statement AS "Statement" FROM information_schema.triggers WHERE event_object_table = ' . $connection->quote($_GET["trigger"]) . ' AND trigger_name = ' . $connection->quote($name));
return $result->fetch_assoc();
}
@@ -414,7 +414,7 @@
function trigger_options() {
return array(
"Timing" => array("BEFORE", "AFTER"),
- "Type" => array("FOR EACH STATEMENT", "FOR EACH ROW"),
+ "Type" => array("FOR EACH ROW", "FOR EACH STATEMENT"),
);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-22 15:53:48
|
Revision: 1478
http://adminer.svn.sourceforge.net/adminer/?rev=1478&view=rev
Author: jakubvrana
Date: 2010-04-22 15:53:42 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
Driver specific trigger options
Modified Paths:
--------------
trunk/adminer/drivers/mssql.inc.php
trunk/adminer/drivers/mysql.inc.php
trunk/adminer/drivers/pgsql.inc.php
trunk/adminer/drivers/sqlite.inc.php
trunk/adminer/trigger.inc.php
Modified: trunk/adminer/drivers/mssql.inc.php
===================================================================
--- trunk/adminer/drivers/mssql.inc.php 2010-04-22 14:38:05 UTC (rev 1477)
+++ trunk/adminer/drivers/mssql.inc.php 2010-04-22 15:53:42 UTC (rev 1478)
@@ -412,12 +412,14 @@
$result = $connection->query("SELECT s.name [Trigger],
CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(s.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(s.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event],
CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing],
-c.text [Statement]
+c.text
FROM sysobjects s
JOIN syscomments c ON s.id = c.id
WHERE s.xtype = 'TR' AND s.name = " . $connection->quote($name)
);
- return $result->fetch_assoc();
+ $row = $result->fetch_assoc();
+ $row["Statement"] = preg_replace('~^.+\\s+AS\\s+~isU', '', $row["text"]); //! identifiers, comments
+ return $row;
}
function triggers($table) {
@@ -436,6 +438,13 @@
return $return;
}
+ function trigger_options() {
+ return array(
+ "Timing" => array("AFTER", "INSTEAD OF"),
+ "Type" => array("AS"),
+ );
+ }
+
function support($feature) {
return ereg('^(view|routine|trigger)$', $feature);
}
Modified: trunk/adminer/drivers/mysql.inc.php
===================================================================
--- trunk/adminer/drivers/mysql.inc.php 2010-04-22 14:38:05 UTC (rev 1477)
+++ trunk/adminer/drivers/mysql.inc.php 2010-04-22 15:53:42 UTC (rev 1478)
@@ -454,7 +454,7 @@
*/
function view($name) {
global $connection;
- return array("select" => preg_replace('~^(?:[^`]|`[^`]*`)* AS ~U', '', $connection->result("SHOW CREATE VIEW " . idf_escape($name), 1)));
+ return array("select" => preg_replace('~^(?:[^`]|`[^`]*`)*\\s+AS\\s+~isU', '', $connection->result("SHOW CREATE VIEW " . idf_escape($name), 1)));
}
/** Get sorted grouped list of collations
@@ -648,6 +648,14 @@
return $return;
}
+ function trigger_options() {
+ return array(
+ "Timing" => array("BEFORE", "AFTER"),
+ // Event is always INSERT, UPDATE, DELETE
+ "Type" => array("FOR EACH ROW"),
+ );
+ }
+
/** Explain select
* @param Min_DB
* @param string
Modified: trunk/adminer/drivers/pgsql.inc.php
===================================================================
--- trunk/adminer/drivers/pgsql.inc.php 2010-04-22 14:38:05 UTC (rev 1477)
+++ trunk/adminer/drivers/pgsql.inc.php 2010-04-22 15:53:42 UTC (rev 1478)
@@ -397,7 +397,7 @@
function trigger($name) {
global $connection;
- $result = $connection->query('SELECT trigger_name AS "Trigger", condition_timing AS "Timing", event_manipulation AS "Event", action_statement AS "Statement" FROM information_schema.triggers WHERE event_object_table = ' . $connection->quote($_GET["trigger"]) . ' AND trigger_name = ' . $connection->quote($name));
+ $result = $connection->query('SELECT trigger_name AS "Trigger", condition_timing AS "Timing", event_manipulation AS "Event", action_statement AS "Statement" FROM information_schema.triggers WHERE event_object_table = ' . $connection->quote($_GET["trigger"]) . ' AND trigger_name = ' . $connection->quote($name)); //! detect Type
return $result->fetch_assoc();
}
@@ -411,6 +411,13 @@
return $return;
}
+ function trigger_options() {
+ return array(
+ "Timing" => array("BEFORE", "AFTER"),
+ "Type" => array("FOR EACH STATEMENT", "FOR EACH ROW"),
+ );
+ }
+
function explain($connection, $query) {
return $connection->query("EXPLAIN $query");
}
Modified: trunk/adminer/drivers/sqlite.inc.php
===================================================================
--- trunk/adminer/drivers/sqlite.inc.php 2010-04-22 14:38:05 UTC (rev 1477)
+++ trunk/adminer/drivers/sqlite.inc.php 2010-04-22 15:53:42 UTC (rev 1478)
@@ -453,6 +453,13 @@
return $return;
}
+ function trigger_options() {
+ return array(
+ "Timing" => array("BEFORE", "AFTER", "INSTEAD OF"),
+ "Type" => array("FOR EACH ROW"),
+ );
+ }
+
function explain($connection, $query) {
return $connection->query("EXPLAIN $query");
}
Modified: trunk/adminer/trigger.inc.php
===================================================================
--- trunk/adminer/trigger.inc.php 2010-04-22 14:38:05 UTC (rev 1477)
+++ trunk/adminer/trigger.inc.php 2010-04-22 15:53:42 UTC (rev 1478)
@@ -1,13 +1,15 @@
<?php
$TABLE = $_GET["trigger"];
-$trigger_time = array("BEFORE", "AFTER");
+$trigger_options = trigger_options();
$trigger_event = array("INSERT", "UPDATE", "DELETE");
$dropped = false;
-if ($_POST && !$error && in_array($_POST["Timing"], $trigger_time) && in_array($_POST["Event"], $trigger_event)) {
+if ($_POST && !$error && in_array($_POST["Timing"], $trigger_options["Timing"]) && in_array($_POST["Event"], $trigger_event) && in_array($_POST["Type"], $trigger_options["Type"])) {
+ $timing_event = " $_POST[Timing] $_POST[Event]";
+ $on = " ON " . idf_escape($TABLE);
$dropped = drop_create(
"DROP TRIGGER " . idf_escape($_GET["name"]) . ($driver == "pgsql" ? " ON " . idf_escape($TABLE) : ""),
- "CREATE TRIGGER " . idf_escape($_POST["Trigger"]) . " $_POST[Timing] $_POST[Event] ON " . idf_escape($TABLE) . " FOR EACH ROW\n$_POST[Statement]", //! FOR EACH STATEMENT
+ "CREATE TRIGGER " . idf_escape($_POST["Trigger"]) . ($driver == "mssql" ? $on . $timing_event : $timing_event . $on) . " $_POST[Type]\n$_POST[Statement]",
ME . "table=" . urlencode($TABLE),
lang('Trigger has been dropped.'),
lang('Trigger has been altered.'),
@@ -28,14 +30,15 @@
<form action="" method="post" id="form">
<table cellspacing="0">
-<tr><th><?php echo lang('Time'); ?><td><?php echo html_select("Timing", $trigger_time, $row["Timing"], "if (/^" . h(preg_quote($TABLE, "/")) . "_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '" . h(addcslashes($TABLE, "\r\n'\\")) . "_' + selectValue(this).charAt(0).toLowerCase() + selectValue(this.form['Event']).charAt(0).toLowerCase();"); ?>
+<tr><th><?php echo lang('Time'); ?><td><?php echo html_select("Timing", $trigger_options["Timing"], $row["Timing"], "if (/^" . h(preg_quote($TABLE, "/")) . "_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '" . h(addcslashes($TABLE, "\r\n'\\")) . "_' + selectValue(this).charAt(0).toLowerCase() + selectValue(this.form['Event']).charAt(0).toLowerCase();"); ?>
<tr><th><?php echo lang('Event'); ?><td><?php echo html_select("Event", $trigger_event, $row["Event"], "this.form['Timing'].onchange();"); ?>
-<tr><th><?php echo lang('Name'); ?><td><input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64">
+<tr><th><?php echo lang('Type'); ?><td><?php echo html_select("Type", $trigger_options["Type"], $row["Type"]); ?>
</table>
<p><textarea name="Statement" rows="10" cols="80" style="width: 98%;"><?php echo h($row["Statement"]); ?></textarea>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<?php if ($dropped) { ?><input type="hidden" name="dropped" value="1"><?php } ?>
+<?php echo lang('Name'); ?>: <input name="Trigger" value="<?php echo h($row["Trigger"]); ?>" maxlength="64">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php if ($_GET["name"] != "") { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?>
</form>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-22 14:38:11
|
Revision: 1477
http://adminer.svn.sourceforge.net/adminer/?rev=1477&view=rev
Author: jakubvrana
Date: 2010-04-22 14:38:05 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
MS SQL triggers and foreign keys (thanks to Jakub Cernohuby)
Modified Paths:
--------------
trunk/adminer/drivers/mssql.inc.php
Modified: trunk/adminer/drivers/mssql.inc.php
===================================================================
--- trunk/adminer/drivers/mssql.inc.php 2010-04-22 12:37:56 UTC (rev 1476)
+++ trunk/adminer/drivers/mssql.inc.php 2010-04-22 14:38:05 UTC (rev 1477)
@@ -325,10 +325,12 @@
FROM sys.indexes
INNER JOIN sys.index_columns ON indexes.object_id = index_columns.object_id AND indexes.index_id = index_columns.index_id
INNER JOIN sys.columns ON index_columns.object_id = columns.object_id AND index_columns.column_id = columns.column_id
-WHERE OBJECT_NAME(indexes.object_id) = " . $connection2->quote($table));
+WHERE OBJECT_NAME(indexes.object_id) = " . $connection2->quote($table)
+ );
if ($result) {
while ($row = $result->fetch_assoc()) {
$return[$row["name"]]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX"));
+ $return[$row["name"]]["lengths"] = array();
$return[$row["name"]]["columns"][$row["key_ordinal"]] = $row["column_name"];
}
}
@@ -349,7 +351,7 @@
function error() {
global $connection;
- return nl_br(h(ereg_replace("^(\\[[^]]*])+", "", $connection->error)));
+ return nl_br(h(preg_replace('~^(\\[[^]]*])+~m', '', $connection->error)));
}
function exact_value($val) {
@@ -375,6 +377,65 @@
return $return;
}
+ function foreign_keys($table) {
+ global $connection;
+ $result = $connection->query("EXEC sp_fkeys @fktable_name = " . $connection->quote($table));
+ $return = array();
+ while ($row = $result->fetch_assoc()) {
+ $foreign_key = &$return[$row["FK_NAME"]];
+ $foreign_key["table"] = $row["PKTABLE_NAME"];
+ $foreign_key["source"][] = $row["FKCOLUMN_NAME"];
+ $foreign_key["target"][] = $row["PKCOLUMN_NAME"];
+ }
+ return $return;
+ }
+
+ function truncate_tables($tables) {
+ foreach ($tables as $table) {
+ if (!queries("TRUNCATE TABLE " . idf_escape($table))) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ function drop_views($views) {
+ return queries("DROP VIEW " . implode(", ", array_map('idf_escape', $views)));
+ }
+
+ function drop_tables($tables) {
+ return queries("DROP TABLE " . implode(", ", array_map('idf_escape', $tables)));
+ }
+
+ function trigger($name) {
+ global $connection;
+ $result = $connection->query("SELECT s.name [Trigger],
+CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(s.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(s.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event],
+CASE WHEN OBJECTPROPERTY(s.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing],
+c.text [Statement]
+FROM sysobjects s
+JOIN syscomments c ON s.id = c.id
+WHERE s.xtype = 'TR' AND s.name = " . $connection->quote($name)
+ );
+ return $result->fetch_assoc();
+ }
+
+ function triggers($table) {
+ global $connection;
+ $return = array();
+ $result = $connection->query("SELECT sys1.name,
+CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsertTrigger') = 1 THEN 'INSERT' WHEN OBJECTPROPERTY(sys1.id, 'ExecIsUpdateTrigger') = 1 THEN 'UPDATE' WHEN OBJECTPROPERTY(sys1.id, 'ExecIsDeleteTrigger') = 1 THEN 'DELETE' END [Event],
+CASE WHEN OBJECTPROPERTY(sys1.id, 'ExecIsInsteadOfTrigger') = 1 THEN 'INSTEAD OF' ELSE 'AFTER' END [Timing]
+FROM sysobjects sys1
+JOIN sysobjects sys2 ON sys1.parent_obj = sys2.id
+WHERE sys1.xtype = 'TR' AND sys2.name = " . $connection->quote($table)
+ );
+ while ($row = $result->fetch_assoc()) {
+ $return[$row["name"]] = array($row["Timing"], $row["Event"]);
+ }
+ return $return;
+ }
+
function support($feature) {
return ereg('^(view|routine|trigger)$', $feature);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-22 13:21:11
|
Revision: 1475
http://adminer.svn.sourceforge.net/adminer/?rev=1475&view=rev
Author: jakubvrana
Date: 2010-04-22 12:19:22 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
Init with null
Modified Paths:
--------------
trunk/adminer/edit.inc.php
trunk/adminer/select.inc.php
Modified: trunk/adminer/edit.inc.php
===================================================================
--- trunk/adminer/edit.inc.php 2010-04-22 09:22:19 UTC (rev 1474)
+++ trunk/adminer/edit.inc.php 2010-04-22 12:19:22 UTC (rev 1475)
@@ -44,7 +44,7 @@
$table_name
);
-unset($row);
+$row = null;
if ($_POST["save"]) {
$row = (array) $_POST["fields"];
} elseif ($where) {
@@ -59,7 +59,7 @@
$result = $connection->query("SELECT" . limit(implode(", ", $select) . " FROM " . idf_escape($TABLE) . " WHERE $where", (isset($_GET["select"]) ? 2 : 1)));
$row = $result->fetch_assoc();
if (isset($_GET["select"]) && $result->fetch_assoc()) {
- $row = false;
+ $row = null;
}
}
}
@@ -68,7 +68,6 @@
<form action="" method="post" enctype="multipart/form-data">
<?php
if ($fields) {
- unset($create);
echo "<table cellspacing='0'>\n";
foreach ($fields as $name => $field) {
echo "<tr><th>" . $adminer->fieldName($field);
Modified: trunk/adminer/select.inc.php
===================================================================
--- trunk/adminer/select.inc.php 2010-04-22 09:22:19 UTC (rev 1474)
+++ trunk/adminer/select.inc.php 2010-04-22 12:19:22 UTC (rev 1475)
@@ -7,7 +7,7 @@
$rights = array(); // privilege => 0
$columns = array(); // selectable columns
-unset($text_length);
+$text_length = null;
foreach ($fields as $key => $field) {
$name = $adminer->fieldName($field);
if (isset($field["privileges"]["select"]) && $name != "") {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-22 12:38:03
|
Revision: 1476
http://adminer.svn.sourceforge.net/adminer/?rev=1476&view=rev
Author: jakubvrana
Date: 2010-04-22 12:37:56 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
Don't redirect from last page
Modified Paths:
--------------
trunk/adminer/include/functions.inc.php
trunk/adminer/select.inc.php
Modified: trunk/adminer/include/functions.inc.php
===================================================================
--- trunk/adminer/include/functions.inc.php 2010-04-22 12:19:22 UTC (rev 1475)
+++ trunk/adminer/include/functions.inc.php 2010-04-22 12:37:56 UTC (rev 1476)
@@ -348,8 +348,8 @@
* @param int
* @return string
*/
-function pagination($page) {
- return " " . ($page == $_GET["page"] ? $page + 1 : '<a href="' . h(remove_from_uri("page") . ($page ? "&page=$page" : "")) . '">' . ($page + 1) . "</a>");
+function pagination($page, $current) {
+ return " " . ($page == $current ? $page + 1 : '<a href="' . h(remove_from_uri("page") . ($page ? "&page=$page" : "")) . '">' . ($page + 1) . "</a>");
}
/** Get file contents from $_FILES
Modified: trunk/adminer/select.inc.php
===================================================================
--- trunk/adminer/select.inc.php 2010-04-22 12:19:22 UTC (rev 1475)
+++ trunk/adminer/select.inc.php 2010-04-22 12:37:56 UTC (rev 1476)
@@ -26,12 +26,6 @@
$from = ($select ? implode(", ", $select) : "*") . "\nFROM " . idf_escape($TABLE) . ($where ? "\nWHERE " . implode(" AND ", $where) : "");
$group_by = ($group && count($group) < count($select) ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : "");
-if ($_GET["page"] == "last") {
- session_write_close();
- $found_rows = $connection->result("SELECT COUNT(*) FROM " . idf_escape($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : ""));
- redirect(remove_from_uri("page") . ($found_rows > $limit ? "&page=" . floor(($found_rows - 1) / $limit) : ""));
-}
-
if ($_POST && !$error) {
$where_check = "(" . implode(") OR (", array_map('where_check', (array) $_POST["check"])) . ")";
$primary = ($indexes["PRIMARY"] ? ($select ? array_flip($indexes["PRIMARY"]["columns"]) : array()) : null); // empty array means that all primary fields are selected
@@ -181,7 +175,14 @@
$adminer->selectActionPrint($text_length);
echo "</form>\n";
- $query = "SELECT" . limit((intval($limit) && $group && count($group) < count($select) && $driver == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from . $group_by, ($limit != "" ? intval($limit) : null), ($_GET["page"] ? $limit * $_GET["page"] : 0));
+ $page = $_GET["page"];
+ if ($page == "last") {
+ session_write_close();
+ $found_rows = $connection->result("SELECT COUNT(*) FROM " . idf_escape($TABLE) . ($where ? " WHERE " . implode(" AND ", $where) : ""));
+ $page = floor(($found_rows - 1) / $limit);
+ }
+
+ $query = "SELECT" . limit((intval($limit) && $group && count($group) < count($select) && $driver == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . $from . $group_by, ($limit != "" ? intval($limit) : null), ($page ? $limit * $page : 0));
echo $adminer->selectQuery($query);
$result = $connection->query($query);
@@ -293,11 +294,11 @@
parse_str($_COOKIE["adminer_export"], $adminer_export);
- if ($rows || $_GET["page"]) {
+ if ($rows || $page) {
$exact_count = true;
- if (intval($limit) && count($group) >= count($select) && ($found_rows >= $limit || $_GET["page"])) {
+ if (intval($limit) && count($group) >= count($select) && ($found_rows >= $limit || $page)) {
$found_rows = $table_status["Rows"];
- if (!isset($found_rows) || $where || $_GET["page"] * $limit * 2 > $found_rows || ($table_status["Engine"] == "InnoDB" && $found_rows < 1e5)) {
+ if (!isset($found_rows) || $where || 2 * $page * $limit > $found_rows || ($table_status["Engine"] == "InnoDB" && $found_rows < 1e4)) {
// slow with big tables
ob_flush();
flush();
@@ -308,13 +309,13 @@
}
echo "<p class='pages'>";
if (intval($limit) && $found_rows > $limit) {
- // display first, previous 5, next 5 and last page
+ // display first, previous 4, next 4 and last page
$max_page = floor(($found_rows - 1) / $limit);
- echo lang('Page') . ":" . pagination(0) . ($_GET["page"] > 5 ? " ..." : "");
- for ($i = max(1, $_GET["page"] - 2); $i < min($max_page, $_GET["page"] + 5); $i++) {
- echo pagination($i);
+ echo lang('Page') . ":" . pagination(0, $page) . ($page > 5 ? " ..." : "");
+ for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
+ echo pagination($i, $page);
}
- echo ($_GET["page"] + 5 < $max_page ? " ..." : "") . ($exact_count ? pagination($max_page) : ' <a href="' . h(remove_from_uri() . "&page=last") . '">' . lang('last') . "</a>");
+ echo ($page + 5 < $max_page ? " ..." : "") . ($exact_count ? pagination($max_page, $page) : ' <a href="' . h(remove_from_uri() . "&page=last") . '">' . lang('last') . "</a>");
}
echo " (" . ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) . ") " . checkbox("all", 1, 0, lang('whole result')) . "\n";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-22 09:22:25
|
Revision: 1474
http://adminer.svn.sourceforge.net/adminer/?rev=1474&view=rev
Author: jakubvrana
Date: 2010-04-22 09:22:19 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
Bold table names in message (bug #2990383)
Modified Paths:
--------------
trunk/adminer/db.inc.php
Modified: trunk/adminer/db.inc.php
===================================================================
--- trunk/adminer/db.inc.php 2010-04-22 00:33:46 UTC (rev 1473)
+++ trunk/adminer/db.inc.php 2010-04-22 09:22:19 UTC (rev 1474)
@@ -30,7 +30,7 @@
$message = lang('Tables have been dropped.');
} elseif ($_POST["tables"] && ($result = queries(($_POST["optimize"] ? "OPTIMIZE" : ($_POST["check"] ? "CHECK" : ($_POST["repair"] ? "REPAIR" : "ANALYZE"))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"]))))) {
while ($row = $result->fetch_assoc()) {
- $message .= h("$row[Table]: $row[Msg_text]") . "<br>";
+ $message .= "<b>" . h($row["Table"]) . "</b>: " . h($row["Msg_text"]) . "<br>";
}
}
queries_redirect(substr(ME, 0, -1), $message, $result);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-22 00:33:52
|
Revision: 1473
http://adminer.svn.sourceforge.net/adminer/?rev=1473&view=rev
Author: jakubvrana
Date: 2010-04-22 00:33:46 +0000 (Thu, 22 Apr 2010)
Log Message:
-----------
Fix input onchange
Modified Paths:
--------------
trunk/adminer/include/adminer.inc.php
Modified: trunk/adminer/include/adminer.inc.php
===================================================================
--- trunk/adminer/include/adminer.inc.php 2010-04-21 23:06:32 UTC (rev 1472)
+++ trunk/adminer/include/adminer.inc.php 2010-04-22 00:33:46 UTC (rev 1473)
@@ -396,7 +396,7 @@
*/
function editFunctions($field) {
global $edit_functions;
- $return = ($field["null"] ? "/NULL" : "");
+ $return = ($field["null"] ? "NULL/" : "");
foreach ($edit_functions as $key => $functions) {
if (!$key || (!isset($_GET["call"]) && (isset($_GET["select"]) || where($_GET)))) { // relative functions
foreach ($functions as $pattern => $val) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 23:06:38
|
Revision: 1472
http://adminer.svn.sourceforge.net/adminer/?rev=1472&view=rev
Author: jakubvrana
Date: 2010-04-21 23:06:32 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Display SQLite compile options
Modified Paths:
--------------
trunk/adminer/drivers/sqlite.inc.php
trunk/adminer/include/functions.inc.php
trunk/adminer/variables.inc.php
Modified: trunk/adminer/drivers/sqlite.inc.php
===================================================================
--- trunk/adminer/drivers/sqlite.inc.php 2010-04-21 22:37:16 UTC (rev 1471)
+++ trunk/adminer/drivers/sqlite.inc.php 2010-04-21 23:06:32 UTC (rev 1472)
@@ -470,18 +470,23 @@
function show_variables() {
global $connection;
$return = array();
- foreach (array("auto_vacuum", "cache_size", "count_changes", "default_cache_size", "empty_result_callbacks", "encoding", "foreign_keys", "full_column_names", "fullfsync", "journal_mode", "journal_size_limit", "legacy_file_format", "locking_mode", "page_size", "max_page_count", "read_uncommitted", "recursive_triggers", "reverse_unordered_selects", "secure_delete", "short_column_names", "synchronous", "temp_store", "temp_store_directory", "schema_version", "compile_options", "integrity_check", "quick_check") as $key) {
+ foreach (array("auto_vacuum", "cache_size", "count_changes", "default_cache_size", "empty_result_callbacks", "encoding", "foreign_keys", "full_column_names", "fullfsync", "journal_mode", "journal_size_limit", "legacy_file_format", "locking_mode", "page_size", "max_page_count", "read_uncommitted", "recursive_triggers", "reverse_unordered_selects", "secure_delete", "short_column_names", "synchronous", "temp_store", "temp_store_directory", "schema_version", "integrity_check", "quick_check") as $key) {
$return[$key] = $connection->result("PRAGMA $key");
}
return $return;
}
function show_status() {
- // not supported
+ $return = array();
+ foreach (get_vals("PRAGMA compile_options") as $option) {
+ list($key, $val) = explode("=", $option, 2);
+ $return[$key] = $val;
+ }
+ return $return;
}
function support($feature) {
- return ereg('^(view|trigger|variables)$', $feature);
+ return ereg('^(view|trigger|variables|status)$', $feature);
}
$driver = "sqlite";
Modified: trunk/adminer/include/functions.inc.php
===================================================================
--- trunk/adminer/include/functions.inc.php 2010-04-21 22:37:16 UTC (rev 1471)
+++ trunk/adminer/include/functions.inc.php 2010-04-21 23:06:32 UTC (rev 1472)
@@ -134,7 +134,7 @@
global $connection;
$return = array();
$result = $connection->query($query);
- if ($result) {
+ if (is_object($result)) {
while ($row = $result->fetch_row()) {
$return[] = $row[$column];
}
Modified: trunk/adminer/variables.inc.php
===================================================================
--- trunk/adminer/variables.inc.php 2010-04-21 22:37:16 UTC (rev 1471)
+++ trunk/adminer/variables.inc.php 2010-04-21 23:06:32 UTC (rev 1472)
@@ -2,10 +2,15 @@
$status = isset($_GET["status"]);
page_header($status ? lang('Status') : lang('Variables'));
-echo "<table cellspacing='0'>\n";
-foreach (($status ? show_status() : show_variables()) as $key => $val) {
- echo "<tr>";
- echo "<th><code class='jush-" . $driver . ($status ? "status" : "set") . "'>" . h($key) . "</code>";
- echo "<td>" . nbsp($val);
+$variables = ($status ? show_status() : show_variables());
+if (!$variables) {
+ echo "<p class='message'>" . lang('No rows.') . "\n";
+} else {
+ echo "<table cellspacing='0'>\n";
+ foreach ($variables as $key => $val) {
+ echo "<tr>";
+ echo "<th><code class='jush-" . $driver . ($status ? "status" : "set") . "'>" . h($key) . "</code>";
+ echo "<td>" . nbsp($val);
+ }
+ echo "</table>\n";
}
-echo "</table>\n";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 22:37:22
|
Revision: 1471
http://adminer.svn.sourceforge.net/adminer/?rev=1471&view=rev
Author: jakubvrana
Date: 2010-04-21 22:37:16 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Driver specific USE
Modified Paths:
--------------
trunk/adminer/drivers/mysql.inc.php
trunk/adminer/drivers/pgsql.inc.php
trunk/adminer/drivers/sqlite.inc.php
trunk/adminer/dump.inc.php
Modified: trunk/adminer/drivers/mysql.inc.php
===================================================================
--- trunk/adminer/drivers/mysql.inc.php 2010-04-21 22:22:23 UTC (rev 1470)
+++ trunk/adminer/drivers/mysql.inc.php 2010-04-21 22:37:16 UTC (rev 1471)
@@ -666,10 +666,24 @@
return $connection->result("SHOW CREATE TABLE " . idf_escape($table), 1);
}
+ /** Get SQL command to change database
+ * @param string
+ * @return string
+ */
+ function use_sql($database) {
+ return "USE " . idf_escape($database);
+ }
+
+ /** Get server variables
+ * @return array ($name => $value)
+ */
function show_variables() {
return get_key_vals("SHOW VARIABLES");
}
+ /** Get status variables
+ * @return array ($name => $value)
+ */
function show_status() {
return get_key_vals("SHOW STATUS");
}
Modified: trunk/adminer/drivers/pgsql.inc.php
===================================================================
--- trunk/adminer/drivers/pgsql.inc.php 2010-04-21 22:22:23 UTC (rev 1470)
+++ trunk/adminer/drivers/pgsql.inc.php 2010-04-21 22:37:16 UTC (rev 1471)
@@ -415,6 +415,10 @@
return $connection->query("EXPLAIN $query");
}
+ function use_sql($database) {
+ return "\connect " . idf_escape($database);
+ }
+
function support($feature) {
return ereg('^(comment|view|routine|trigger)$', $feature);
}
Modified: trunk/adminer/drivers/sqlite.inc.php
===================================================================
--- trunk/adminer/drivers/sqlite.inc.php 2010-04-21 22:22:23 UTC (rev 1470)
+++ trunk/adminer/drivers/sqlite.inc.php 2010-04-21 22:37:16 UTC (rev 1471)
@@ -462,6 +462,11 @@
return $connection->result("SELECT sql FROM sqlite_master WHERE name = " . $connection->quote($table));
}
+ function use_sql($database) {
+ global $connection;
+ return "ATTACH " . $connection->quote($database) . " AS " . idf_escape($database);
+ }
+
function show_variables() {
global $connection;
$return = array();
Modified: trunk/adminer/dump.inc.php
===================================================================
--- trunk/adminer/dump.inc.php 2010-04-21 22:22:23 UTC (rev 1470)
+++ trunk/adminer/dump.inc.php 2010-04-21 22:37:16 UTC (rev 1471)
@@ -37,7 +37,7 @@
}
if ($_POST["format"] == "sql") {
if ($style) {
- echo "USE " . idf_escape($db) . ";\n\n";
+ echo use_sql($db) . ";\n\n";
}
if (in_array("CREATE+ALTER", array($style, $_POST["table_style"]))) {
echo "SET @adminer_alter = '';\n\n";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 22:22:29
|
Revision: 1470
http://adminer.svn.sourceforge.net/adminer/?rev=1470&view=rev
Author: jakubvrana
Date: 2010-04-21 22:22:23 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Improve drivers
Modified Paths:
--------------
trunk/adminer/drivers/pgsql.inc.php
trunk/adminer/drivers/sqlite.inc.php
trunk/adminer/include/editing.inc.php
trunk/adminer/include/functions.inc.php
Modified: trunk/adminer/drivers/pgsql.inc.php
===================================================================
--- trunk/adminer/drivers/pgsql.inc.php 2010-04-21 22:21:47 UTC (rev 1469)
+++ trunk/adminer/drivers/pgsql.inc.php 2010-04-21 22:22:23 UTC (rev 1470)
@@ -105,11 +105,13 @@
function fetch_field() {
$column = $this->_offset++;
$row = new stdClass;
- $row->orgtable = pg_field_table($this->_result, $column);
+ if (function_exists('pg_field_table')) {
+ $row->orgtable = pg_field_table($this->_result, $column);
+ }
$row->name = pg_field_name($this->_result, $column);
$row->orgname = $row->name;
$row->type = pg_field_type($this->_result, $column);
- $row->charsetnr = ($row->type == "bytea" ? 63 : 0);
+ $row->charsetnr = ($row->type == "bytea" ? 63 : 0); // 63 - binary
return $row;
}
@@ -178,7 +180,7 @@
function tables_list() {
global $connection;
- return get_key_vals("SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = 'public' ORDER BY table_name");
+ return get_key_vals("SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = current_schema() ORDER BY table_name");
}
function count_tables($databases) {
@@ -188,7 +190,12 @@
function table_status($name = "") {
global $connection;
$return = array();
- $result = $connection->query("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN '' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_catalog.obj_description(oid, 'pg_class') AS \"Comment\" FROM pg_catalog.pg_class WHERE relkind IN ('r','v') AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = 'public')" . ($name != "" ? " AND relname = " . $connection->quote($name) : "")); //! Index_length, Auto_increment
+ $result = $connection->query("SELECT relname AS \"Name\", CASE relkind WHEN 'r' THEN '' ELSE 'view' END AS \"Engine\", pg_relation_size(oid) AS \"Data_length\", pg_catalog.obj_description(oid, 'pg_class') AS \"Comment\"
+FROM pg_catalog.pg_class
+WHERE relkind IN ('r','v')
+AND relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())"
+ . ($name != "" ? " AND relname = " . $connection->quote($name) : "")
+ ); //! Index_length, Auto_increment
while ($row = $result->fetch_assoc()) {
$return[$row["Name"]] = $row;
}
Modified: trunk/adminer/drivers/sqlite.inc.php
===================================================================
--- trunk/adminer/drivers/sqlite.inc.php 2010-04-21 22:21:47 UTC (rev 1469)
+++ trunk/adminer/drivers/sqlite.inc.php 2010-04-21 22:22:23 UTC (rev 1470)
@@ -19,6 +19,7 @@
function __construct() {
$this->server_info = sqlite_libversion();
+ $this->_connection = new SQLiteDatabase(":memory:");
}
function open($filename) {
@@ -79,9 +80,16 @@
}
function fetch_field() {
+ $name = $this->_result->fieldName($this->_offset++);
+ $pattern = '(\\[.*]|"(?:[^"]|"")*"|(.+))';
+ if (preg_match("~^($pattern\\.)?$pattern\$~", $name, $match)) {
+ $table = ($match[3] != "" ? $match[3] : idf_unescape($match[2]));
+ $name = ($match[5] != "" ? $match[5] : idf_unescape($match[4]));
+ }
return (object) array(
- "name" => $this->_result->fieldName($this->_offset++),
- //! type, orgtable, charsetnr
+ "name" => $name,
+ "orgname" => $name,
+ "orgtable" => $table,
);
}
@@ -99,7 +107,7 @@
}
function open($filename) {
- $this->_connection->open($filename);
+ $this->_connection = new SQLite3($filename);
}
function query($query) {
@@ -146,10 +154,11 @@
function fetch_field() {
$column = $this->_offset++;
+ $type = $this->_result->columnType($column);
return (object) array(
"name" => $this->_result->columnName($column),
- "type" => $this->_result->columnType($column),
- //! orgtable, charsetnr
+ "type" => $type,
+ "charsetnr" => ($type == SQLITE3_BLOB ? 63 : 0), // 63 - binary
);
}
@@ -163,13 +172,8 @@
class Min_DB extends Min_SQLite {
function select_db($filename) {
- static $connected = false;
- if ($connected) {
- return true;
- }
set_exception_handler('connect_error'); // try/catch is not compatible with PHP 4
$this->open($filename);
- $connected = true;
restore_exception_handler();
return true;
}
Modified: trunk/adminer/include/editing.inc.php
===================================================================
--- trunk/adminer/include/editing.inc.php 2010-04-21 22:21:47 UTC (rev 1469)
+++ trunk/adminer/include/editing.inc.php 2010-04-21 22:22:23 UTC (rev 1470)
@@ -40,7 +40,7 @@
$links[$j] = $orgtable;
}
}
- if ($field->charsetnr == 63) {
+ if ($field->charsetnr == 63) { // 63 - binary
$blobs[$j] = true;
}
$types[$j] = $field->type;
@@ -59,7 +59,7 @@
$val = " "; // some content to print a border
} else {
$val = h($val);
- if ($types[$key] == 254) {
+ if ($types[$key] == 254) { // 254 - char
$val = "<code>$val</code>";
}
}
Modified: trunk/adminer/include/functions.inc.php
===================================================================
--- trunk/adminer/include/functions.inc.php 2010-04-21 22:21:47 UTC (rev 1469)
+++ trunk/adminer/include/functions.inc.php 2010-04-21 22:22:23 UTC (rev 1470)
@@ -13,7 +13,8 @@
* @return string
*/
function idf_unescape($idf) {
- return str_replace($idf[0] . $idf[0], $idf[0], substr($idf, 1, -1));
+ $last = substr($idf, -1);
+ return str_replace($last . $last, $last, substr($idf, 1, -1));
}
/** Escape string to use inside ''
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 22:21:52
|
Revision: 1469
http://adminer.svn.sourceforge.net/adminer/?rev=1469&view=rev
Author: jakubvrana
Date: 2010-04-21 22:21:47 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Allow multiple e-mails
Modified Paths:
--------------
trunk/adminer/include/functions.inc.php
Modified: trunk/adminer/include/functions.inc.php
===================================================================
--- trunk/adminer/include/functions.inc.php 2010-04-21 16:26:16 UTC (rev 1468)
+++ trunk/adminer/include/functions.inc.php 2010-04-21 22:21:47 UTC (rev 1469)
@@ -616,7 +616,8 @@
function is_email($email) {
$atom = '[-a-z0-9!#$%&\'*+/=?^_`{|}~]'; // characters of local-name
$domain = '[a-z0-9]([-a-z0-9]{0,61}[a-z0-9])'; // one domain component
- return preg_match("(^$atom+(\\.$atom+)*@($domain?\\.)+$domain\$)i", $email);
+ $pattern = "$atom+(\\.$atom+)*@($domain?\\.)+$domain";
+ return preg_match("(^$pattern(,\\s*$pattern)*\$)i", $email);
}
/** Check whether the string is URL address
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 16:26:22
|
Revision: 1468
http://adminer.svn.sourceforge.net/adminer/?rev=1468&view=rev
Author: jakubvrana
Date: 2010-04-21 16:26:16 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
SQLite user
Modified Paths:
--------------
trunk/adminer/drivers/sqlite.inc.php
Modified: trunk/adminer/drivers/sqlite.inc.php
===================================================================
--- trunk/adminer/drivers/sqlite.inc.php 2010-04-21 15:09:52 UTC (rev 1467)
+++ trunk/adminer/drivers/sqlite.inc.php 2010-04-21 16:26:16 UTC (rev 1468)
@@ -239,7 +239,7 @@
}
function logged_user() {
- return ""; //! OS user
+ return get_current_user(); // should return effective user
}
function tables_list() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 15:09:59
|
Revision: 1467
http://adminer.svn.sourceforge.net/adminer/?rev=1467&view=rev
Author: jakubvrana
Date: 2010-04-21 15:09:52 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
SQLite variables
Modified Paths:
--------------
trunk/adminer/drivers/mysql.inc.php
trunk/adminer/drivers/sqlite.inc.php
trunk/adminer/include/editing.inc.php
trunk/adminer/variables.inc.php
Modified: trunk/adminer/drivers/mysql.inc.php
===================================================================
--- trunk/adminer/drivers/mysql.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
+++ trunk/adminer/drivers/mysql.inc.php 2010-04-21 15:09:52 UTC (rev 1467)
@@ -666,6 +666,14 @@
return $connection->result("SHOW CREATE TABLE " . idf_escape($table), 1);
}
+ function show_variables() {
+ return get_key_vals("SHOW VARIABLES");
+ }
+
+ function show_status() {
+ return get_key_vals("SHOW STATUS");
+ }
+
/** Check whether a feature is supported
* @param string
* @return bool
Modified: trunk/adminer/drivers/sqlite.inc.php
===================================================================
--- trunk/adminer/drivers/sqlite.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
+++ trunk/adminer/drivers/sqlite.inc.php 2010-04-21 15:09:52 UTC (rev 1467)
@@ -44,7 +44,7 @@
function result($query, $field = 0) {
$result = $this->query($query);
- if (!$result) {
+ if (!is_object($result)) {
return false;
}
$row = $result->_result->fetch();
@@ -89,37 +89,38 @@
} else {
- class Min_SQLite extends SQLite3 {
- var $extension = "SQLite3", $server_info, $affected_rows, $error;
+ class Min_SQLite {
+ var $extension = "SQLite3", $server_info, $affected_rows, $error, $_connection;
function __construct() {
- $version = $this->version();
+ $this->_connection = new SQLite3(":memory:"); // required to display variables
+ $version = $this->_connection->version();
$this->server_info = $version["versionString"];
}
function open($filename) {
- parent::__construct($filename);
+ $this->_connection->open($filename);
}
function query($query) {
- $result = @parent::query($query);
+ $result = @$this->_connection->query($query);
if (!$result) {
- $this->error = $this->lastErrorMsg();
+ $this->error = $this->_connection->lastErrorMsg();
return false;
} elseif ($result->numColumns()) {
return new Min_Result($result);
}
- $this->affected_rows = $this->changes();
+ $this->affected_rows = $this->_connection->changes();
return true;
}
function quote($string) {
- return "'" . $this->escapeString($string) . "'";
+ return "'" . $this->_connection->escapeString($string) . "'";
}
function result($query, $field = 0) {
$result = $this->query($query);
- if (!$result) {
+ if (!is_object($result)) {
return false;
}
$row = $result->_result->fetchArray();
@@ -254,6 +255,7 @@
$return = array();
$result = $connection->query("SELECT name AS Name, type AS Engine FROM sqlite_master WHERE type IN ('table', 'view')" . ($name != "" ? " AND name = " . $connection->quote($name) : ""));
while ($row = $result->fetch_assoc()) {
+ $row["Auto_increment"] = "";
$return[$row["Name"]] = $row;
}
$result = $connection->query("SELECT * FROM sqlite_sequence");
@@ -456,8 +458,21 @@
return $connection->result("SELECT sql FROM sqlite_master WHERE name = " . $connection->quote($table));
}
+ function show_variables() {
+ global $connection;
+ $return = array();
+ foreach (array("auto_vacuum", "cache_size", "count_changes", "default_cache_size", "empty_result_callbacks", "encoding", "foreign_keys", "full_column_names", "fullfsync", "journal_mode", "journal_size_limit", "legacy_file_format", "locking_mode", "page_size", "max_page_count", "read_uncommitted", "recursive_triggers", "reverse_unordered_selects", "secure_delete", "short_column_names", "synchronous", "temp_store", "temp_store_directory", "schema_version", "compile_options", "integrity_check", "quick_check") as $key) {
+ $return[$key] = $connection->result("PRAGMA $key");
+ }
+ return $return;
+ }
+
+ function show_status() {
+ // not supported
+ }
+
function support($feature) {
- return ereg('^(view|trigger)$', $feature);
+ return ereg('^(view|trigger|variables)$', $feature);
}
$driver = "sqlite";
Modified: trunk/adminer/include/editing.inc.php
===================================================================
--- trunk/adminer/include/editing.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
+++ trunk/adminer/include/editing.inc.php 2010-04-21 15:09:52 UTC (rev 1467)
@@ -55,7 +55,7 @@
} else {
if ($blobs[$key] && !is_utf8($val)) {
$val = "<i>" . lang('%d byte(s)', strlen($val)) . "</i>"; //! link to download
- } elseif ($val == "") {
+ } elseif (!strlen($val)) { // strlen - SQLite can return int
$val = " "; // some content to print a border
} else {
$val = h($val);
Modified: trunk/adminer/variables.inc.php
===================================================================
--- trunk/adminer/variables.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
+++ trunk/adminer/variables.inc.php 2010-04-21 15:09:52 UTC (rev 1467)
@@ -2,11 +2,10 @@
$status = isset($_GET["status"]);
page_header($status ? lang('Status') : lang('Variables'));
-$result = $connection->query($status ? "SHOW STATUS" : "SHOW VARIABLES");
echo "<table cellspacing='0'>\n";
-while ($row = $result->fetch_assoc()) {
+foreach (($status ? show_status() : show_variables()) as $key => $val) {
echo "<tr>";
- echo "<th><code class='jush-" . ($status ? "sqlstatus" : "sqlset") . "'>" . h($row["Variable_name"]) . "</code>";
- echo "<td>" . nbsp($row["Value"]);
+ echo "<th><code class='jush-" . $driver . ($status ? "status" : "set") . "'>" . h($key) . "</code>";
+ echo "<td>" . nbsp($val);
}
echo "</table>\n";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 12:01:43
|
Revision: 1466
http://adminer.svn.sourceforge.net/adminer/?rev=1466&view=rev
Author: jakubvrana
Date: 2010-04-21 12:01:32 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Reintegrate sqlite branch
Modified Paths:
--------------
trunk/adminer/call.inc.php
trunk/adminer/create.inc.php
trunk/adminer/database.inc.php
trunk/adminer/db.inc.php
trunk/adminer/download.inc.php
trunk/adminer/dump.inc.php
trunk/adminer/edit.inc.php
trunk/adminer/foreign.inc.php
trunk/adminer/include/adminer.inc.php
trunk/adminer/include/auth.inc.php
trunk/adminer/include/bootstrap.inc.php
trunk/adminer/include/connect.inc.php
trunk/adminer/include/design.inc.php
trunk/adminer/include/editing.inc.php
trunk/adminer/include/export.inc.php
trunk/adminer/include/functions.inc.php
trunk/adminer/include/pdo.inc.php
trunk/adminer/include/version.inc.php
trunk/adminer/index.php
trunk/adminer/indexes.inc.php
trunk/adminer/lang/cs.inc.php
trunk/adminer/lang/de.inc.php
trunk/adminer/lang/es.inc.php
trunk/adminer/lang/et.inc.php
trunk/adminer/lang/fr.inc.php
trunk/adminer/lang/it.inc.php
trunk/adminer/lang/nl.inc.php
trunk/adminer/lang/ru.inc.php
trunk/adminer/lang/sk.inc.php
trunk/adminer/lang/zh-tw.inc.php
trunk/adminer/lang/zh.inc.php
trunk/adminer/privileges.inc.php
trunk/adminer/schema.inc.php
trunk/adminer/select.inc.php
trunk/adminer/sql.inc.php
trunk/adminer/static/default.css
trunk/adminer/static/editing.js
trunk/adminer/static/favicon.ico
trunk/adminer/static/functions.js
trunk/adminer/table.inc.php
trunk/adminer/trigger.inc.php
trunk/adminer/user.inc.php
trunk/adminer/view.inc.php
trunk/changes.txt
trunk/compile.php
trunk/coverage.php
trunk/editor/db.inc.php
trunk/editor/include/adminer.inc.php
trunk/editor/include/editing.inc.php
trunk/editor/index.php
trunk/lang.php
trunk/tests/0-login.html
trunk/tests/1-create-database.html
trunk/tests/10-clone.html
trunk/tests/11-reference.html
trunk/tests/12-update.html
trunk/tests/13-delete.html
trunk/tests/14-truncate.html
trunk/tests/15-privileges.html
trunk/tests/16-processlist.html
trunk/tests/17-export.html
trunk/tests/18-events.html
trunk/tests/19-procedures.html
trunk/tests/2-create-table.html
trunk/tests/20-partitioning.html
trunk/tests/21-variables.html
trunk/tests/22-history.html
trunk/tests/23-editor.html
trunk/tests/24-explain.html
trunk/tests/3-create-index.html
trunk/tests/4-create-table-2.html
trunk/tests/5-foreign-key.html
trunk/tests/6-alter-table.html
trunk/tests/7-create-trigger.html
trunk/tests/8-create-view.html
trunk/tests/9-insert.html
trunk/tests/logout.html
trunk/todo.txt
trunk/version.js
Added Paths:
-----------
trunk/adminer/drivers/
trunk/adminer/drivers/mssql.inc.php
trunk/adminer/drivers/mysql.inc.php
trunk/adminer/drivers/pgsql.inc.php
trunk/adminer/drivers/sqlite.inc.php
Removed Paths:
-------------
trunk/adminer/drivers/mssql.inc.php
trunk/adminer/drivers/mysql.inc.php
trunk/adminer/drivers/pgsql.inc.php
trunk/adminer/drivers/sqlite.inc.php
trunk/adminer/include/mysql.inc.php
Property Changed:
----------------
trunk/
trunk/tests/logout.html
Property changes on: trunk
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/sqlite:1193-1465
Modified: trunk/adminer/call.inc.php
===================================================================
--- trunk/adminer/call.inc.php 2010-04-21 11:46:05 UTC (rev 1465)
+++ trunk/adminer/call.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
@@ -28,7 +28,9 @@
}
$call[] = (isset($out[$key]) ? "@" . idf_escape($field["field"]) : $val);
}
- if (!$connection->multi_query((isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . idf_escape($PROCEDURE) . "(" . implode(", ", $call) . ")")) {
+ $query = (isset($_GET["callf"]) ? "SELECT" : "CALL") . " " . idf_escape($PROCEDURE) . "(" . implode(", ", $call) . ")";
+ echo "<p><code class='jush-$driver'>" . h($query) . "</code> <a href='" . h(ME) . "sql=" . urlencode($query) . "'>" . lang('Edit') . "</a>\n";
+ if (!$connection->multi_query($query)) {
echo "<p class='error'>" . error() . "\n";
} else {
do {
@@ -52,8 +54,9 @@
echo "<table cellspacing='0'>\n";
foreach ($in as $key) {
$field = $routine["fields"][$key];
- echo "<tr><th>" . h($field["field"]);
- $value = $_POST["fields"][$key];
+ $name = $field["field"];
+ echo "<tr><th>" . h($name);
+ $value = $_POST["fields"][$name];
if ($value != "" && ereg("enum|set", $field["type"])) {
$value = intval($value);
}
Modified: trunk/adminer/create.inc.php
===================================================================
--- trunk/adminer/create.inc.php 2010-04-21 11:46:05 UTC (rev 1465)
+++ trunk/adminer/create.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
@@ -19,20 +19,8 @@
if ($_POST["drop"]) {
query_redirect("DROP TABLE " . idf_escape($_GET["create"]), substr(ME, 0, -1), lang('Table has been dropped.'));
} else {
- $auto_increment_index = " PRIMARY KEY";
- // don't overwrite primary key by auto_increment
- if ($TABLE != "" && $_POST["auto_increment_col"]) {
- foreach (indexes($TABLE) as $index) {
- if (in_array($_POST["fields"][$_POST["auto_increment_col"]]["orig"], $index["columns"], true)) {
- $auto_increment_index = "";
- break;
- }
- if ($index["type"] == "PRIMARY") {
- $auto_increment_index = " UNIQUE";
- }
- }
- }
- $fields = "";
+ $fields = array();
+ $foreign = array();
ksort($_POST["fields"]);
$orig_field = reset($orig_fields);
$after = "FIRST";
@@ -48,33 +36,26 @@
$field["on_update"] = "CURRENT_TIMESTAMP";
$field["default"] = $default;
}
+ if ($key == $_POST["auto_increment_col"]) {
+ $field["auto_increment"] = true;
+ }
$process_field = process_field($field, $type_field);
- $auto_increment = ($key == $_POST["auto_increment_col"]);
- if ($process_field != process_field($orig_field, $orig_field) || $orig_field["auto_increment"] != $auto_increment) {
- $fields .= "\n" . ($TABLE != "" ? ($field["orig"] != "" ? "CHANGE " . idf_escape($field["orig"]) : "ADD") : " ")
- . " $process_field"
- . ($auto_increment ? " AUTO_INCREMENT$auto_increment_index" : "")
- . ($TABLE != "" ? " $after" : "") . ","
- ;
+ if ($process_field != process_field($orig_field, $orig_field)) {
+ $fields[] = array($field["orig"], $process_field, $after);
}
if (!isset($types[$field["type"]])) {
- $fields .= ($TABLE != "" ? "\nADD" : "") . " FOREIGN KEY (" . idf_escape($field["field"]) . ") REFERENCES " . idf_escape($foreign_keys[$field["type"]]) . " (" . idf_escape($type_field["field"]) . "),";
+ $foreign[] = ($TABLE != "" ? "ADD " : " ") . "FOREIGN KEY (" . idf_escape($field["field"]) . ") REFERENCES " . idf_escape($foreign_keys[$field["type"]]) . " (" . idf_escape($type_field["field"]) . ")";
}
}
$after = "AFTER " . idf_escape($field["field"]);
- //! drop and create foreign keys with renamed columns
} elseif ($field["orig"] != "") {
- $fields .= "\nDROP " . idf_escape($field["orig"]) . ",";
+ $fields[] = array($field["orig"]);
}
if ($field["orig"] != "") {
$orig_field = next($orig_fields);
}
}
- $status = "COMMENT=" . $connection->quote($_POST["Comment"])
- . ($_POST["Engine"] && $_POST["Engine"] != $orig_status["Engine"] ? " ENGINE=" . $connection->quote($_POST["Engine"]) : "")
- . ($_POST["Collation"] && $_POST["Collation"] != $orig_status["Collation"] ? " COLLATE " . $connection->quote($_POST["Collation"]) : "")
- . ($_POST["Auto_increment"] != "" ? " AUTO_INCREMENT=" . preg_replace('~[^0-9]+~', '', $_POST["Auto_increment"]) : "")
- ;
+ $partitioning = "";
if (in_array($_POST["partition_by"], $partition_by)) {
$partitions = array();
if ($_POST["partition_by"] == 'RANGE' || $_POST["partition_by"] == 'LIST') {
@@ -83,20 +64,29 @@
$partitions[] = "\nPARTITION " . idf_escape($val) . " VALUES " . ($_POST["partition_by"] == 'RANGE' ? "LESS THAN" : "IN") . ($value != "" ? " ($value)" : " MAXVALUE"); //! SQL injection
}
}
- $status .= "\nPARTITION BY $_POST[partition_by]($_POST[partition])" . ($partitions // $_POST["partition"] can be expression, not only column
+ $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"]) : "")
);
- } elseif ($connection->server_info >= 5.1 && $TABLE != "") {
- $status .= "\nREMOVE PARTITIONING";
+ } elseif ($TABLE != "") {
+ $partitioning .= "\nREMOVE PARTITIONING";
}
- $location = ME . "table=" . urlencode($_POST["name"]);
- if ($TABLE != "") {
- query_redirect("ALTER TABLE " . idf_escape($TABLE) . "$fields\nRENAME TO " . idf_escape($_POST["name"]) . ",\n$status", $location, lang('Table has been altered.'));
- } else {
+ $message = lang('Table has been altered.');
+ if ($TABLE == "") {
cookie("adminer_engine", $_POST["Engine"]);
- query_redirect("CREATE TABLE " . idf_escape($_POST["name"]) . " (" . substr($fields, 0, -1) . "\n) $status", $location, lang('Table has been created.'));
+ $message = lang('Table has been created.');
}
+ queries_redirect(ME . "table=" . urlencode($_POST["name"]), $message, alter_table(
+ $TABLE,
+ $_POST["name"],
+ $fields,
+ $foreign,
+ $_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('~[^0-9]+~', '', $_POST["Auto_increment"]) : ""),
+ $partitioning
+ ));
}
}
@@ -127,9 +117,9 @@
}
$row["fields"][] = $field;
}
- if ($connection->server_info >= 5.1) {
+ if (support("partitioning")) {
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . $connection->quote(DB) . " AND TABLE_NAME = " . $connection->quote($TABLE);
- $result = $connection->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
+ $result = $connection->query("SELECT" . limit("PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $from ORDER BY PARTITION_ORDINAL_POSITION", 1));
list($row["partition_by"], $row["partitions"], $row["partition"]) = $result->fetch_row();
$row["partition_names"] = array();
$row["partition_values"] = array();
@@ -162,24 +152,23 @@
<p>
<?php echo lang('Table name'); ?>: <input name="name" maxlength="64" value="<?php echo h($row["name"]); ?>">
<?php echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) : ""); ?>
- <?php echo html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]); ?>
+ <?php echo ($collations ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?>
<input type="submit" value="<?php echo lang('Save'); ?>">
<table cellspacing="0" id="edit-fields" class="nowrap">
-<?php $column_comments = edit_fields($row["fields"], $collations, "TABLE", $suhosin, $foreign_keys); ?>
+<?php $comments = edit_fields($row["fields"], $collations, "TABLE", $suhosin, $foreign_keys, $row["Comment"] != ""); ?>
</table>
<p>
<?php echo lang('Auto Increment'); ?>: <input name="Auto_increment" size="6" value="<?php echo h($row["Auto_increment"]); ?>">
-<?php echo lang('Comment'); ?>: <input name="Comment" value="<?php echo h($row["Comment"]); ?>" maxlength="60">
<script type="text/javascript">
document.write('<label><input type="checkbox" onclick="columnShow(this.checked, 5);"><?php echo lang('Default values'); ?><\/label>');
-document.write('<label><input type="checkbox"<?php if ($column_comments) { ?> checked<?php } ?> onclick="columnShow(this.checked, 6);"><?php echo lang('Show column comments'); ?><\/label>');
</script>
+<?php echo (support("comment") ? checkbox("", "", $comments, lang('Comment'), "columnShow(this.checked, 6); toggle('Comment');") . ' <input id="Comment" name="Comment" value="' . h($row["Comment"]) . '" maxlength="60"' . ($comments ? '' : ' class="hidden"') . '>' : ''); ?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php if (strlen($_GET["create"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?>
<?php
-if ($connection->server_info >= 5.1) {
+if (support("partitioning")) {
$partition_table = ereg('RANGE|LIST', $row["partition_by"]);
print_fieldset("partition", lang('Partition by'), $row["partition_by"]);
?>
Modified: trunk/adminer/database.inc.php
===================================================================
--- trunk/adminer/database.inc.php 2010-04-21 11:46:05 UTC (rev 1465)
+++ trunk/adminer/database.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
@@ -2,36 +2,27 @@
if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP changes add.x to add_x
restart_session();
if ($_POST["drop"]) {
- unset($_SESSION["databases"][$_GET["server"]]);
+ set_session("databases", null);
query_redirect("DROP DATABASE " . idf_escape(DB), remove_from_uri("db|database"), lang('Database has been dropped.'));
} elseif (DB !== $_POST["name"]) {
// create or rename database
- unset($_SESSION["databases"][$_GET["server"]]); // clear cache
- $dbs = explode("\n", str_replace("\r", "", $_POST["name"]));
- $failed = false;
- $last = "";
- foreach ($dbs as $db) {
- if (count($dbs) == 1 || $db != "") { // ignore empty lines but always try to create single database
- if (!queries("CREATE DATABASE " . idf_escape($db) . ($_POST["collation"] ? " COLLATE " . $connection->quote($_POST["collation"]) : ""))) {
- $failed = true;
+ set_session("databases", null); // clear cache
+ if (DB != "") {
+ queries_redirect(preg_replace('~db=[^&]*&~', '', ME) . "db=" . urlencode($_POST["name"]), lang('Database has been renamed.'), rename_database($_POST["name"], $_POST["collation"]));
+ } else {
+ $dbs = explode("\n", str_replace("\r", "", $_POST["name"]));
+ $success = true;
+ $last = "";
+ foreach ($dbs as $db) {
+ if (count($dbs) == 1 || $db != "") { // ignore empty lines but always try to create single database
+ if (!queries("CREATE DATABASE " . idf_escape($db) . ($_POST["collation"] ? " COLLATE " . $connection->quote($_POST["collation"]) : ""))) {
+ $success = false;
+ }
+ $last = $db;
}
- $last = $db;
}
+ queries_redirect(ME . "db=" . urlencode($last), lang('Database has been created.'), $success);
}
- if (query_redirect(queries(), ME . "db=" . urlencode($last), lang('Database has been created.'), DB == "", false, $failed)) {
- //! move triggers
- $result = $connection->query("SHOW TABLES");
- while ($row = $result->fetch_row()) {
- if (!queries("RENAME TABLE " . idf_escape($row[0]) . " TO " . idf_escape($_POST["name"]) . "." . idf_escape($row[0]))) {
- break;
- }
- }
- if (!$row) {
- queries("DROP DATABASE " . idf_escape(DB));
- //! saved to history of removed database
- }
- queries_redirect(preg_replace('~db=[^&]*&~', '', ME) . "db=" . urlencode($_POST["name"]), lang('Database has been renamed.'), !$row);
- }
} else {
// alter database
if (!$_POST["collation"]) {
@@ -49,17 +40,16 @@
if ($_POST) {
$name = $_POST["name"];
$collate = $_POST["collation"];
-} elseif (DB == "") {
+} elseif (DB != "") {
+ $collate = db_collation(DB, $collations);
+} elseif ($driver == "sql") {
// propose database name with limited privileges
- $result = $connection->query("SHOW GRANTS");
- while ($row = $result->fetch_row()) {
- if (preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~', $row[0], $match) && $match[1]) {
- $name = stripcslashes(idf_unescape($match[2]));
+ foreach (get_vals("SHOW GRANTS") as $grant) {
+ if (preg_match('~ ON (`(([^\\\\`]|``|\\\\.)*)%`\\.\\*)?~', $grant, $match) && $match[1]) {
+ $name = stripcslashes(idf_unescape("`$match[2]`"));
break;
}
}
-} else {
- $collate = db_collation(DB, $collations);
}
?>
Modified: trunk/adminer/db.inc.php
===================================================================
--- trunk/adminer/db.inc.php 2010-04-21 11:46:05 UTC (rev 1465)
+++ trunk/adminer/db.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
@@ -4,18 +4,15 @@
if ($tables_views && !$error && !$_POST["search"]) {
$result = true;
$message = "";
- if (count($_POST["tables"]) > 1 && ($_POST["drop"] || $_POST["truncate"])) {
+ if ($driver == "sql" && count($_POST["tables"]) > 1 && ($_POST["drop"] || $_POST["truncate"])) {
queries("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once
}
- if (isset($_POST["truncate"])) {
- foreach ((array) $_POST["tables"] as $table) {
- if (!queries("TRUNCATE " . idf_escape($table))) {
- $result = false;
- break;
- }
+ if ($_POST["truncate"]) {
+ if ($_POST["tables"]) {
+ $result = truncate_tables($_POST["tables"]);
}
$message = lang('Tables have been truncated.');
- } elseif (isset($_POST["move"])) {
+ } elseif ($_POST["move"]) {
$rename = array();
foreach ($tables_views as $table) {
$rename[] = idf_escape($table) . " TO " . idf_escape($_POST["target"]) . "." . idf_escape($table);
@@ -23,66 +20,65 @@
$result = queries("RENAME TABLE " . implode(", ", $rename));
//! move triggers
$message = lang('Tables have been moved.');
- } elseif ((!isset($_POST["drop"]) || !$_POST["views"] || queries("DROP VIEW " . implode(", ", array_map('idf_escape', $_POST["views"]))))
- && (!$_POST["tables"] || ($result = queries((isset($_POST["optimize"]) ? "OPTIMIZE" : (isset($_POST["check"]) ? "CHECK" : (isset($_POST["repair"]) ? "REPAIR" : (isset($_POST["drop"]) ? "DROP" : "ANALYZE")))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"])))))
- ) {
- if (isset($_POST["drop"])) {
- $message = lang('Tables have been dropped.');
- } else {
- while ($row = $result->fetch_assoc()) {
- $message .= h("$row[Table]: $row[Msg_text]") . "<br>";
- }
+ } elseif ($_POST["drop"]) {
+ if ($_POST["views"]) {
+ $result = drop_views($_POST["views"]);
}
+ if ($result && $_POST["tables"]) {
+ $result = drop_tables($_POST["tables"]);
+ }
+ $message = lang('Tables have been dropped.');
+ } elseif ($_POST["tables"] && ($result = queries(($_POST["optimize"] ? "OPTIMIZE" : ($_POST["check"] ? "CHECK" : ($_POST["repair"] ? "REPAIR" : "ANALYZE"))) . " TABLE " . implode(", ", array_map('idf_escape', $_POST["tables"]))))) {
+ while ($row = $result->fetch_assoc()) {
+ $message .= h("$row[Table]: $row[Msg_text]") . "<br>";
+ }
}
queries_redirect(substr(ME, 0, -1), $message, $result);
}
-page_header(lang('Database') . ": " . h(DB), $error, false);
+page_header(lang('Database') . ": " . h(DB), $error, true);
echo '<p><a href="' . h(ME) . 'database=">' . lang('Alter database') . "</a>\n";
echo '<a href="' . h(ME) . 'schema=">' . lang('Database schema') . "</a>\n";
+$sums = array("Data_length" => 0, "Index_length" => 0, "Data_free" => 0);
echo "<h3>" . lang('Tables and views') . "</h3>\n";
-$table_status = table_status();
-if (!$table_status) {
+$tables_list = tables_list();
+if (!$tables_list) {
echo "<p class='message'>" . lang('No tables.') . "\n";
} else {
echo "<form action='' method='post'>\n";
echo "<p><input name='query' value='" . h($_POST["query"]) . "'> <input type='submit' name='search' value='" . lang('Search') . "'>\n";
if ($_POST["search"] && $_POST["query"] != "") {
- $_GET["where"][0]["op"] = "LIKE";
- $_GET["where"][0]["val"] = "%$_POST[query]%";
+ $_GET["where"][0]["op"] = "LIKE %%";
+ $_GET["where"][0]["val"] = $_POST["query"];
search_tables();
}
echo "<table cellspacing='0' class='nowrap' onclick='tableClick(event);'>\n";
- echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);"><th>' . lang('Table') . '<td>' . lang('Engine') . '<td>' . lang('Collation') . '<td>' . lang('Data Length') . '<td>' . lang('Index Length') . '<td>' . lang('Data Free') . '<td>' . lang('Auto Increment') . '<td>' . lang('Rows') . '<td>' . lang('Comment') . "</thead>\n";
- $sums = array();
- foreach ($table_status as $row) {
- $name = $row["Name"];
- echo '<tr' . odd() . '><td>' . checkbox((isset($row["Rows"]) ? "tables[]" : "views[]"), $name, in_array($name, $tables_views, true), "", "formUncheck('check-all');");
+ echo '<thead><tr class="wrap"><td><input id="check-all" type="checkbox" onclick="formCheck(this, /^(tables|views)\[/);"><th>' . lang('Table') . '<td>' . lang('Engine') . '<td>' . lang('Collation') . '<td>' . lang('Data Length') . '<td>' . lang('Index Length') . '<td>' . lang('Data Free') . '<td>' . lang('Auto Increment') . '<td>' . lang('Rows') . (support("comment") ? '<td>' . lang('Comment') : '') . "</thead>\n";
+ foreach ($tables_list as $name => $type) {
+ $view = (isset($type) && !eregi("table", $type));
+ echo '<tr' . odd() . '><td>' . checkbox(($view ? "views[]" : "tables[]"), $name, in_array($name, $tables_views, true), "", "formUncheck('check-all');");
echo '<th><a href="' . h(ME) . 'table=' . urlencode($name) . '">' . h($name) . '</a>';
- if (isset($row["Rows"])) {
- echo "<td>$row[Engine]<td>$row[Collation]";
+ if ($view) {
+ echo '<td colspan="6"><a href="' . h(ME) . "view=" . urlencode($name) . '">' . lang('View') . '</a>';
+ echo '<td align="right"><a href="' . h(ME) . "select=" . urlencode($name) . '">?</a>';
+ } else {
+ echo "<td id='Engine-" . h($name) . "'> <td id='Collation-" . h($name) . "'> ";
foreach (array("Data_length" => "create", "Index_length" => "indexes", "Data_free" => "edit", "Auto_increment" => "auto_increment=1&create", "Rows" => "select") as $key => $link) {
- $val = number_format($row[$key], 0, '.', lang(','));
- echo '<td align="right">' . ($row[$key] != "" ? '<a href="' . h(ME . "$link=") . urlencode($name) . '">' . str_replace(" ", " ", ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? lang('~ %s', $val) : $val)) . '</a>' : ' ');
- $sums[$link] += ($row["Engine"] != "InnoDB" || $link != "edit" ? $row[$key] : 0);
+ echo "<td align='right'><a href='" . h(ME . "$link=") . urlencode($name) . "' id='$key-" . h($name) . "'>?</a>";
}
- echo "<td>" . nbsp($row["Comment"]);
- } else {
- echo '<td colspan="6"><a href="' . h(ME) . "view=" . urlencode($name) . '">' . lang('View') . '</a>';
- echo '<td align="right"><a href="' . h(ME) . "select=" . urlencode($name) . '">?</a>';
- echo '<td> ';
}
+ echo (support("comment") ? "<td id='Comment-" . h($name) . "'> " : "");
}
- echo "<tr><td> <th>" . lang('%d in total', count($table_status));
- echo "<td>" . $connection->result($connection->query("SELECT @@storage_engine"));
+ echo "<tr><td> <th>" . lang('%d in total', count($tables_list));
+ echo "<td>" . $connection->result("SELECT @@storage_engine");
echo "<td>" . db_collation(DB, collations());
- foreach (array("create", "indexes", "edit") as $val) {
- echo "<td align='right'>" . number_format($sums[$val], 0, '.', lang(','));
+ foreach ($sums as $key => $val) {
+ echo "<td align='right' id='sum-$key'> ";
}
echo "</table>\n";
if (!information_schema(DB)) {
- echo "<p><input type='hidden' name='token' value='$token'><input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> <input type='submit' name='truncate' value='" . lang('Truncate') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables/) + ')');\"> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables|views/) + ')');\">\n";
+ echo "<p><input type='hidden' name='token' value='$token'>" . ($driver == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> " : "") . "<input type='submit' name='truncate' value='" . lang('Truncate') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables/) + ')');\"> <input type='submit' name='drop' value='" . lang('Drop') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + formChecked(this, /tables|views/) + ')');\">\n";
$dbs = get_databases();
if (count($dbs) != 1) {
$db = (isset($_POST["target"]) ? $_POST["target"] : DB);
@@ -93,8 +89,10 @@
}
echo '<p><a href="' . h(ME) . 'create=">' . lang('Create table') . "</a>\n";
-if ($connection->server_info >= 5) {
+if (support("view")) {
echo '<a href="' . h(ME) . 'view=">' . lang('Create view') . "</a>\n";
+}
+if (support("routine")) {
echo "<h3>" . lang('Routines') . "</h3>\n";
$result = $connection->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . $connection->quote(DB));
if ($result->num_rows) {
@@ -110,9 +108,10 @@
echo '<p><a href="' . h(ME) . 'procedure=">' . lang('Create procedure') . '</a> <a href="' . h(ME) . 'function=">' . lang('Create function') . "</a>\n";
}
-if ($connection->server_info >= 5.1 && ($result = $connection->query("SHOW EVENTS"))) {
+if (support("event")) {
echo "<h3>" . lang('Events') . "</h3>\n";
- if ($result->num_rows) {
+ $result = $connection->query("SHOW EVENTS");
+ if ($result && $result->num_rows) {
echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Name') . "<td>" . lang('Schedule') . "<td>" . lang('Start') . "<td>" . lang('End') . "</thead>\n";
while ($row = $result->fetch_assoc()) {
@@ -125,3 +124,34 @@
}
echo '<p><a href="' . h(ME) . 'event=">' . lang('Create event') . "</a>\n";
}
+
+page_footer();
+$table_status = table_status();
+if ($table_status) {
+ echo "<script type='text/javascript'>\n";
+ foreach ($table_status as $row) {
+ $id = addcslashes($row["Name"], "\\'/");
+ echo "setHtml('Comment-$id', '" . nbsp($row["Comment"]) . "');\n";
+ if (!eregi("view", $row["Engine"])) {
+ foreach (array("Engine", "Collation") as $key) {
+ echo "setHtml('$key-$id', '" . nbsp($row[$key]) . "');\n";
+ }
+ foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
+ if ($row[$key] != "") {
+ $val = number_format($row[$key], 0, '.', lang(','));
+ echo "setHtml('$key-$id', '" . ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "');\n";
+ if (isset($sums[$key])) {
+ $sums[$key] += ($row["Engine"] != "InnoDB" || $key != "Data_free" ? $row[$key] : 0);
+ }
+ } elseif (array_key_exists($key, $row)) {
+ echo "setHtml('$key-$id');\n";
+ }
+ }
+ }
+ }
+ foreach ($sums as $key => $val) {
+ echo "setHtml('sum-$key', '" . number_format($val, 0, '.', lang(',')) . "');\n";
+ }
+ echo "</script>\n";
+}
+exit; // page_footer() already called
Modified: trunk/adminer/download.inc.php
===================================================================
--- trunk/adminer/download.inc.php 2010-04-21 11:46:05 UTC (rev 1465)
+++ trunk/adminer/download.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
@@ -2,5 +2,5 @@
$TABLE = $_GET["download"];
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . friendly_url("$TABLE-" . implode("_", $_GET["where"])) . "." . friendly_url($_GET["field"]));
-echo $connection->result($connection->query("SELECT " . idf_escape($_GET["field"]) . " FROM " . idf_escape($TABLE) . " WHERE " . where($_GET) . " LIMIT 1"));
+echo $connection->result("SELECT" . limit(idf_escape($_GET["field"]) . " FROM " . idf_escape($TABLE) . " WHERE " . where($_GET), 1));
exit; // don't output footer
Property changes on: trunk/adminer/drivers
___________________________________________________________________
Added: tsvn:projectlanguage
+ 1033
Deleted: trunk/adminer/drivers/mssql.inc.php
===================================================================
--- branches/sqlite/adminer/drivers/mssql.inc.php 2010-04-21 11:46:05 UTC (rev 1465)
+++ trunk/adminer/drivers/mssql.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
@@ -1,406 +0,0 @@
-<?php
-/**
-* @author Jakub Cernohuby
-* @author Vladimir Stastka
-* @author Jakub Vrana
-*/
-
-$possible_drivers[] = "SQLSRV";
-$possible_drivers[] = "MSSQL";
-if (extension_loaded("sqlsrv") || extension_loaded("mssql")) {
- $drivers["mssql"] = "MS SQL";
-}
-
-if (isset($_GET["mssql"])) {
- define("DRIVER", "mssql");
- if (extension_loaded("sqlsrv")) {
- class Min_DB {
- var $extension = "sqlsrv", $_link, $_result, $server_info, $affected_rows, $error;
-
- function _get_error() {
- $this->error = "";
- foreach (sqlsrv_errors() as $error) {
- $this->error .= "$error[message]\n";
- }
- $this->error = rtrim($this->error);
- }
-
- function connect($server, $username, $password) {
- $this->_link = @sqlsrv_connect($server, array("UID" => $username, "PWD" => $password));
- if ($this->_link) {
- $info = sqlsrv_server_info($this->_link);
- $this->server_info = $info['SQLServerVersion'];
- } else {
- $this->_get_error();
- }
- return (bool) $this->_link;
- }
-
- function quote($string) {
- return "'" . str_replace("'", "''", $string) . "'";
- }
-
- function select_db($database) {
- return $this->query("USE $database");
- }
-
-
- function query($query, $unbuffered = false) {
- $result = sqlsrv_query($this->_link, $query); //! , array(), ($unbuffered ? array() : array("Scrollable" => "keyset"))
- if (!$result) {
- $this->_get_error();
- return false;
- }
- return $this->store_result($result);
- }
-
- function multi_query($query) {
- $this->_result = sqlsrv_query($this->_link, $query);
- if (!$this->_result) {
- $this->_get_error();
- return false;
- }
- return true;
- }
-
- function store_result($result = null) {
- if (!$result) {
- $result = $this->_result;
- }
- if (sqlsrv_field_metadata($result)) {
- return new Min_Result($result);
- }
- $this->affected_rows = sqlsrv_rows_affected($result);
- return true;
- }
-
- function next_result() {
- return sqlsrv_next_result($this->_result);
- }
-
- function result($query, $field = 0) {
- $result = $this->query($query);
- if (!is_object($result)) {
- return false;
- }
- $row = $result->fetch_row();
- return $row[$field];
- }
- }
-
- class Min_Result {
- var $_result, $_offset = 0, $_fields, $num_rows;
-
- function Min_Result($result) {
- $this->_result = $result;
- $this->num_rows = sqlsrv_has_rows($result); //! sqlsrv_num_rows($result)
- }
-
- function _convert($row) {
- foreach ((array) $row as $key => $val) {
- if (is_a($val, 'DateTime')) {
- $row[$key] = $val->format("Y-m-d H:i:s");
- }
- //! stream
- }
- return $row;
- }
-
- function fetch_assoc() {
- return $this->_convert(sqlsrv_fetch_array($this->_result, SQLSRV_FETCH_ASSOC, SQLSRV_SCROLL_NEXT));
- }
-
- function fetch_row() {
- return $this->_convert(sqlsrv_fetch_array($this->_result, SQLSRV_FETCH_NUMERIC, SQLSRV_SCROLL_NEXT));
- }
-
- function fetch_field() {
- if (!$this->_fields) {
- $this->_fields = sqlsrv_field_metadata($this->_result);
- }
- $field = $this->_fields[$this->_offset++];
- $return = new stdClass;
- $return->name = $field["Name"];
- $return->orgname = $field["Name"];
- $return->type = ($field["Type"] == 1 ? 254 : 0);
- return $return;
- }
-
- function __destruct() {
- sqlsrv_free_stmt($this->_result);
- }
- }
-
- } elseif (extension_loaded("mssql")) {
- class Min_DB {
- var $extension = "MSSQL", $_link, $_result, $server_info, $affected_rows, $error;
-
- function connect($server, $username, $password) {
- $this->_link = @mssql_connect($server, $username, $password);
- if ($this->_link) {
- $result = $this->query("SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition')");
- $row = $result->fetch_row();
- $this->server_info = $this->result("sp_server_info 2", 2)." [$row[0]] $row[1]";
- } else {
- $this->error = mssql_get_last_message();
- }
- return (bool) $this->_link;
- }
-
- function quote($string) {
- return "'" . str_replace("'", "''", $string) . "'";
- }
-
- function select_db($database) {
- return mssql_select_db($database);
- }
-
- function query($query, $unbuffered = false) {
- $result = mssql_query($query, $this->_link); //! $unbuffered
- if (!$result) {
- $this->error = mssql_get_last_message();
- return false;
- }
- if ($result === true) {
- $this->affected_rows = mssql_rows_affected($this->_link);
- return true;
- }
- return new Min_Result($result);
- }
-
- function multi_query($query) {
- return $this->_result = $this->query($query);
- }
-
- function store_result() {
- return $this->_result;
- }
-
- function next_result() {
- return mssql_next_result($this->_result);
- }
-
- function result($query, $field = 0) {
- $result = $this->query($query);
- if (!is_object($result)) {
- return false;
- }
- return mssql_result($result->_result, 0, $field);
- }
- }
-
- class Min_Result {
- var $_result, $_offset = 0, $_fields, $num_rows;
-
- function Min_Result($result) {
- $this->_result = $result;
- $this->num_rows = mssql_num_rows($result);
- }
-
- function fetch_assoc() {
- return mssql_fetch_assoc($this->_result);
- }
-
- function fetch_row() {
- return mssql_fetch_row($this->_result);
- }
-
- function num_rows() {
- return mssql_num_rows($this->_result);
- }
-
- function fetch_field() {
- $return = mssql_fetch_field($this->_result);
- $return->orgtable = $return->table;
- $return->orgname = $return->name;
- return $return;
- }
-
- function __destruct() {
- mssql_free_result($this->_result);
- }
- }
-
- }
-
- function idf_escape($idf) {
- return "[" . str_replace("]", "]]", $idf) . "]";
- }
-
- function connect() {
- global $adminer;
- $connection = new Min_DB;
- $credentials = $adminer->credentials();
- if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
- return $connection;
- }
- return $connection->error;
- }
-
- function get_databases() {
- return get_vals("EXEC sp_databases");
- }
-
- function limit($query, $limit, $offset = 0) {
- return (isset($limit) ? " TOP ($limit)" : "") . " $query"; //! offset
- }
-
- function limit1($query, $limit, $offset = 0) {
- return limit($query, 1);
- }
-
- function db_collation($db, $collations) {
- global $connection;
- return $connection->result("SELECT collation_name FROM sys.databases WHERE name = " . $connection->quote($db));
- }
-
- function engines() {
- return array();
- }
-
- function logged_user() {
- global $connection;
- return $connection->result("SELECT SUSER_NAME()");
- }
-
- function tables_list() {
- return get_key_vals("SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES");
- }
-
- function count_tables($databases) {
- global $connection;
- $return = array();
- foreach ($databases as $db) {
- $connection->select_db($db);
- $return[$db] = $connection->result("SELECT COUNT(*) FROM information_schema.TABLES");
- }
- return $return;
- }
-
- function table_status($name = "") {
- global $connection;
- $return = array();
- $result = $connection->query("SELECT TABLE_NAME AS Name, TABLE_TYPE AS Engine FROM information_schema.TABLES" . ($name != "" ? " WHERE TABLE_NAME = " . $connection->quote($name) : ""));
- while ($row = $result->fetch_assoc()) {
- if ($name != "") {
- return $row;
- }
- $return[$row["Name"]] = $row;
- }
- return $return;
- }
-
- function fk_support($table_status) {
- return true;
- }
-
- function fields($table) {
- global $connection;
- $return = array();
- $result = $connection->query("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = " . $connection->quote($table));
- while ($row = $result->fetch_assoc()) {
- $return[$row["COLUMN_NAME"]] = array(
- "field" => $row["COLUMN_NAME"],
- "full_type" => $row["DATA_TYPE"],
- "type" => $row["DATA_TYPE"],
- "length" => $row["CHARACTER_MAXIMUM_LENGTH"], //! NUMERIC_, DATETIME_?
- "default" => $row["COLUMN_DEFAULT"],
- "null" => ($row["IS_NULLABLE"] == "YES"),
- "collation" => $row["COLLATION_NAME"],
- "privileges" => array("insert" => 1, "select" => 1, "update" => 1),
- //! primary - is_identity in sys.columns
- );
- }
- return $return;
- }
-
- function indexes($table, $connection2 = null) {
- global $connection;
- if (!is_object($connection2)) {
- $connection2 = $connection;
- }
- $return = array();
- // sp_statistics doesn't return information about primary key
- $result = $connection2->query("SELECT indexes.name, key_ordinal, is_unique, is_primary_key, columns.name AS column_name
-FROM sys.indexes
-INNER JOIN sys.index_columns ON indexes.object_id = index_columns.object_id AND indexes.index_id = index_columns.index_id
-INNER JOIN sys.columns ON index_columns.object_id = columns.object_id AND index_columns.column_id = columns.column_id
-WHERE OBJECT_NAME(indexes.object_id) = " . $connection2->quote($table));
- if ($result) {
- while ($row = $result->fetch_assoc()) {
- $return[$row["name"]]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX"));
- $return[$row["name"]]["columns"][$row["key_ordinal"]] = $row["column_name"];
- }
- }
- return $return;
- }
-
- function collations() {
- $return = array();
- foreach (get_vals("SELECT name FROM fn_helpcollations()") as $collation) {
- $return[ereg_replace("_.*", "", $collation)][] = $collation;
- }
- return $return;
- }
-
- function information_schema($db) {
- return false;
- }
-
- function error() {
- global $connection;
- return nl_br(h(ereg_replace("^(\\[[^]]*])+", "", $connection->error)));
- }
-
- function exact_value($val) {
- global $connection;
- return $connection->quote($val);
- }
-
- function rename_database($name, $collation) {
- if ($collation) {
- queries("ALTER DATABASE " . idf_escape(DB) . " COLLATE " . idf_escape($collation));
- }
- return queries("ALTER DATABASE " . idf_escape(DB) . " MODIFY NAME = " . idf_escape($name)); //! false negative "The database name 'test2' has been set."
- }
-
- function auto_increment() {
- return " IDENTITY";
- }
-
- function explain($connection, $query) {
- $connection->query("SET SHOWPLAN_ALL ON");
- $return = $connection->query($query);
- $connection->query("SET SHOWPLAN_ALL OFF"); // connection is used also for indexes
- return $return;
- }
-
- function support($feature) {
- return ereg('^(view|routine|trigger)$', $feature);
- }
-
- $driver = "mssql";
- $types = array();
- $structured_types = array();
- foreach (array(
- lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "int" => 10, "bigint" => 20, "bit" => 1, "decimal" => 0, "real" => 12, "float" => 53, "smallmoney" => 10, "money" => 20),
- lang('Date and time') => array("date" => 10, "smalldatetime" => 19, "datetime" => 19, "datetime2" => 19, "time" => 8, "datetimeoffset" => 10),
- lang('Strings') => array("char" => 8000, "varchar" => 8000, "text" => 2147483647, "nchar" => 4000, "nvarchar" => 4000, "ntext" => 1073741823),
- lang('Binary') => array("binary" => 8000, "varbinary" => 8000, "image" => 2147483647),
- ) as $key => $val) {
- $types += $val;
- $structured_types[$key] = array_keys($val);
- }
- $unsigned = array();
- $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL");
- $functions = array("len", "lower", "round", "upper");
- $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
- $edit_functions = array(
- array(
- "date|time" => "getdate",
- ), array(
- "int|decimal|real|float|money|datetime" => "+/-",
- "char|text" => "+",
- )
- );
-}
Copied: trunk/adminer/drivers/mssql.inc.php (from rev 1465, branches/sqlite/adminer/drivers/mssql.inc.php)
===================================================================
--- trunk/adminer/drivers/mssql.inc.php (rev 0)
+++ trunk/adminer/drivers/mssql.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
@@ -0,0 +1,406 @@
+<?php
+/**
+* @author Jakub Cernohuby
+* @author Vladimir Stastka
+* @author Jakub Vrana
+*/
+
+$possible_drivers[] = "SQLSRV";
+$possible_drivers[] = "MSSQL";
+if (extension_loaded("sqlsrv") || extension_loaded("mssql")) {
+ $drivers["mssql"] = "MS SQL";
+}
+
+if (isset($_GET["mssql"])) {
+ define("DRIVER", "mssql");
+ if (extension_loaded("sqlsrv")) {
+ class Min_DB {
+ var $extension = "sqlsrv", $_link, $_result, $server_info, $affected_rows, $error;
+
+ function _get_error() {
+ $this->error = "";
+ foreach (sqlsrv_errors() as $error) {
+ $this->error .= "$error[message]\n";
+ }
+ $this->error = rtrim($this->error);
+ }
+
+ function connect($server, $username, $password) {
+ $this->_link = @sqlsrv_connect($server, array("UID" => $username, "PWD" => $password));
+ if ($this->_link) {
+ $info = sqlsrv_server_info($this->_link);
+ $this->server_info = $info['SQLServerVersion'];
+ } else {
+ $this->_get_error();
+ }
+ return (bool) $this->_link;
+ }
+
+ function quote($string) {
+ return "'" . str_replace("'", "''", $string) . "'";
+ }
+
+ function select_db($database) {
+ return $this->query("USE $database");
+ }
+
+
+ function query($query, $unbuffered = false) {
+ $result = sqlsrv_query($this->_link, $query); //! , array(), ($unbuffered ? array() : array("Scrollable" => "keyset"))
+ if (!$result) {
+ $this->_get_error();
+ return false;
+ }
+ return $this->store_result($result);
+ }
+
+ function multi_query($query) {
+ $this->_result = sqlsrv_query($this->_link, $query);
+ if (!$this->_result) {
+ $this->_get_error();
+ return false;
+ }
+ return true;
+ }
+
+ function store_result($result = null) {
+ if (!$result) {
+ $result = $this->_result;
+ }
+ if (sqlsrv_field_metadata($result)) {
+ return new Min_Result($result);
+ }
+ $this->affected_rows = sqlsrv_rows_affected($result);
+ return true;
+ }
+
+ function next_result() {
+ return sqlsrv_next_result($this->_result);
+ }
+
+ function result($query, $field = 0) {
+ $result = $this->query($query);
+ if (!is_object($result)) {
+ return false;
+ }
+ $row = $result->fetch_row();
+ return $row[$field];
+ }
+ }
+
+ class Min_Result {
+ var $_result, $_offset = 0, $_fields, $num_rows;
+
+ function Min_Result($result) {
+ $this->_result = $result;
+ $this->num_rows = sqlsrv_has_rows($result); //! sqlsrv_num_rows($result)
+ }
+
+ function _convert($row) {
+ foreach ((array) $row as $key => $val) {
+ if (is_a($val, 'DateTime')) {
+ $row[$key] = $val->format("Y-m-d H:i:s");
+ }
+ //! stream
+ }
+ return $row;
+ }
+
+ function fetch_assoc() {
+ return $this->_convert(sqlsrv_fetch_array($this->_result, SQLSRV_FETCH_ASSOC, SQLSRV_SCROLL_NEXT));
+ }
+
+ function fetch_row() {
+ return $this->_convert(sqlsrv_fetch_array($this->_result, SQLSRV_FETCH_NUMERIC, SQLSRV_SCROLL_NEXT));
+ }
+
+ function fetch_field() {
+ if (!$this->_fields) {
+ $this->_fields = sqlsrv_field_metadata($this->_result);
+ }
+ $field = $this->_fields[$this->_offset++];
+ $return = new stdClass;
+ $return->name = $field["Name"];
+ $return->orgname = $field["Name"];
+ $return->type = ($field["Type"] == 1 ? 254 : 0);
+ return $return;
+ }
+
+ function __destruct() {
+ sqlsrv_free_stmt($this->_result);
+ }
+ }
+
+ } elseif (extension_loaded("mssql")) {
+ class Min_DB {
+ var $extension = "MSSQL", $_link, $_result, $server_info, $affected_rows, $error;
+
+ function connect($server, $username, $password) {
+ $this->_link = @mssql_connect($server, $username, $password);
+ if ($this->_link) {
+ $result = $this->query("SELECT SERVERPROPERTY('ProductLevel'), SERVERPROPERTY('Edition')");
+ $row = $result->fetch_row();
+ $this->server_info = $this->result("sp_server_info 2", 2)." [$row[0]] $row[1]";
+ } else {
+ $this->error = mssql_get_last_message();
+ }
+ return (bool) $this->_link;
+ }
+
+ function quote($string) {
+ return "'" . str_replace("'", "''", $string) . "'";
+ }
+
+ function select_db($database) {
+ return mssql_select_db($database);
+ }
+
+ function query($query, $unbuffered = false) {
+ $result = mssql_query($query, $this->_link); //! $unbuffered
+ if (!$result) {
+ $this->error = mssql_get_last_message();
+ return false;
+ }
+ if ($result === true) {
+ $this->affected_rows = mssql_rows_affected($this->_link);
+ return true;
+ }
+ return new Min_Result($result);
+ }
+
+ function multi_query($query) {
+ return $this->_result = $this->query($query);
+ }
+
+ function store_result() {
+ return $this->_result;
+ }
+
+ function next_result() {
+ return mssql_next_result($this->_result);
+ }
+
+ function result($query, $field = 0) {
+ $result = $this->query($query);
+ if (!is_object($result)) {
+ return false;
+ }
+ return mssql_result($result->_result, 0, $field);
+ }
+ }
+
+ class Min_Result {
+ var $_result, $_offset = 0, $_fields, $num_rows;
+
+ function Min_Result($result) {
+ $this->_result = $result;
+ $this->num_rows = mssql_num_rows($result);
+ }
+
+ function fetch_assoc() {
+ return mssql_fetch_assoc($this->_result);
+ }
+
+ function fetch_row() {
+ return mssql_fetch_row($this->_result);
+ }
+
+ function num_rows() {
+ return mssql_num_rows($this->_result);
+ }
+
+ function fetch_field() {
+ $return = mssql_fetch_field($this->_result);
+ $return->orgtable = $return->table;
+ $return->orgname = $return->name;
+ return $return;
+ }
+
+ function __destruct() {
+ mssql_free_result($this->_result);
+ }
+ }
+
+ }
+
+ function idf_escape($idf) {
+ return "[" . str_replace("]", "]]", $idf) . "]";
+ }
+
+ function connect() {
+ global $adminer;
+ $connection = new Min_DB;
+ $credentials = $adminer->credentials();
+ if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
+ return $connection;
+ }
+ return $connection->error;
+ }
+
+ function get_databases() {
+ return get_vals("EXEC sp_databases");
+ }
+
+ function limit($query, $limit, $offset = 0) {
+ return (isset($limit) ? " TOP ($limit)" : "") . " $query"; //! offset
+ }
+
+ function limit1($query, $limit, $offset = 0) {
+ return limit($query, 1);
+ }
+
+ function db_collation($db, $collations) {
+ global $connection;
+ return $connection->result("SELECT collation_name FROM sys.databases WHERE name = " . $connection->quote($db));
+ }
+
+ function engines() {
+ return array();
+ }
+
+ function logged_user() {
+ global $connection;
+ return $connection->result("SELECT SUSER_NAME()");
+ }
+
+ function tables_list() {
+ return get_key_vals("SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES");
+ }
+
+ function count_tables($databases) {
+ global $connection;
+ $return = array();
+ foreach ($databases as $db) {
+ $connection->select_db($db);
+ $return[$db] = $connection->result("SELECT COUNT(*) FROM information_schema.TABLES");
+ }
+ return $return;
+ }
+
+ function table_status($name = "") {
+ global $connection;
+ $return = array();
+ $result = $connection->query("SELECT TABLE_NAME AS Name, TABLE_TYPE AS Engine FROM information_schema.TABLES" . ($name != "" ? " WHERE TABLE_NAME = " . $connection->quote($name) : ""));
+ while ($row = $result->fetch_assoc()) {
+ if ($name != "") {
+ return $row;
+ }
+ $return[$row["Name"]] = $row;
+ }
+ return $return;
+ }
+
+ function fk_support($table_status) {
+ return true;
+ }
+
+ function fields($table) {
+ global $connection;
+ $return = array();
+ $result = $connection->query("SELECT * FROM information_schema.COLUMNS WHERE TABLE_NAME = " . $connection->quote($table));
+ while ($row = $result->fetch_assoc()) {
+ $return[$row["COLUMN_NAME"]] = array(
+ "field" => $row["COLUMN_NAME"],
+ "full_type" => $row["DATA_TYPE"],
+ "type" => $row["DATA_TYPE"],
+ "length" => $row["CHARACTER_MAXIMUM_LENGTH"], //! NUMERIC_, DATETIME_?
+ "default" => $row["COLUMN_DEFAULT"],
+ "null" => ($row["IS_NULLABLE"] == "YES"),
+ "collation" => $row["COLLATION_NAME"],
+ "privileges" => array("insert" => 1, "select" => 1, "update" => 1),
+ //! primary - is_identity in sys.columns
+ );
+ }
+ return $return;
+ }
+
+ function indexes($table, $connection2 = null) {
+ global $connection;
+ if (!is_object($connection2)) {
+ $connection2 = $connection;
+ }
+ $return = array();
+ // sp_statistics doesn't return information about primary key
+ $result = $connection2->query("SELECT indexes.name, key_ordinal, is_unique, is_primary_key, columns.name AS column_name
+FROM sys.indexes
+INNER JOIN sys.index_columns ON indexes.object_id = index_columns.object_id AND indexes.index_id = index_columns.index_id
+INNER JOIN sys.columns ON index_columns.object_id = columns.object_id AND index_columns.column_id = columns.column_id
+WHERE OBJECT_NAME(indexes.object_id) = " . $connection2->quote($table));
+ if ($result) {
+ while ($row = $result->fetch_assoc()) {
+ $return[$row["name"]]["type"] = ($row["is_primary_key"] ? "PRIMARY" : ($row["is_unique"] ? "UNIQUE" : "INDEX"));
+ $return[$row["name"]]["columns"][$row["key_ordinal"]] = $row["column_name"];
+ }
+ }
+ return $return;
+ }
+
+ function collations() {
+ $return = array();
+ foreach (get_vals("SELECT name FROM fn_helpcollations()") as $collation) {
+ $return[ereg_replace("_.*", "", $collation)][] = $collation;
+ }
+ return $return;
+ }
+
+ function information_schema($db) {
+ return false;
+ }
+
+ function error() {
+ global $connection;
+ return nl_br(h(ereg_replace("^(\\[[^]]*])+", "", $connection->error)));
+ }
+
+ function exact_value($val) {
+ global $connection;
+ return $connection->quote($val);
+ }
+
+ function rename_database($name, $collation) {
+ if ($collation) {
+ queries("ALTER DATABASE " . idf_escape(DB) . " COLLATE " . idf_escape($collation));
+ }
+ return queries("ALTER DATABASE " . idf_escape(DB) . " MODIFY NAME = " . idf_escape($name)); //! false negative "The database name 'test2' has been set."
+ }
+
+ function auto_increment() {
+ return " IDENTITY";
+ }
+
+ function explain($connection, $query) {
+ $connection->query("SET SHOWPLAN_ALL ON");
+ $return = $connection->query($query);
+ $connection->query("SET SHOWPLAN_ALL OFF"); // connection is used also for indexes
+ return $return;
+ }
+
+ function support($feature) {
+ return ereg('^(view|routine|trigger)$', $feature);
+ }
+
+ $driver = "mssql";
+ $types = array();
+ $structured_types = array();
+ foreach (array(
+ lang('Numbers') => array("tinyint" => 3, "smallint" => 5, "int" => 10, "bigint" => 20, "bit" => 1, "decimal" => 0, "real" => 12, "float" => 53, "smallmoney" => 10, "money" => 20),
+ lang('Date and time') => array("date" => 10, "smalldatetime" => 19, "datetime" => 19, "datetime2" => 19, "time" => 8, "datetimeoffset" => 10),
+ lang('Strings') => array("char" => 8000, "varchar" => 8000, "text" => 2147483647, "nchar" => 4000, "nvarchar" => 4000, "ntext" => 1073741823),
+ lang('Binary') => array("binary" => 8000, "varbinary" => 8000, "image" => 2147483647),
+ ) as $key => $val) {
+ $types += $val;
+ $structured_types[$key] = array_keys($val);
+ }
+ $unsigned = array();
+ $operators = array("=", "<", ">", "<=", ">=", "!=", "LIKE", "LIKE %%", "IN", "IS NULL", "NOT LIKE", "NOT IN", "IS NOT NULL");
+ $functions = array("len", "lower", "round", "upper");
+ $grouping = array("avg", "count", "count distinct", "max", "min", "sum");
+ $edit_functions = array(
+ array(
+ "date|time" => "getdate",
+ ), array(
+ "int|decimal|real|float|money|datetime" => "+/-",
+ "char|text" => "+",
+ )
+ );
+}
Deleted: trunk/adminer/drivers/mysql.inc.php
===================================================================
--- branches/sqlite/adminer/drivers/mysql.inc.php 2010-04-21 11:46:05 UTC (rev 1465)
+++ trunk/adminer/drivers/mysql.inc.php 2010-04-21 12:01:32 UTC (rev 1466)
@@ -1,713 +0,0 @@
-<?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;
-}
-
-if (!defined("DRIVER")) {
- 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")) {
- class Min_DB extends MySQLi {
- var $extension = "MySQLi";
-
- function Min_DB() {
- parent::init();
- }
-
- function connect($server, $username, $password) {
- list($host, $port) = explode(":", $server, 2); // part after : is used for port or socket
- return @$this->real_connect(
- ($server != "" ? $host : ini_get("mysqli.default_host")),
- ("$server$username" != "" ? $username : ini_get("mysqli.default_user")),
- ("$server$username$password" != "" ? $password : ini_get("mysqli.default_pw")),
- null,
- (is_numeric($port) ? $port : ini_get("mysqli.default_port")),
- (!is_numeric($port) ? $port : null)
- );
- }
-
- function result($query, $field = 0) {
- $result = $this->query($query);
- if (!$result) {
- return false;
- }
- $row = $result->fetch_array();
- return $row[$field];
- }
-
- function quote($string) {
- return "'" . $this->escape_string($string) . "'";
- }
- }
-
- } elseif (extension_loaded("mysql")) {
- class Min_DB {
- var
- $extension = "MySQL", ///< @var string extension name
- $server_info, ///< @var string server version
- $affected_rows, ///< @var int number of affected rows
- $error, ///< @var string last error message
- $_link, $_result ///< @access private
- ;
-
- /** Connect to server
- * @param string
- * @param string
- * @param string
- * @return bool
- */
- function connect($server, $username, $password) {
- $this->_link = @mysql_connect(
- ($server != "" ? $server : ini_get("mysql.default_host")),
- ("$server$username" != "" ? $username : ini_get("mysql.default_user")),
- ("$server$username$password" != "" ? $password : ini_get("mysql.default_password")),
- true,
- 131072 // CLIENT_MULTI_RESULTS for CALL
- );
- if ($this->_link) {
- $this->server_info = mysql_get_server_info($this->_link);
- } else {
- $this->error = mysql_error();
- }
- return (bool) $this->_link;
- }
-
- /** Quote string to use in SQL
- * @param string
- * @return string escaped string enclosed in '
- */
- function quote($string) {
- return "'" . mysql_real_escape_string($string, $this->_link) . "'";
- }
-
- /** Select database
- * @param string
- * @return bool
- */
- function select_db($database) {
- return mysql_select_db($database, $this->_link);
- }
-
- /** Send query
- * @param string
- * @param bool
- * @return mixed bool or Min_Result
- */
- function query($query, $unbuffered = false) {
- $result = @($unbuffered ? mysql_unbuffered_query($query, $this->_link) : mysql_query($query, $this->_link)); // @ - mute mysql.trace_mode
- if (!$result) {
- $this->error = mysql_error($this->_link);
- return false;
- }
- if ($result === true) {
- $this->affected_rows = mysql_affected_rows($this->_link);
- $this->info = mysql_info($this->_link);
- return true;
- }
- return new Min_Result($result);
- }
-
- /** Send query with more resultsets
- * @param string
- * @return bool
- */
- function multi_query($query) {
- return $this->_result = $this->query($query);
- }
-
- /** Get current resultset
- * @return Min_Result
- */
- function store_result() {
- return $this->_result;
- }
-
- /** Fetch next resultset
- * @return bool
- */
- function next_result() {
- // MySQL extension doesn't support multiple results
- return false;
- }
-
- /** Get single field from result
- * @param string
- * @param int
- * @return string
- */
- function result($query, $field = 0) {
- $result = $this->query($query);
- if (!$result) {
- return false;
- }
- return mysql_result($result->_result, 0, $field);
- }
- }
-
- class Min_Result {
- var
- $num_rows, ///< @var int number of rows in the result
- $_result ///< @access private
- ;
-
- /** Constructor
- * @param resource
- */
- function Min_Result($result) {
- $this->_result = $result;
- $this->num_rows = mysql_num_rows($result);
- }
-
- /** Fetch next row as associative array
- * @return array
- */
- function fetch_assoc() {
- return mysql_fetch_assoc($this->_result);
- }
-
- /** Fetch next row as numbered array
- * @return array
- */
- function fetch_row() {
- return mysql_fetch_row($this->_result);
- }
-
- /** Fetch next field
- * @return object properties: name, type, orgtable, orgname, charsetnr
- */
- function fetch_field() {
- $return = mysql_fetch_field($this->_result);
- $return->orgtable = $return->table;
- $return->orgname = $return->name;
- $return->charsetnr = ($return->blob ? 63 : 0);
- return $return;
- }
-
- /** Free result set
- */
- function __destruct() {
- mysql_free_result($this->_result); //! not called in PHP 4 which is a problem with mysql.trace_mode
- }
- }
-
- } elseif (extension_loaded("pdo_mysql")) {
- 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);
- return true;
- }
-
- function select_db($database) {
- // database selection is separated from the connection so dbname in DSN can't be used
- return $this->query("USE " . idf_escape($database));
- }
-
- function query($query, $unbuffered = false) {
- $this->setAttribute(1000, !$unbuffered); // 1000 - PDO::MYSQL_ATTR_USE_BUFFERED_QUERY
- return parent::query($query, $unbuffered);
- }
- }
-
- }
-
- /** Escape database identifier
- * @param string
- * @return string
- */
- function idf_escape($idf) {
- return "`" . str_replace("`", "``", $idf) . "`";
- }
-
- /** Connect to the database
- * @return mixed Min_DB or string for error
- */
- function connect() {
- global $adminer;
- $connection = new Min_DB;
- $credentials = $adminer->credentials();
- if ($connection->connect($credentials[0], $credentials[1], $credentials[2])) {
- $connection->query("SET SQL_QUOTE_SHOW_CREATE=1");
- $connection->query("SET NAMES utf8");
- return $connection;
- }
- return $connection->error;
- }
-
- /** Get cached list of databases
- * @param bool
- * @return array
- */
- function get_databases($flush = true) {
- // SHOW DATABASES can take a very long time so it is cached
- $return = &get_session("databases");
- if (!isset($return)) {
- if ($flush) {
- restart_session();
- ob_flush();
- flush();
- }
- $return = get_vals("SHOW DATABASES");
- }
- return $return;
- }
-
- /** Formulate SQL query with limit
- * @param string everything after SELECT
- * @param int
- * @param int
- * @return string
- */
- function limit($query, $limit, $offset = 0) {
- return " $query" . (isset($limit) ? "\nLIMIT $limit" . ($offset ? " OFFSET $offs...
[truncated message content] |
|
From: <jak...@us...> - 2010-04-21 11:46:11
|
Revision: 1465
http://adminer.svn.sourceforge.net/adminer/?rev=1465&view=rev
Author: jakubvrana
Date: 2010-04-21 11:46:05 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Merge from trunk to reintegrate (branch moved to trunk)
Modified Paths:
--------------
branches/sqlite/changes.txt
branches/sqlite/version.js
Property Changed:
----------------
branches/sqlite/
branches/sqlite/adminer/drivers/mysql.inc.php
Property changes on: branches/sqlite
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:1193-1443
+ /trunk:1193-1464
Property changes on: branches/sqlite/adminer/drivers/mysql.inc.php
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk/adminer/drivers/mysql.inc.php:1193-1443
/trunk/adminer/include/mysql.inc.php:675-681,1193-1443
+ /trunk/adminer/drivers/mysql.inc.php:1193-1464
/trunk/adminer/include/mysql.inc.php:675-681,1193-1443
Modified: branches/sqlite/changes.txt
===================================================================
--- branches/sqlite/changes.txt 2010-04-21 11:27:16 UTC (rev 1464)
+++ branches/sqlite/changes.txt 2010-04-21 11:46:05 UTC (rev 1465)
@@ -8,6 +8,10 @@
Defer table information in database overview to JavaScript (performance)
Big tables optimizations (performance)
+Adminer 2.3.2 (released 2010-04-21):
+Fix COUNT(*) link
+Fix Save and continue edit
+
Adminer 2.3.1 (released 2010-04-06):
Add Drop button to Alter pages (regression from 2.0.0)
Link COUNT(*) result to listing
Modified: branches/sqlite/version.js
===================================================================
--- branches/sqlite/version.js 2010-04-21 11:27:16 UTC (rev 1464)
+++ branches/sqlite/version.js 2010-04-21 11:46:05 UTC (rev 1465)
@@ -2,5 +2,5 @@
(function () { // cookie function is not defined in older versions
var date = new Date();
date.setDate(date.getDate() + 7); // valid for 7 days
- document.cookie = 'adminer_version=2.3.1; expires=' + date; // last released version
+ document.cookie = 'adminer_version=2.3.2; expires=' + date; // last released version
})();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 11:27:22
|
Revision: 1464
http://adminer.svn.sourceforge.net/adminer/?rev=1464&view=rev
Author: jakubvrana
Date: 2010-04-21 11:27:16 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Release 2.3.2
Added Paths:
-----------
tags/2_3_2/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 11:25:15
|
Revision: 1463
http://adminer.svn.sourceforge.net/adminer/?rev=1463&view=rev
Author: jakubvrana
Date: 2010-04-21 11:25:09 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Release 2.3.2
Modified Paths:
--------------
trunk/adminer/include/version.inc.php
trunk/changes.txt
trunk/version.js
Modified: trunk/adminer/include/version.inc.php
===================================================================
--- trunk/adminer/include/version.inc.php 2010-04-21 11:08:44 UTC (rev 1462)
+++ trunk/adminer/include/version.inc.php 2010-04-21 11:25:09 UTC (rev 1463)
@@ -1,2 +1,2 @@
<?php
-$VERSION = "2.3.2-dev";
+$VERSION = "2.3.2";
Modified: trunk/changes.txt
===================================================================
--- trunk/changes.txt 2010-04-21 11:08:44 UTC (rev 1462)
+++ trunk/changes.txt 2010-04-21 11:25:09 UTC (rev 1463)
@@ -1,3 +1,7 @@
+Adminer 2.3.2 (released 2010-04-21):
+Fix COUNT(*) link
+Fix Save and continue edit
+
Adminer 2.3.1 (released 2010-04-06):
Add Drop button to Alter pages (regression from 2.0.0)
Link COUNT(*) result to listing
Modified: trunk/version.js
===================================================================
--- trunk/version.js 2010-04-21 11:08:44 UTC (rev 1462)
+++ trunk/version.js 2010-04-21 11:25:09 UTC (rev 1463)
@@ -2,5 +2,5 @@
(function () { // cookie function is not defined in older versions
var date = new Date();
date.setDate(date.getDate() + 7); // valid for 7 days
- document.cookie = 'adminer_version=2.3.1; expires=' + date; // last released version
+ document.cookie = 'adminer_version=2.3.2; expires=' + date; // last released version
})();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 11:08:50
|
Revision: 1462
http://adminer.svn.sourceforge.net/adminer/?rev=1462&view=rev
Author: jakubvrana
Date: 2010-04-21 11:08:44 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Allow semicolon as CSV separator
Modified Paths:
--------------
branches/sqlite/adminer/include/adminer.inc.php
branches/sqlite/adminer/include/export.inc.php
branches/sqlite/adminer/include/functions.inc.php
branches/sqlite/adminer/select.inc.php
branches/sqlite/changes.txt
branches/sqlite/editor/include/adminer.inc.php
Modified: branches/sqlite/adminer/include/adminer.inc.php
===================================================================
--- branches/sqlite/adminer/include/adminer.inc.php 2010-04-21 09:00:16 UTC (rev 1461)
+++ branches/sqlite/adminer/include/adminer.inc.php 2010-04-21 11:08:44 UTC (rev 1462)
@@ -472,7 +472,7 @@
* @return string
*/
function dumpFormat($select, $value = "") {
- return html_select("format", array('sql' => 'SQL', 'csv' => 'CSV'), $value, $select);
+ return html_select("format", array('sql' => 'SQL', 'csv' => 'CSV,', 'csv;' => 'CSV;'), $value, $select);
}
/** Prints navigation after Adminer title
Modified: branches/sqlite/adminer/include/export.inc.php
===================================================================
--- branches/sqlite/adminer/include/export.inc.php 2010-04-21 09:00:16 UTC (rev 1461)
+++ branches/sqlite/adminer/include/export.inc.php 2010-04-21 11:08:44 UTC (rev 1462)
@@ -26,7 +26,7 @@
function dump_table($table, $style, $is_view = false) {
global $connection;
- if ($_POST["format"] == "csv") {
+ if ($_POST["format"] != "sql") {
echo "\xef\xbb\xbf"; // UTF-8 byte order mark
if ($style) {
dump_csv(array_keys(fields($table)));
@@ -118,7 +118,7 @@
global $connection, $driver;
$max_packet = ($driver == "sqlite" ? 0 : 1048576); // default, minimum is 1024
if ($style) {
- if ($_POST["format"] != "csv" && $style == "TRUNCATE+INSERT") {
+ if ($_POST["format"] == "sql" && $style == "TRUNCATE+INSERT") {
echo "TRUNCATE " . idf_escape($table) . ";\n";
}
$fields = fields($table);
@@ -127,7 +127,7 @@
$insert = "";
$buffer = "";
while ($row = $result->fetch_assoc()) {
- if ($_POST["format"] == "csv") {
+ if ($_POST["format"] != "sql") {
dump_csv($row);
} else {
if (!$insert) {
@@ -157,7 +157,7 @@
}
}
}
- if ($_POST["format"] != "csv" && $style != "INSERT+UPDATE" && $buffer) {
+ if ($_POST["format"] == "sql" && $style != "INSERT+UPDATE" && $buffer) {
$buffer .= ";\n";
echo $buffer;
}
Modified: branches/sqlite/adminer/include/functions.inc.php
===================================================================
--- branches/sqlite/adminer/include/functions.inc.php 2010-04-21 09:00:16 UTC (rev 1461)
+++ branches/sqlite/adminer/include/functions.inc.php 2010-04-21 11:08:44 UTC (rev 1462)
@@ -593,11 +593,11 @@
*/
function dump_csv($row) {
foreach ($row as $key => $val) {
- if (preg_match("~[\"\n,]~", $val) || $val === "") {
+ if (preg_match("~[\"\n,;]~", $val) || $val === "") {
$row[$key] = '"' . str_replace('"', '""', $val) . '"';
}
}
- echo implode(",", $row) . "\n";
+ echo implode(($_POST["format"] == "csv;" ? ";" : ","), $row) . "\n";
}
/** Apply SQL function
Modified: branches/sqlite/adminer/select.inc.php
===================================================================
--- branches/sqlite/adminer/select.inc.php 2010-04-21 09:00:16 UTC (rev 1461)
+++ branches/sqlite/adminer/select.inc.php 2010-04-21 11:08:44 UTC (rev 1462)
@@ -118,8 +118,9 @@
preg_match_all('~(?>"[^"]*"|[^"\\r\\n]+)+~', $file, $matches);
$affected = count($matches[0]);
queries("START TRANSACTION");
+ $separator = ($_POST["separator"] == ";" ? ";" : ",");
foreach ($matches[0] as $key => $val) {
- preg_match_all('~(("[^"]*")+|[^,]*),~', "$val,", $matches2);
+ preg_match_all("~((\"[^\"]*\")+|[^$separator]*)$separator~", $val . $separator, $matches2);
if (!$key && !array_diff($matches2[1], $cols)) { //! doesn't work with column names containing ",\n
// first row corresponds to column names - use it for table structure
$cols = $matches2[1];
@@ -290,6 +291,8 @@
echo "</table>\n";
}
+ parse_str($_COOKIE["adminer_export"], $adminer_export);
+
if ($rows || $_GET["page"]) {
$exact_count = true;
if (intval($limit) && count($group) >= count($select) && ($found_rows >= $limit || $_GET["page"])) {
@@ -317,12 +320,14 @@
echo (information_schema(DB) ? "" : "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' name='edit' value='" . lang('Edit') . "'> <input type='submit' name='clone' value='" . lang('Clone') . "'> <input type='submit' name='delete' value='" . lang('Delete') . "' onclick=\"return confirm('" . lang('Are you sure?') . " (' + (this.form['all'].checked ? $found_rows : formChecked(this, /check/)) + ')');\"></div></fieldset>\n");
print_fieldset("export", lang('Export'));
- echo $adminer->dumpOutput(1) . " " . $adminer->dumpFormat(1); // 1 - select
+ echo $adminer->dumpOutput(1, $adminer_export["output"]) . " " . $adminer->dumpFormat(1, $adminer_export["format"]); // 1 - select
echo " <input type='submit' name='export' value='" . lang('Export') . "'>\n";
echo "</div></fieldset>\n";
}
print_fieldset("import", lang('CSV Import'), !$result->num_rows);
- echo "<input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> <input type='submit' name='import' value='" . lang('Import') . "'>\n";
+ echo "<input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> ";
+ echo html_select("separator", array(",", ";"), ($adminer_export["format"] == "csv;" ? ";" : ","), 1); // 1 - select
+ echo " <input type='submit' name='import' value='" . lang('Import') . "'>\n";
echo "</div></fieldset>\n";
$adminer->selectEmailPrint(array_filter($email_fields, 'strlen'), $columns);
Modified: branches/sqlite/changes.txt
===================================================================
--- branches/sqlite/changes.txt 2010-04-21 09:00:16 UTC (rev 1461)
+++ branches/sqlite/changes.txt 2010-04-21 11:08:44 UTC (rev 1462)
@@ -4,6 +4,7 @@
Allow concurrent logins on the same server
Operator LIKE %%
Remember export parameters in cookie
+Allow semicolon as CSV separator
Defer table information in database overview to JavaScript (performance)
Big tables optimizations (performance)
Modified: branches/sqlite/editor/include/adminer.inc.php
===================================================================
--- branches/sqlite/editor/include/adminer.inc.php 2010-04-21 09:00:16 UTC (rev 1461)
+++ branches/sqlite/editor/include/adminer.inc.php 2010-04-21 11:08:44 UTC (rev 1462)
@@ -427,12 +427,12 @@
return $return;
}
- function dumpOutput($select) {
+ function dumpOutput($select, $value = "") {
return "";
}
- function dumpFormat($select) {
- return "CSV";
+ function dumpFormat($select, $value = "") {
+ return html_select("format", array('csv' => 'CSV,', 'csv;' => 'CSV;'), $value, $select);
}
function navigation($missing) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-21 09:00:22
|
Revision: 1461
http://adminer.svn.sourceforge.net/adminer/?rev=1461&view=rev
Author: jakubvrana
Date: 2010-04-21 09:00:16 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
Use underscore for non-public members
Modified Paths:
--------------
branches/sqlite/editor/include/adminer.inc.php
Modified: branches/sqlite/editor/include/adminer.inc.php
===================================================================
--- branches/sqlite/editor/include/adminer.inc.php 2010-04-20 21:42:20 UTC (rev 1460)
+++ branches/sqlite/editor/include/adminer.inc.php 2010-04-21 09:00:16 UTC (rev 1461)
@@ -1,7 +1,7 @@
<?php
class Adminer {
var $operators = array("<=", ">=");
- /*protected*/ var $values = array();
+ var $_values = array();
function name() {
return lang('Editor');
@@ -134,7 +134,7 @@
$ids[$row[$key]] = exact_value($row[$key]);
}
// uses constant number of queries to get the descriptions, join would be complex, multiple queries would be slow
- $descriptions = $this->values[$foreignKey["table"]];
+ $descriptions = $this->_values[$foreignKey["table"]];
if (!$descriptions) {
$descriptions = get_key_vals("SELECT $id, $name FROM " . idf_escape($foreignKey["table"]) . " WHERE $id IN (" . implode(", ", $ids) . ")");
}
@@ -205,7 +205,7 @@
}
}
foreach ($columns as $name => $desc) {
- $options = $this->foreignKeyOptions($_GET["select"], $name);
+ $options = $this->_foreignKeyOptions($_GET["select"], $name);
if ($options) {
$key = $keys[$name];
$i--;
@@ -396,7 +396,7 @@
if ($field["type"] == "enum") {
return ($field["null"] ? "<input type='radio'$attrs value=''" . ($value || isset($_GET["select"]) ? "" : " checked") . ">" : "");
}
- $options = $this->foreignKeyOptions($table, $field["field"]);
+ $options = $this->_foreignKeyOptions($table, $field["field"]);
if ($options) {
return "<select$attrs>" . optionlist($options, $value, true) . "</select>";
}
@@ -474,7 +474,7 @@
}
}
- /*protected */function foreignKeyOptions($table, $column) {
+ function _foreignKeyOptions($table, $column) {
global $connection;
$table_status = table_status($table);
$foreignKeys = column_foreign_keys($table);
@@ -483,7 +483,7 @@
$id = idf_escape($foreignKey["target"][0]);
$name = $this->rowDescription($foreignKey["table"]);
if ($name != "") {
- $return = &$this->values[$foreignKey["table"]];
+ $return = &$this->_values[$foreignKey["table"]];
if (!isset($return)) {
$return = ($table_status["Rows"] > 1000 ? array() : array("" => "") + get_key_vals("SELECT $id, $name FROM " . idf_escape($foreignKey["table"]) . " ORDER BY 2"));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-20 21:42:26
|
Revision: 1460
http://adminer.svn.sourceforge.net/adminer/?rev=1460&view=rev
Author: jakubvrana
Date: 2010-04-20 21:42:20 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Introduce ini_bool function
Modified Paths:
--------------
branches/sqlite/adminer/drivers/pgsql.inc.php
branches/sqlite/adminer/include/auth.inc.php
branches/sqlite/adminer/include/bootstrap.inc.php
branches/sqlite/adminer/include/functions.inc.php
branches/sqlite/adminer/sql.inc.php
Modified: branches/sqlite/adminer/drivers/pgsql.inc.php
===================================================================
--- branches/sqlite/adminer/drivers/pgsql.inc.php 2010-04-19 19:34:05 UTC (rev 1459)
+++ branches/sqlite/adminer/drivers/pgsql.inc.php 2010-04-20 21:42:20 UTC (rev 1460)
@@ -12,7 +12,7 @@
var $extension = "PgSQL", $_link, $_result, $_string, $_database = true, $server_info, $affected_rows, $error;
function _error($errno, $error) {
- if (ini_get("html_errors")) {
+ if (ini_bool("html_errors")) {
$error = html_entity_decode(strip_tags($error));
}
$error = ereg_replace('^[^:]*: ', '', $error);
Modified: branches/sqlite/adminer/include/auth.inc.php
===================================================================
--- branches/sqlite/adminer/include/auth.inc.php 2010-04-19 19:34:05 UTC (rev 1459)
+++ branches/sqlite/adminer/include/auth.inc.php 2010-04-20 21:42:20 UTC (rev 1460)
@@ -61,7 +61,7 @@
global $connection, $adminer, $token;
$session_name = session_name();
$error = "";
- if (!$_COOKIE[$session_name] && $_GET[$session_name] && ini_get("session.use_only_cookies")) {
+ if (!$_COOKIE[$session_name] && $_GET[$session_name] && ini_bool("session.use_only_cookies")) {
$error = lang('Session support must be enabled.');
} elseif (isset($_GET["username"])) {
if (($_COOKIE[$session_name] || $_GET[$session_name]) && !$token) {
Modified: branches/sqlite/adminer/include/bootstrap.inc.php
===================================================================
--- branches/sqlite/adminer/include/bootstrap.inc.php 2010-04-19 19:34:05 UTC (rev 1459)
+++ branches/sqlite/adminer/include/bootstrap.inc.php 2010-04-20 21:42:20 UTC (rev 1460)
@@ -39,12 +39,14 @@
exit;
}
+include "../adminer/include/functions.inc.php";
+
if (!isset($_SERVER["REQUEST_URI"])) {
$_SERVER["REQUEST_URI"] = $_SERVER["ORIG_PATH_INFO"] . ($_SERVER["QUERY_STRING"] != "" ? "?$_SERVER[QUERY_STRING]" : ""); // IIS 5 compatibility
}
@ini_set("session.use_trans_sid", false); // protect links in export, @ - may be disabled
-if (!ini_get("session.auto_start")) {
+if (!ini_bool("session.auto_start")) {
session_name("adminer_sid"); // use specific session name to get own namespace
$params = array(0, preg_replace('~\\?.*~', '', $_SERVER["REQUEST_URI"]), "", $_SERVER["HTTPS"] && strcasecmp($_SERVER["HTTPS"], "off"));
if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
@@ -75,7 +77,6 @@
}
@set_time_limit(0); // @ - can be disabled
-include "../adminer/include/functions.inc.php";
include "../adminer/include/lang.inc.php";
include "../adminer/lang/$LANG.inc.php";
include "../adminer/include/pdo.inc.php";
@@ -103,7 +104,7 @@
include "./include/export.inc.php";
session_cache_limiter(""); // to allow restarting session
-if (!ini_get("session.use_cookies") || @ini_set("session.use_cookies", false) !== false) { // @ - may be disabled
+if (!ini_bool("session.use_cookies") || @ini_set("session.use_cookies", false) !== false) { // @ - may be disabled
session_write_close(); // improves concurrency if a user opens several pages at once, may be restarted later
}
Modified: branches/sqlite/adminer/include/functions.inc.php
===================================================================
--- branches/sqlite/adminer/include/functions.inc.php 2010-04-19 19:34:05 UTC (rev 1459)
+++ branches/sqlite/adminer/include/functions.inc.php 2010-04-20 21:42:20 UTC (rev 1460)
@@ -115,6 +115,15 @@
return $return;
}
+/** Get INI boolean value
+* @param string
+* @return bool
+*/
+function ini_bool($ini) {
+ $val = ini_get($ini);
+ return (eregi('^(on|true|yes)$', $val) || (int) $val); // boolean values set by php_value are strings
+}
+
/** Get list of values from database
* @param string
* @param mixed
@@ -236,7 +245,7 @@
* @return null
*/
function restart_session() {
- if (!ini_get("session.use_cookies")) {
+ if (!ini_bool("session.use_cookies")) {
session_start();
}
}
@@ -502,7 +511,7 @@
$checked = (is_int($value) ? ($value >> $i) & 1 : in_array($val, explode(",", $value), true));
echo " <label><input type='checkbox' name='fields[$name][$i]' value='" . (1 << $i) . "'" . ($checked ? ' checked' : '') . "$onchange>" . h($val) . '</label>';
}
- } elseif (ereg('binary|blob|bytea', $field["type"]) && ini_get("file_uploads")) {
+ } elseif (ereg('binary|blob|bytea', $field["type"]) && ini_bool("file_uploads")) {
echo "<input type='file' name='fields-$name'$onchange>";
} elseif (ereg('text|blob', $field["type"])) {
echo "<textarea cols='50' rows='" . ($driver != "sqlite" || ereg("\n", $value) ? 12 : 1) . "'$attrs>" . h($value) . '</textarea>';
@@ -544,7 +553,7 @@
if ($field["type"] == "set") {
return array_sum((array) $value);
}
- if (ereg('binary|blob|bytea', $field["type"]) && ini_get("file_uploads")) {
+ if (ereg('binary|blob|bytea', $field["type"]) && ini_bool("file_uploads")) {
$file = get_file("fields-$idf");
if (!is_string($file)) {
return false; //! report errors
Modified: branches/sqlite/adminer/sql.inc.php
===================================================================
--- branches/sqlite/adminer/sql.inc.php 2010-04-19 19:34:05 UTC (rev 1459)
+++ branches/sqlite/adminer/sql.inc.php 2010-04-20 21:42:20 UTC (rev 1460)
@@ -29,7 +29,7 @@
$history[] = $query;
}
$space = "(\\s|/\\*.*\\*/|(#|-- )[^\n]*\n|--\n)";
- if (!ini_get("session.use_cookies")) {
+ if (!ini_bool("session.use_cookies")) {
session_write_close();
}
$delimiter = ";";
@@ -145,7 +145,7 @@
<p>
<?php
-if (!ini_get("file_uploads")) {
+if (!ini_bool("file_uploads")) {
echo lang('File uploads are disabled.');
} else { ?>
<?php echo lang('File upload'); ?>: <input type="file" name="sql_file">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-19 19:34:11
|
Revision: 1459
http://adminer.svn.sourceforge.net/adminer/?rev=1459&view=rev
Author: jakubvrana
Date: 2010-04-19 19:34:05 +0000 (Mon, 19 Apr 2010)
Log Message:
-----------
Column comment only if necessary
Modified Paths:
--------------
branches/sqlite/adminer/drivers/pgsql.inc.php
branches/sqlite/adminer/include/editing.inc.php
Modified: branches/sqlite/adminer/drivers/pgsql.inc.php
===================================================================
--- branches/sqlite/adminer/drivers/pgsql.inc.php 2010-04-18 01:48:09 UTC (rev 1458)
+++ branches/sqlite/adminer/drivers/pgsql.inc.php 2010-04-19 19:34:05 UTC (rev 1459)
@@ -330,7 +330,7 @@
$alter[] = "ALTER $column " . ($val[2] == " NULL" ? "DROP NOT" : "SET") . $val[2];
}
}
- if ($table != "" || $val5 != " COMMENT ''") {
+ if ($table != "" || $val5 != "") {
$queries[] = "COMMENT ON COLUMN " . idf_escape($table) . ".$val[0] IS " . substr($val5, 9);
}
}
Modified: branches/sqlite/adminer/include/editing.inc.php
===================================================================
--- branches/sqlite/adminer/include/editing.inc.php 2010-04-18 01:48:09 UTC (rev 1458)
+++ branches/sqlite/adminer/include/editing.inc.php 2010-04-19 19:34:05 UTC (rev 1459)
@@ -152,7 +152,7 @@
($field["null"] ? " NULL" : " NOT NULL"), // NULL for timestamp
(isset($field["default"]) ? " DEFAULT " . ($field["type"] == "timestamp" && eregi("^CURRENT_TIMESTAMP$", $field["default"]) ? $field["default"] : $connection->quote($field["default"])) : ""),
($field["on_update"] ? " ON UPDATE $field[on_update]" : ""),
- (support("comment") ? " COMMENT " . $connection->quote($field["comment"]) : ""),
+ (support("comment") && $field["comment"] != "" ? " COMMENT " . $connection->quote($field["comment"]) : ""),
($field["auto_increment"] ? auto_increment() : ""),
);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-18 01:48:15
|
Revision: 1458
http://adminer.svn.sourceforge.net/adminer/?rev=1458&view=rev
Author: jakubvrana
Date: 2010-04-18 01:48:09 +0000 (Sun, 18 Apr 2010)
Log Message:
-----------
Introduce setHtml function
Modified Paths:
--------------
branches/sqlite/adminer/db.inc.php
branches/sqlite/adminer/include/connect.inc.php
branches/sqlite/adminer/static/functions.js
Modified: branches/sqlite/adminer/db.inc.php
===================================================================
--- branches/sqlite/adminer/db.inc.php 2010-04-18 00:25:19 UTC (rev 1457)
+++ branches/sqlite/adminer/db.inc.php 2010-04-18 01:48:09 UTC (rev 1458)
@@ -131,26 +131,26 @@
echo "<script type='text/javascript'>\n";
foreach ($table_status as $row) {
$id = addcslashes($row["Name"], "\\'/");
- echo "document.getElementById('Comment-$id').innerHTML = '" . nbsp($row["Comment"]) . "';\n";
+ echo "setHtml('Comment-$id', '" . nbsp($row["Comment"]) . "');\n";
if (!eregi("view", $row["Engine"])) {
foreach (array("Engine", "Collation") as $key) {
- echo "document.getElementById('$key-$id').innerHTML = '" . nbsp($row[$key]) . "';\n";
+ echo "setHtml('$key-$id', '" . nbsp($row[$key]) . "');\n";
}
foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) {
if ($row[$key] != "") {
$val = number_format($row[$key], 0, '.', lang(','));
- echo "document.getElementById('$key-$id').innerHTML = '" . ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "';\n";
+ echo "setHtml('$key-$id', '" . ($key == "Rows" && $row["Engine"] == "InnoDB" && $val ? "~ $val" : $val) . "');\n";
if (isset($sums[$key])) {
$sums[$key] += ($row["Engine"] != "InnoDB" || $key != "Data_free" ? $row[$key] : 0);
}
} elseif (array_key_exists($key, $row)) {
- echo "document.getElementById('$key-$id').parentNode.innerHTML = ' ';\n";
+ echo "setHtml('$key-$id');\n";
}
}
}
}
foreach ($sums as $key => $val) {
- echo "document.getElementById('sum-$key').innerHTML = '" . number_format($val, 0, '.', lang(',')) . "';\n";
+ echo "setHtml('sum-$key', '" . number_format($val, 0, '.', lang(',')) . "');\n";
}
echo "</script>\n";
}
Modified: branches/sqlite/adminer/include/connect.inc.php
===================================================================
--- branches/sqlite/adminer/include/connect.inc.php 2010-04-18 00:25:19 UTC (rev 1457)
+++ branches/sqlite/adminer/include/connect.inc.php 2010-04-18 01:48:09 UTC (rev 1458)
@@ -51,7 +51,7 @@
page_footer("db");
echo "<script type='text/javascript'>\n";
foreach (count_tables($databases) as $db => $val) {
- echo "document.getElementById('tables-" . addcslashes($db, "\\'/") . "').innerHTML = '$val';\n";
+ echo "setHtml('tables-" . addcslashes($db, "\\'/") . "', '$val');\n";
}
echo "</script>\n";
}
Modified: branches/sqlite/adminer/static/functions.js
===================================================================
--- branches/sqlite/adminer/static/functions.js 2010-04-18 00:25:19 UTC (rev 1457)
+++ branches/sqlite/adminer/static/functions.js 2010-04-18 01:48:09 UTC (rev 1458)
@@ -83,8 +83,23 @@
el.onclick && el.onclick();
}
+/** Set HTML code of an element
+* @param string
+* @param string undefined to set parentNode to
+*/
+function setHtml(id, html) {
+ var el = document.getElementById(id);
+ if (el) {
+ if (html == undefined) {
+ el.parentNode.innerHTML = ' ';
+ } else {
+ el.innerHTML = html;
+ }
+ }
+}
+
/** Add row in select fieldset
* @param HTMLSelectElement
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-18 00:25:25
|
Revision: 1457
http://adminer.svn.sourceforge.net/adminer/?rev=1457&view=rev
Author: jakubvrana
Date: 2010-04-18 00:25:19 +0000 (Sun, 18 Apr 2010)
Log Message:
-----------
Fix alter_table
Modified Paths:
--------------
branches/sqlite/adminer/drivers/pgsql.inc.php
Modified: branches/sqlite/adminer/drivers/pgsql.inc.php
===================================================================
--- branches/sqlite/adminer/drivers/pgsql.inc.php 2010-04-18 00:24:53 UTC (rev 1456)
+++ branches/sqlite/adminer/drivers/pgsql.inc.php 2010-04-18 00:25:19 UTC (rev 1457)
@@ -341,10 +341,12 @@
} elseif ($alter) {
array_unshift($queries, "ALTER TABLE " . idf_escape($table) . "\n" . implode(",\n", $alter));
}
- $queries[] = "COMMENT ON TABLE " . idf_escape($table) . " IS " . $connection->quote($comment);
if ($table != "" && $table != $name) {
$queries[] = "ALTER TABLE " . idf_escape($table) . " RENAME TO " . idf_escape($name);
}
+ if ($table != "" || $comment != "") {
+ $queries[] = "COMMENT ON TABLE " . idf_escape($name) . " IS " . $connection->quote($comment);
+ }
if ($auto_increment != "") {
//! $queries[] = "SELECT setval(pg_get_serial_sequence(" . $connection->quote($name) . ", ), $auto_increment)";
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-18 00:25:00
|
Revision: 1456
http://adminer.svn.sourceforge.net/adminer/?rev=1456&view=rev
Author: jakubvrana
Date: 2010-04-18 00:24:53 +0000 (Sun, 18 Apr 2010)
Log Message:
-----------
Insert empty row (single auto_increment column)
Modified Paths:
--------------
branches/sqlite/adminer/edit.inc.php
Modified: branches/sqlite/adminer/edit.inc.php
===================================================================
--- branches/sqlite/adminer/edit.inc.php 2010-04-16 15:59:14 UTC (rev 1455)
+++ branches/sqlite/adminer/edit.inc.php 2010-04-18 00:24:53 UTC (rev 1456)
@@ -25,10 +25,10 @@
$set[idf_escape($name)] = ($update ? "\n" . idf_escape($name) . " = $val" : $val);
}
}
- if (!$set) {
- redirect($location);
- }
if ($update) {
+ if (!$set) {
+ redirect($location);
+ }
query_redirect("UPDATE" . limit1(idf_escape($TABLE) . " SET" . implode(",", $set) . "\nWHERE $where"), $location, lang('Item has been updated.'));
} else {
query_redirect("INSERT INTO " . idf_escape($TABLE) . " (" . implode(", ", array_keys($set)) . ")\nVALUES (" . implode(", ", $set) . ")", $location, lang('Item has been inserted.'));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jak...@us...> - 2010-04-16 15:59:20
|
Revision: 1455
http://adminer.svn.sourceforge.net/adminer/?rev=1455&view=rev
Author: jakubvrana
Date: 2010-04-16 15:59:14 +0000 (Fri, 16 Apr 2010)
Log Message:
-----------
Supports several drivers
Modified Paths:
--------------
branches/sqlite/adminer/index.php
branches/sqlite/editor/index.php
Modified: branches/sqlite/adminer/index.php
===================================================================
--- branches/sqlite/adminer/index.php 2010-04-16 15:38:41 UTC (rev 1454)
+++ branches/sqlite/adminer/index.php 2010-04-16 15:59:14 UTC (rev 1455)
@@ -1,5 +1,5 @@
<?php
-/** Adminer - Compact MySQL management
+/** Adminer - Compact database management
* @link http://www.adminer.org/
* @author Jakub Vrana, http://php.vrana.cz/
* @copyright 2007 Jakub Vrana
Modified: branches/sqlite/editor/index.php
===================================================================
--- branches/sqlite/editor/index.php 2010-04-16 15:38:41 UTC (rev 1454)
+++ branches/sqlite/editor/index.php 2010-04-16 15:59:14 UTC (rev 1455)
@@ -1,5 +1,5 @@
<?php
-/** Adminer Editor - Compact MySQL editor
+/** Adminer Editor - Compact database editor
* @link http://www.adminer.org/
* @author Jakub Vrana, http://php.vrana.cz/
* @copyright 2009 Jakub Vrana
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|