Use TRUNCATE instead of DELETE when using MySQL 4.

This commit is contained in:
Alexander M. Turek
2002-04-22 21:32:29 +00:00
parent 70c89bbb87
commit f267e10870
4 changed files with 43 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ phpMyAdmin - Changelog
$Id$
$Source$
2002-04-21 Lo<4C>c Chapeaux <lolo@phpheaven.net>
2002-04-22 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* lang/slovak-win1250.inc.php3: completed, thanks to Peter Svec.
2002-04-22 Marc Delisle <lem9@users.sourceforge.net>
@@ -14,6 +14,8 @@ $Source$
2002-04-22 Alexander M. Turek <rabus@users.sourceforge.net>
* lang/russian-koi8.inc.php3: fixed a typo (bug #546981).
* lang/german.inc.php3: better syntax.
* db_details.php3, mult_submits.inx.php3, tbl_properties.php3:
Use TRUNCATE instead of DELETE when using MySQL 4.
2002-04-21 Alexander M. Turek <rabus@users.sourceforge.net>
* main.php3: Restarted work on patch #538740 (get users priv. with

View File

@@ -224,11 +224,19 @@ else if (PMA_MYSQL_INT_VERSION >= 32303) {
<?php
if (!empty($sts_data['Rows'])) {
echo '<a href="sql.php3?' . $url_query
. '&amp;sql_query='
. urlencode('DELETE FROM ' . PMA_backquote($table))
. '&amp;zero_rows='
. urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table)))
. '" onclick="return confirmLink(this, \'DELETE FROM ' . PMA_jsFormat($table) . '\')">' . $strEmpty . '</a>';
. '&amp;sql_query=';
if (PMA_MYSQL_INT_VERSION >= 40000) {
echo urlencode('TRUNCATE ' . PMA_backquote($table))
. '&amp;zero_rows='
. urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table)))
. '" onclick="return confirmLink(this, \'TRUNCATE ';
} else {
echo urlencode('DELETE FROM ' . PMA_backquote($table))
. '&amp;zero_rows='
. urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table)))
. '" onclick="return confirmLink(this, \'DELETE FROM ';
}
echo PMA_jsFormat($table) . '\')">' . $strEmpty . '</a>';
} else {
echo $strEmpty;
}

View File

@@ -75,8 +75,12 @@ if (!empty($submit_mult) && !empty($what)) {
// break;
case 'empty_tbl':
$full_query .= 'DELETE FROM '
. PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
if (PMA_MYSQL_INT_VERSION >= 40000) {
$full_query .= 'TRUNCATE ';
} else {
$full_query .= 'DELETE FROM ';
}
$full_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
. ';<br />';
break;

View File

@@ -158,8 +158,27 @@ if ($num_rows > 0) {
<b><?php echo $strSelect; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <a href="tbl_change.php3?<?php echo $url_query; ?>">
<b><?php echo $strInsert; ?></b></a> ]&nbsp;&nbsp;&nbsp;
[ <a href="sql.php3?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('DELETE FROM ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DELETE FROM <?php echo PMA_jsFormat($table); ?>')">
[ <?php
echo '<a href="sql.php3?' . $url_query . '&amp;sql_query=';
if (PMA_MYSQL_INT_VERSION >= 40000) {
echo urlencode('TRUNCATE ' . PMA_backquote($table))
. '&amp;zero_rows='
. urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table)))
. '"' . "\n"
. ' onclick="return confirmLink(this, \'TRUNCATE ';
} // end if
else {
echo urlencode('DELETE FROM ' . PMA_backquote($table))
. '&amp;zero_rows='
. urlencode(sprintf($strTableHasBeenEmptied, htmlspecialchars($table)))
. '"'
. "\n"
. ' onclick="return confirmLink(this, \'DELETE FROM ';
} // end else
echo PMA_jsFormat($table)
. '\')">'
. "\n";
?>
<b><?php echo $strEmpty; ?></b></a> ]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[ <a href="sql.php3?<?php echo ereg_replace('tbl_properties.php3$', 'db_details.php3', $url_query); ?>&amp;back=tbl_properties.php3&amp;reload=1&amp;sql_query=<?php echo urlencode('DROP TABLE ' . PMA_backquote($table)); ?>&amp;zero_rows=<?php echo urlencode(sprintf($strTableHasBeenDropped, htmlspecialchars($table))); ?>"
onclick="return confirmLink(this, 'DROP TABLE <?php echo PMA_jsFormat($table); ?>')">