bookmark sql query after checking errors

This commit is contained in:
Alex Marin 2012-04-20 17:21:06 +03:00
parent 621280ec78
commit 4de7d3c83d
2 changed files with 26 additions and 25 deletions

View File

@ -241,31 +241,6 @@ if (isset($GLOBALS['show_as_php'])) {
$go_sql = true;
}
// Store the query as a bookmark before executing it if bookmarklabel was given
if (! empty($bkm_label) && ! empty($import_text)) {
include_once 'libraries/bookmark.lib.php';
$bfields = array(
'dbase' => $db,
'user' => $cfg['Bookmark']['user'],
'query' => urlencode($import_text),
'label' => $bkm_label
);
// Should we replace bookmark?
if (isset($bkm_replace)) {
$bookmarks = PMA_Bookmark_getList($db);
foreach ($bookmarks as $key => $val) {
if ($val == $bkm_label) {
PMA_Bookmark_delete($db, $key);
}
}
}
PMA_Bookmark_save($bfields, isset($bkm_all_users));
$bookmark_created = true;
} // end store bookmarks
// We can not read all at once, otherwise we can run out of memory
$memory_limit = trim(@ini_get('memory_limit'));
// 2 MB as default

26
sql.php
View File

@ -574,6 +574,32 @@ if (isset($GLOBALS['show_as_php']) || ! empty($GLOBALS['validatequery'])) {
}
unset($error);
// If there are no errors and bookmarklabel was given,
// store the query as a bookmark
if (! empty($bkm_label) && ! empty($import_text)) {
include_once 'libraries/bookmark.lib.php';
$bfields = array(
'dbase' => $db,
'user' => $cfg['Bookmark']['user'],
'query' => urlencode($import_text),
'label' => $bkm_label
);
// Should we replace bookmark?
if (isset($bkm_replace)) {
$bookmarks = PMA_Bookmark_getList($db);
foreach ($bookmarks as $key => $val) {
if ($val == $bkm_label) {
PMA_Bookmark_delete($db, $key);
}
}
}
PMA_Bookmark_save($bfields, isset($bkm_all_users));
$bookmark_created = true;
} // end store bookmarks
// Gets the number of rows affected/returned
// (This must be done immediately after the query because
// mysql_affected_rows() reports about the last query done)