Converting number of Excel column names no longer limited
[phpmyadmin/arisferyanto.git] / libraries / db_common.inc.php
blob5d16995464544cc0dedc6816548c3cbd1bb49737
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
13 * Gets some core libraries
15 require_once './libraries/common.inc.php';
16 require_once './libraries/bookmark.lib.php';
18 PMA_checkParameters(array('db'));
20 $is_show_stats = $cfg['ShowStats'];
22 if ($db == 'information_schema') {
23 $is_show_stats = false;
24 $db_is_information_schema = true;
25 } else {
26 $db_is_information_schema = false;
29 /**
30 * Defines the urls to return to in case of error in a sql statement
32 $err_url_0 = 'main.php?' . PMA_generate_common_url();
33 $err_url = $cfg['DefaultTabDatabase'] . '?' . PMA_generate_common_url($db);
36 /**
37 * Ensures the database exists (else move to the "parent" script) and displays
38 * headers
40 if (! isset($is_db) || ! $is_db) {
41 if (strlen($db)) {
42 $is_db = PMA_DBI_select_db($db);
43 // This "Command out of sync" 2014 error may happen, for example
44 // after calling a MySQL procedure; at this point we can't select
45 // the db but it's not necessarily wrong
46 if (PMA_DBI_getError() && $GLOBALS['errno'] == 2014) {
47 $is_db = true;
48 unset($GLOBALS['errno']);
51 // Not a valid db name -> back to the welcome page
52 if (! strlen($db) || ! $is_db) {
53 PMA_sendHeaderLocation($cfg['PmaAbsoluteUri'] . 'main.php?' . PMA_generate_common_url('', '', '&') . (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1');
54 exit;
56 } // end if (ensures db exists)
58 /**
59 * Changes database charset if requested by the user
61 if (isset($submitcollation) && !empty($db_collation)) {
62 list($db_charset) = explode('_', $db_collation);
63 $sql_query = 'ALTER DATABASE ' . PMA_backquote($db) . ' DEFAULT' . PMA_generateCharsetQueryPart($db_collation);
64 $result = PMA_DBI_query($sql_query);
65 $message = PMA_Message::success();
66 unset($db_charset, $db_collation);
69 $GLOBALS['js_include'][] = 'functions.js';
70 require_once './libraries/header.inc.php';
72 /**
73 * Set parameters for links
75 $url_query = PMA_generate_common_url($db);