2.11.1.2 release
[phpmyadmin/arisferyanto.git] / libraries / db_common.inc.php
blobf21437acb238c1fbb7fb848dfff2ea5bc4eab391
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 */
8 /**
9 * Gets some core libraries
11 require_once './libraries/common.inc.php';
12 require_once './libraries/bookmark.lib.php';
14 PMA_checkParameters(array('db'));
16 $is_show_stats = $cfg['ShowStats'];
18 if (PMA_MYSQL_INT_VERSION >= 50002 && $db == 'information_schema') {
19 $is_show_stats = false;
20 $db_is_information_schema = true;
21 } else {
22 $db_is_information_schema = false;
25 /**
26 * Defines the urls to return to in case of error in a sql statement
28 $err_url_0 = 'main.php?' . PMA_generate_common_url();
29 $err_url = $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db);
32 /**
33 * Ensures the database exists (else move to the "parent" script) and displays
34 * headers
36 if (!isset($is_db) || !$is_db) {
37 // Not a valid db name -> back to the welcome page
38 if (strlen($db)) {
39 $is_db = PMA_DBI_select_db($db);
41 if (! strlen($db) || !$is_db) {
42 PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
43 exit;
45 } // end if (ensures db exists)
47 /**
48 * Changes database charset if requested by the user
50 if (isset($submitcollation) && !empty($db_collation) && PMA_MYSQL_INT_VERSION >= 40101) {
51 list($db_charset) = explode('_', $db_collation);
52 $sql_query = 'ALTER DATABASE ' . PMA_backquote($db) . ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
53 $result = PMA_DBI_query($sql_query);
54 $message = $strSuccess;
55 unset($db_charset, $db_collation);
58 $js_to_run = 'functions.js';
59 require_once './libraries/header.inc.php';
61 /**
62 * Set parameters for links
64 $url_query = PMA_generate_common_url($db);