$go_sql = TRUE; } // Store the query as a bookmark before executing it if bookmarklabel was given if (!empty($bkm_label) && !empty($import_text)) { require_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_listBookmarks($db, $cfg['Bookmark']); foreach ($bookmarks as $key => $val) { if ($val == $bkm_label) { PMA_deleteBookmarks($db, $cfg['Bookmark'], $key); } } } PMA_addBookmarks($bfields, $cfg['Bookmark'], 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 if (empty($memory_limit)) { $memory_limit = 2 * 1024 * 1024; } // In case no memory limit we work on 10MB chunks if ($memory_limit = -1) { $memory_limit = 10 * 1024 * 1024; } // Calculate value of the limit if (strtolower(substr($memory_limit, -1)) == 'm') {
// TODO: set a global variable with this information // loic1: optimized query $result = @PMA_mysql_query('USE mysql'); if (PMA_mysql_error()) { require_once './header.inc.php'; PMA_mysqlDie($strNoDropDatabases, '', '', $err_url); } } define('PMA_CHK_DROP', 1); /** * Store a query as a bookmark before executing it? */ if (isset($SQLbookmark) && $sql_query != '') { require_once './libraries/bookmark.lib.php'; $bfields = array('dbase' => $db, 'user' => $cfg['Bookmark']['user'], 'query' => urlencode($sql_query), 'label' => $bkm_label); PMA_addBookmarks($bfields, $cfg['Bookmark'], isset($bkm_all_users) && $bkm_all_users == 'true' ? true : false); } /** * Executes the query */ if ($sql_query != '') { $pieces = array(); PMA_splitSqlFile($pieces, $sql_query, PMA_MYSQL_INT_VERSION); $pieces_count = count($pieces); if ($pieces_count > 1) { $is_multiple = TRUE; } // Copy of the cleaned sql statement for display purpose only (see near the // beginning of "db_details.php" & "tbl_properties.php") // You can either // * specify the amount of maximum pieces per query (having max_*_length set to 0!) or
if (mysql_error()) { include './header.inc.php'; PMA_mysqlDie($strNoDropDatabases, '', '', $err_url); } // end if } // end if /** * Bookmark add */ if (isset($store_bkm)) { if (get_magic_quotes_gpc()) { $fields['label'] = stripslashes($fields['label']); } include './libraries/bookmark.lib.php'; PMA_addBookmarks($fields, $cfgBookmark); header('Location: ' . $cfgPmaAbsoluteUri . $goto); } // end if /** * Gets the true sql query */ // $sql_query has been urlencoded in the confirmation form for drop/delete // queries or in the navigation bar for browsing among records if (isset($btnDrop) || isset($navig)) { $sql_query = urldecode($sql_query); } // If the query is a Select, extract the db and table names and modify // $db and $table, to have correct page headers, links and left frame. // db and table name may be enclosed with backquotes, db is optionnal, // query may contain aliases.