Merge pull request #11460 from madhuracj/drizzle

Removing Drizzle support from master branch
This commit is contained in:
Madhura Jayaratne 2015-09-10 01:09:56 +10:00
commit 6a163eaa46
87 changed files with 844 additions and 5759 deletions

View File

@ -12,9 +12,9 @@
require_once 'libraries/common.inc.php';
require_once 'libraries/mysql_charsets.inc.php';
if (! PMA_DRIZZLE) {
include_once 'libraries/replication.inc.php';
}
require_once 'libraries/replication.inc.php';
require 'libraries/build_html_for_db.lib.php';
/**

View File

@ -105,7 +105,7 @@ if (/*overload*/mb_strlen($GLOBALS['db'])
}
unset($sqlConstratints);
if (! PMA_DRIZZLE && PMA_MYSQL_INT_VERSION >= 50100) {
if (PMA_MYSQL_INT_VERSION >= 50100) {
// here DELIMITER is not used because it's not part of the
// language; each statement is sent one by one
@ -261,7 +261,7 @@ if (!$is_information_schema) {
// Don't allow to easily drop mysql database, RFE #1327514.
if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase'])
&& ! $db_is_system_schema
&& (PMA_DRIZZLE || $GLOBALS['db'] != 'mysql')
&& $GLOBALS['db'] != 'mysql'
) {
$response->addHTML(PMA_getHtmlForDropDatabaseLink($GLOBALS['db']));
}

View File

@ -2112,8 +2112,7 @@ Languages
Defines the default connection collation to use, if not user-defined.
See the `MySQL documentation for charsets
<http://dev.mysql.com/doc/mysql/en/charset-charsets.html>`_
for list of possible values. This setting is
ignored when connected to Drizzle server.
for list of possible values.
.. config:option:: $cfg['Lang']

View File

@ -195,8 +195,6 @@ For older MySQL versions, our `Downloads <https://www.phpmyadmin.net/downloads/>
For `MariaDB <http://mariadb.org/>`_, versions 5.5 and newer are supported.
For `Drizzle <http://www.drizzle.org>`_, versions 7.1 and newer are supported.
.. _faq1_17a:
1.17a I cannot connect to the MySQL server. It always returns the error message, "Client does not support authentication protocol requested by server; consider upgrading MySQL client"

View File

@ -42,7 +42,6 @@ phpMyAdmin supports MySQL-compatible databases.
* MySQL 5.5 or newer
* MariaDB 5.5 or newer
* Drizzle
.. seealso:: :ref:`faq1_17`

View File

@ -585,22 +585,10 @@ if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE && isset($charset_of_fil
$charset_conversion = true;
}
} elseif (isset($charset_of_file) && $charset_of_file != 'utf-8') {
if (PMA_DRIZZLE) {
// Drizzle doesn't support other character sets,
// so we can't fallback to SET NAMES - throw an error
$message = PMA_Message::error(
__(
'Cannot convert file\'s character'
. ' set without character set conversion library!'
)
);
PMA_stopImport($message);
} else {
$GLOBALS['dbi']->query('SET NAMES \'' . $charset_of_file . '\'');
// We can not show query in this case, it is in different charset
$sql_query_disabled = true;
$reset_charset = true;
}
$GLOBALS['dbi']->query('SET NAMES \'' . $charset_of_file . '\'');
// We can not show query in this case, it is in different charset
$sql_query_disabled = true;
$reset_charset = true;
}
// Something to skip? (because timeout has passed)

View File

@ -180,7 +180,7 @@ if ($server > 0 || count($cfg['Servers']) > 1
/**
* Displays the mysql server related links
*/
if ($server > 0 && ! PMA_DRIZZLE) {
if ($server > 0) {
include_once 'libraries/check_user_privileges.lib.php';
// Logout for advanced authentication
@ -220,7 +220,7 @@ if ($server > 0 || count($cfg['Servers']) > 1
)
. ' </form>' . "\n"
. ' </li>' . "\n";
} // end of if ($server > 0 && !PMA_DRIZZLE)
} // end of if ($server > 0)
echo '</ul>';
echo '</div>';
}
@ -305,10 +305,7 @@ if ($server > 0 && $GLOBALS['cfg']['ShowServerInfo']) {
echo ' <li id="li_select_mysql_charset">';
echo ' ' . __('Server charset:') . ' '
. ' <span lang="en" dir="ltr">';
if (! PMA_DRIZZLE) {
echo ' '
. $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
}
echo ' ' . $mysql_charsets_descriptions[$mysql_charset_map['utf-8']];
echo ' (' . $mysql_charset_map['utf-8'] . ')'
. ' </span>'
. ' </li>'
@ -594,13 +591,10 @@ if ($server > 0) {
* If someday there is a constant that we can check about mysqlnd,
* we can use it instead of strpos().
* If no default server is set, $GLOBALS['dbi'] is not defined yet.
* Drizzle can speak MySQL protocol, so don't warn about version mismatch for
* Drizzle servers.
* We also do not warn if MariaDB is detected, as it has its own version
* numbering.
*/
if (isset($GLOBALS['dbi'])
&& !PMA_DRIZZLE
&& $cfg['ServerLibraryDifference_DisableWarning'] == false
) {
/** @var PMA_String $pmaString */

View File

@ -1,14 +0,0 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Functions used in server plugins pages
*/
AJAX.registerOnload('server_plugins.js', function () {
// Make columns sortable, but only for tables with more than 1 data row
var $tables = $('#plugins_plugins table:has(tbody tr + tr)');
$tables.tablesorter({
sortList: [[0, 0]],
widgets: ['zebra']
});
$tables.find('thead th')
.append('<div class="sorticon"></div>');
});

View File

@ -35,15 +35,7 @@ class Advisor
$GLOBALS['dbi']->fetchResult('SHOW GLOBAL STATUS', 0, 1),
$GLOBALS['dbi']->fetchResult('SHOW GLOBAL VARIABLES', 0, 1)
);
if (PMA_DRIZZLE) {
$this->variables = array_merge(
$this->variables,
$GLOBALS['dbi']->fetchResult(
"SELECT concat('Com_', variable_name), variable_value "
. "FROM data_dictionary.GLOBAL_STATEMENTS", 0, 1
)
);
}
// Add total memory to variables as well
include_once 'libraries/sysinfo.lib.php';
$sysinfo = PMA_getSysInfo();

View File

@ -927,35 +927,33 @@ class PMA_Config
*/
private function _saveConnectionCollation($config_data)
{
if (!PMA_DRIZZLE) {
// just to shorten the lines
$collation = 'collation_connection';
if (isset($GLOBALS[$collation])
&& (isset($_COOKIE['pma_collation_connection'])
|| isset($_POST[$collation]))
// just to shorten the lines
$collation = 'collation_connection';
if (isset($GLOBALS[$collation])
&& (isset($_COOKIE['pma_collation_connection'])
|| isset($_POST[$collation]))
) {
if ((! isset($config_data[$collation])
&& $GLOBALS[$collation] != 'utf8_general_ci')
|| isset($config_data[$collation])
&& $GLOBALS[$collation] != $config_data[$collation]
) {
if ((! isset($config_data[$collation])
&& $GLOBALS[$collation] != 'utf8_general_ci')
|| isset($config_data[$collation])
&& $GLOBALS[$collation] != $config_data[$collation]
) {
$this->setUserValue(
null,
$collation,
$GLOBALS[$collation],
'utf8_general_ci'
);
}
} else {
// read collation from settings
if (isset($config_data[$collation])) {
$this->setUserValue(
null,
$collation,
$GLOBALS[$collation],
'utf8_general_ci'
);
}
} else {
// read collation from settings
if (isset($config_data[$collation])) {
$GLOBALS[$collation]
= $config_data[$collation];
$this->setCookie(
'pma_collation_connection',
$GLOBALS[$collation]
= $config_data[$collation];
$this->setCookie(
'pma_collation_connection',
$GLOBALS[$collation]
);
}
);
}
}
}

View File

@ -70,9 +70,7 @@ class PMA_DatabaseInterface
*/
public static function checkDbExtension($extension = 'mysql')
{
if ($extension == 'drizzle' && function_exists('drizzle_create')) {
return true;
} else if (function_exists($extension . '_connect')) {
if (function_exists($extension . '_connect')) {
return true;
}
return false;
@ -397,17 +395,9 @@ class PMA_DatabaseInterface
if ($table_type) {
if ($table_type == 'view') {
if (PMA_DRIZZLE) {
$sql_where_table .= " AND t.`TABLE_TYPE` != 'BASE'";
} else {
$sql_where_table .= " AND t.`TABLE_TYPE` != 'BASE TABLE'";
}
$sql_where_table .= " AND t.`TABLE_TYPE` != 'BASE TABLE'";
} else if ($table_type == 'table') {
if (PMA_DRIZZLE) {
$sql_where_table .= " AND t.`TABLE_TYPE` = 'BASE'";
} else {
$sql_where_table .= " AND t.`TABLE_TYPE` = 'BASE TABLE'";
}
$sql_where_table .= " AND t.`TABLE_TYPE` = 'BASE TABLE'";
}
}
return $sql_where_table;
@ -423,77 +413,34 @@ class PMA_DatabaseInterface
*/
private function _getSqlForTablesFull($this_databases, $sql_where_table)
{
if (PMA_DRIZZLE) {
$stats_join = $this->_getDrizzeStatsJoin();
$sql = '
SELECT *,
`TABLE_SCHEMA` AS `Db`,
`TABLE_NAME` AS `Name`,
`TABLE_TYPE` AS `TABLE_TYPE`,
`ENGINE` AS `Engine`,
`ENGINE` AS `Type`,
`VERSION` AS `Version`,
`ROW_FORMAT` AS `Row_format`,
`TABLE_ROWS` AS `Rows`,
`AVG_ROW_LENGTH` AS `Avg_row_length`,
`DATA_LENGTH` AS `Data_length`,
`MAX_DATA_LENGTH` AS `Max_data_length`,
`INDEX_LENGTH` AS `Index_length`,
`DATA_FREE` AS `Data_free`,
`AUTO_INCREMENT` AS `Auto_increment`,
`CREATE_TIME` AS `Create_time`,
`UPDATE_TIME` AS `Update_time`,
`CHECK_TIME` AS `Check_time`,
`TABLE_COLLATION` AS `Collation`,
`CHECKSUM` AS `Checksum`,
`CREATE_OPTIONS` AS `Create_options`,
`TABLE_COMMENT` AS `Comment`
FROM `information_schema`.`TABLES` t
WHERE `TABLE_SCHEMA` ' . PMA_Util::getCollateForIS() . '
IN (\'' . implode("', '", $this_databases) . '\')
' . $sql_where_table;
// data_dictionary.table_cache may not contain any data
// for some tables, it's just a table cache
// auto_increment == 0 is cast to NULL because currently
// (2011.03.13 GA)
// Drizzle doesn't provide correct value
$sql = "
SELECT t.*,
t.TABLE_SCHEMA AS `Db`,
t.TABLE_NAME AS `Name`,
t.TABLE_TYPE AS `TABLE_TYPE`,
t.ENGINE AS `Engine`,
t.ENGINE AS `Type`,
t.TABLE_VERSION AS `Version`,-- VERSION
t.ROW_FORMAT AS `Row_format`,
coalesce(tc.ROWS, stat.NUM_ROWS)
AS `Rows`,-- TABLE_ROWS,
coalesce(tc.ROWS, stat.NUM_ROWS)
AS `TABLE_ROWS`,
tc.AVG_ROW_LENGTH AS `Avg_row_length`, -- AVG_ROW_LENGTH
tc.TABLE_SIZE AS `Data_length`, -- DATA_LENGTH
NULL AS `Max_data_length`, -- MAX_DATA_LENGTH
NULL AS `Index_length`, -- INDEX_LENGTH
NULL AS `Data_free`, -- DATA_FREE
nullif(t.AUTO_INCREMENT, 0)
AS `Auto_increment`,
t.TABLE_CREATION_TIME AS `Create_time`, -- CREATE_TIME
t.TABLE_UPDATE_TIME AS `Update_time`, -- UPDATE_TIME
NULL AS `Check_time`, -- CHECK_TIME
t.TABLE_COLLATION AS `Collation`,
NULL AS `Checksum`, -- CHECKSUM
NULL AS `Create_options`, -- CREATE_OPTIONS
t.TABLE_COMMENT AS `Comment`
FROM data_dictionary.TABLES t
LEFT JOIN data_dictionary.TABLE_CACHE tc
ON tc.TABLE_SCHEMA = t.TABLE_SCHEMA AND tc.TABLE_NAME
= t.TABLE_NAME
$stats_join
WHERE t.TABLE_SCHEMA IN ('" . implode("', '", $this_databases) . "')
" . $sql_where_table;
} else {
$sql = '
SELECT *,
`TABLE_SCHEMA` AS `Db`,
`TABLE_NAME` AS `Name`,
`TABLE_TYPE` AS `TABLE_TYPE`,
`ENGINE` AS `Engine`,
`ENGINE` AS `Type`,
`VERSION` AS `Version`,
`ROW_FORMAT` AS `Row_format`,
`TABLE_ROWS` AS `Rows`,
`AVG_ROW_LENGTH` AS `Avg_row_length`,
`DATA_LENGTH` AS `Data_length`,
`MAX_DATA_LENGTH` AS `Max_data_length`,
`INDEX_LENGTH` AS `Index_length`,
`DATA_FREE` AS `Data_free`,
`AUTO_INCREMENT` AS `Auto_increment`,
`CREATE_TIME` AS `Create_time`,
`UPDATE_TIME` AS `Update_time`,
`CHECK_TIME` AS `Check_time`,
`TABLE_COLLATION` AS `Collation`,
`CHECKSUM` AS `Checksum`,
`CREATE_OPTIONS` AS `Create_options`,
`TABLE_COMMENT` AS `Comment`
FROM `information_schema`.`TABLES` t
WHERE `TABLE_SCHEMA` ' . PMA_Util::getCollateForIS() . '
IN (\'' . implode("', '", $this_databases) . '\')
' . $sql_where_table;
}
return $sql;
}
@ -569,19 +516,6 @@ class PMA_DatabaseInterface
$sql, array('TABLE_SCHEMA', 'TABLE_NAME'), null, $link
);
if (PMA_DRIZZLE) {
// correct I_S and D_D names returned by D_D.TABLES -
// Drizzle generally uses lower case for them,
// but TABLES returns uppercase
foreach ((array)$database as $db) {
$db_upper = /*overload*/mb_strtoupper($db);
if (!isset($tables[$db]) && isset($tables[$db_upper])) {
$tables[$db] = $tables[$db_upper];
unset($tables[$db_upper]);
}
}
}
if ($sort_by == 'Name' && $GLOBALS['cfg']['NaturalOrder']) {
// here, the array's first key is by schema name
foreach ($tables as $one_database_name => $one_database_tables) {
@ -616,7 +550,7 @@ class PMA_DatabaseInterface
// If permissions are wrong on even one database directory,
// information_schema does not return any table info for any database
// this is why we fall back to SHOW TABLE STATUS even for MySQL >= 50002
if (empty($tables) && !PMA_DRIZZLE) {
if (empty($tables)) {
foreach ($databases as $each_database) {
if ($table || (true === $tbl_is_group) || ! empty($table_type)) {
$sql = 'SHOW TABLE STATUS FROM '
@ -823,17 +757,6 @@ class PMA_DatabaseInterface
return $tables[/*overload*/mb_strtolower($database)];
}
// one database but inexact letter case match
// as Drizzle is always case insensitive,
// we can safely return the only result
if (!PMA_DRIZZLE || !count($tables) == 1) {
return $tables;
}
$keys = array_keys($tables);
if (/*overload*/mb_strlen(array_pop($keys)) == /*overload*/mb_strlen($database)) {
return array_pop($tables);
}
return $tables;
}
@ -1002,71 +925,42 @@ class PMA_DatabaseInterface
$sql_where_schema = '';
}
if (PMA_DRIZZLE) {
// data_dictionary.table_cache may not contain any data for some
// tables, it's just a table cache
$sql = 'SELECT
s.SCHEMA_NAME,
s.DEFAULT_COLLATION_NAME';
if ($force_stats) {
// no TABLE_CACHE data, stable results are better than
// constantly changing
$sql .= ',
COUNT(t.TABLE_SCHEMA) AS SCHEMA_TABLES,
SUM(stat.NUM_ROWS) AS SCHEMA_TABLE_ROWS';
}
$sql .= '
FROM data_dictionary.SCHEMAS s';
if ($force_stats) {
$stats_join = $this->_getDrizzeStatsJoin();
$sql .= "
LEFT JOIN data_dictionary.TABLES t
ON t.TABLE_SCHEMA = s.SCHEMA_NAME
$stats_join";
}
$sql .= $sql_where_schema . '
GROUP BY s.SCHEMA_NAME, s.DEFAULT_COLLATION_NAME
ORDER BY ' . PMA_Util::backquote($sort_by) . ' ' . $sort_order
. $limit;
} else {
$sql = 'SELECT *,
CAST(BIN_NAME AS CHAR CHARACTER SET utf8) AS SCHEMA_NAME
FROM (';
$sql .= 'SELECT
BINARY s.SCHEMA_NAME AS BIN_NAME,
s.DEFAULT_COLLATION_NAME';
if ($force_stats) {
$sql .= ',
COUNT(t.TABLE_SCHEMA) AS SCHEMA_TABLES,
SUM(t.TABLE_ROWS) AS SCHEMA_TABLE_ROWS,
SUM(t.DATA_LENGTH) AS SCHEMA_DATA_LENGTH,
SUM(t.MAX_DATA_LENGTH) AS SCHEMA_MAX_DATA_LENGTH,
SUM(t.INDEX_LENGTH) AS SCHEMA_INDEX_LENGTH,
SUM(t.DATA_LENGTH + t.INDEX_LENGTH)
AS SCHEMA_LENGTH,
SUM(t.DATA_FREE) AS SCHEMA_DATA_FREE';
}
$sql .= '
FROM `information_schema`.SCHEMATA s';
if ($force_stats) {
$sql .= '
LEFT JOIN `information_schema`.TABLES t
ON BINARY t.TABLE_SCHEMA = BINARY s.SCHEMA_NAME';
}
$sql .= $sql_where_schema . '
GROUP BY BINARY s.SCHEMA_NAME, s.DEFAULT_COLLATION_NAME
ORDER BY ';
if ($sort_by == 'SCHEMA_NAME'
|| $sort_by == 'DEFAULT_COLLATION_NAME'
) {
$sql .= 'BINARY ';
}
$sql .= PMA_Util::backquote($sort_by)
. ' ' . $sort_order
. $limit;
$sql .= ') a';
$sql = 'SELECT *,
CAST(BIN_NAME AS CHAR CHARACTER SET utf8) AS SCHEMA_NAME
FROM (';
$sql .= 'SELECT
BINARY s.SCHEMA_NAME AS BIN_NAME,
s.DEFAULT_COLLATION_NAME';
if ($force_stats) {
$sql .= ',
COUNT(t.TABLE_SCHEMA) AS SCHEMA_TABLES,
SUM(t.TABLE_ROWS) AS SCHEMA_TABLE_ROWS,
SUM(t.DATA_LENGTH) AS SCHEMA_DATA_LENGTH,
SUM(t.MAX_DATA_LENGTH) AS SCHEMA_MAX_DATA_LENGTH,
SUM(t.INDEX_LENGTH) AS SCHEMA_INDEX_LENGTH,
SUM(t.DATA_LENGTH + t.INDEX_LENGTH)
AS SCHEMA_LENGTH,
SUM(t.DATA_FREE) AS SCHEMA_DATA_FREE';
}
$sql .= '
FROM `information_schema`.SCHEMATA s';
if ($force_stats) {
$sql .= '
LEFT JOIN `information_schema`.TABLES t
ON BINARY t.TABLE_SCHEMA = BINARY s.SCHEMA_NAME';
}
$sql .= $sql_where_schema . '
GROUP BY BINARY s.SCHEMA_NAME, s.DEFAULT_COLLATION_NAME
ORDER BY ';
if ($sort_by == 'SCHEMA_NAME'
|| $sort_by == 'DEFAULT_COLLATION_NAME'
) {
$sql .= 'BINARY ';
}
$sql .= PMA_Util::backquote($sort_by)
. ' ' . $sort_order
. $limit;
$sql .= ') a';
$databases = $this->fetchResult($sql, 'SCHEMA_NAME', null, $link);
@ -1168,28 +1062,6 @@ class PMA_DatabaseInterface
return $databases;
}
/**
* Generates JOIN part for the Drizzle query to get database/table stats.
*
* @return string
*/
private function _getDrizzeStatsJoin()
{
$engine_info = PMA_Util::cacheGet('drizzle_engines');
$stats_join = "LEFT JOIN (SELECT 0 NUM_ROWS) AS stat ON false";
if (isset($engine_info['InnoDB'])
&& $engine_info['InnoDB']['module_library'] == 'innobase'
) {
$stats_join
= "LEFT JOIN data_dictionary.INNODB_SYS_TABLESTATS stat"
. " ON (t.ENGINE = 'InnoDB' AND stat.NAME"
. " = (t.TABLE_SCHEMA || '/') || t.TABLE_NAME)";
}
return $stats_join;
}
/**
* usort comparison callback
*
@ -1305,49 +1177,19 @@ class PMA_DatabaseInterface
// for PMA bc:
// `[SCHEMA_FIELD_NAME]` AS `[SHOW_FULL_COLUMNS_FIELD_NAME]`
if (PMA_DRIZZLE) {
$sql = "SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME,
column_name AS `Field`,
(CASE
WHEN character_maximum_length > 0
THEN concat(lower(data_type), '(', character_maximum_length, ')')
WHEN numeric_precision > 0 OR numeric_scale > 0
THEN concat(lower(data_type), '(', numeric_precision,
',', numeric_scale, ')')
WHEN enum_values IS NOT NULL
THEN concat(lower(data_type), '(', enum_values, ')')
ELSE lower(data_type) END)
AS `Type`,
collation_name AS `Collation`,
(CASE is_nullable
WHEN 1 THEN 'YES'
ELSE 'NO' END) AS `Null`,
(CASE
WHEN is_used_in_primary THEN 'PRI'
ELSE '' END) AS `Key`,
column_default AS `Default`,
(CASE
WHEN is_auto_increment THEN 'auto_increment'
WHEN column_default_update
THEN 'on update ' || column_default_update
ELSE '' END) AS `Extra`,
NULL AS `Privileges`,
column_comment AS `Comment`
FROM data_dictionary.columns";
} else {
$sql = '
SELECT *,
`COLUMN_NAME` AS `Field`,
`COLUMN_TYPE` AS `Type`,
`COLLATION_NAME` AS `Collation`,
`IS_NULLABLE` AS `Null`,
`COLUMN_KEY` AS `Key`,
`COLUMN_DEFAULT` AS `Default`,
`EXTRA` AS `Extra`,
`PRIVILEGES` AS `Privileges`,
`COLUMN_COMMENT` AS `Comment`
FROM `information_schema`.`COLUMNS`';
}
$sql = '
SELECT *,
`COLUMN_NAME` AS `Field`,
`COLUMN_TYPE` AS `Type`,
`COLLATION_NAME` AS `Collation`,
`IS_NULLABLE` AS `Null`,
`COLUMN_KEY` AS `Key`,
`COLUMN_DEFAULT` AS `Default`,
`EXTRA` AS `Extra`,
`PRIVILEGES` AS `Privileges`,
`COLUMN_COMMENT` AS `Comment`
FROM `information_schema`.`COLUMNS`';
if (count($sql_wheres)) {
$sql .= "\n" . ' WHERE ' . implode(' AND ', $sql_wheres);
}
@ -1459,63 +1301,11 @@ class PMA_DatabaseInterface
*/
public function getColumnsSql($database, $table, $column = null, $full = false)
{
if (defined('PMA_DRIZZLE') && PMA_DRIZZLE) {
// `Key` column:
// * used in primary key => PRI
// * unique one-column => UNI
// * indexed, one-column or first in multi-column => MUL
// Promotion of UNI to PRI in case no primary index exists
// is done after query is executed
$sql = "SELECT
column_name AS `Field`,
(CASE
WHEN character_maximum_length > 0
THEN concat(
lower(data_type), '(', character_maximum_length, ')'
)
WHEN numeric_precision > 0 OR numeric_scale > 0
THEN concat(lower(data_type), '(', numeric_precision,
',', numeric_scale, ')')
WHEN enum_values IS NOT NULL
THEN concat(lower(data_type), '(', enum_values, ')')
ELSE lower(data_type) END)
AS `Type`,
" . ($full ? "
collation_name AS `Collation`," : '') . "
(CASE is_nullable
WHEN 1 THEN 'YES'
ELSE 'NO' END) AS `Null`,
(CASE
WHEN is_used_in_primary THEN 'PRI'
WHEN is_unique AND NOT is_multi THEN 'UNI'
WHEN is_indexed
AND (NOT is_multi OR is_first_in_multi) THEN 'MUL'
ELSE '' END) AS `Key`,
column_default AS `Default`,
(CASE
WHEN is_auto_increment THEN 'auto_increment'
WHEN column_default_update <> ''
THEN 'on update ' || column_default_update
ELSE '' END) AS `Extra`
" . ($full ? " ,
NULL AS `Privileges`,
column_comment AS `Comment`" : '') . "
FROM data_dictionary.columns
WHERE table_schema = '" . PMA_Util::sqlAddSlashes($database) . "'
AND table_name = '" . PMA_Util::sqlAddSlashes($table) . "'
" . (
($column !== null)
? "
AND column_name = '" . PMA_Util::sqlAddSlashes($column) . "'"
: ''
);
// ORDER BY ordinal_position
} else {
$sql = 'SHOW ' . ($full ? 'FULL' : '') . ' COLUMNS FROM '
. PMA_Util::backquote($database) . '.' . PMA_Util::backquote($table)
. (($column !== null) ? "LIKE '"
. PMA_Util::sqlAddSlashes($column, true) . "'" : '');
}
$sql = 'SHOW ' . ($full ? 'FULL' : '') . ' COLUMNS FROM '
. PMA_Util::backquote($database) . '.' . PMA_Util::backquote($table)
. (($column !== null) ? "LIKE '"
. PMA_Util::sqlAddSlashes($column, true) . "'" : '');
return $sql;
}
@ -1562,40 +1352,6 @@ class PMA_DatabaseInterface
}
}
}
if (PMA_DRIZZLE) {
// fix Key column, it's much simpler in PHP than in SQL
$has_pk = false;
$has_pk_candidates = false;
foreach ($fields as $f) {
if ($f['Key'] == 'PRI') {
$has_pk = true;
break;
} else if ($f['Null'] == 'NO'
&& ($f['Key'] == 'MUL'
|| $f['Key'] == 'UNI')
) {
$has_pk_candidates = true;
}
}
if (! $has_pk && $has_pk_candidates) {
$secureDatabase = PMA_Util::sqlAddSlashes($database);
// check whether we can promote some unique index to PRI
$sql = "
SELECT i.index_name, p.column_name
FROM data_dictionary.indexes i
JOIN data_dictionary.index_parts p
USING (table_schema, table_name)
WHERE i.table_schema = '" . $secureDatabase . "'
AND i.table_name = '" . PMA_Util::sqlAddSlashes($table) . "'
AND i.is_unique
AND NOT i.is_nullable";
$result = $this->fetchResult($sql, 'index_name', null, $link);
$result = $result ? array_shift($result) : array();
foreach ($result as $f) {
$fields[$f]['Key'] = 'PRI';
}
}
}
return ($column != null) ? array_shift($fields) : $fields;
}
@ -1632,38 +1388,10 @@ class PMA_DatabaseInterface
*/
public function getTableIndexesSql($database, $table, $where = null)
{
if (PMA_DRIZZLE) {
$sql = "SELECT
ip.table_name AS `Table`,
(NOT ip.is_unique) AS Non_unique,
ip.index_name AS Key_name,
ip.sequence_in_index+1 AS Seq_in_index,
ip.column_name AS Column_name,
(CASE
WHEN i.index_type = 'BTREE' THEN 'A'
ELSE NULL END) AS Collation,
NULL AS Cardinality,
compare_length AS Sub_part,
NULL AS Packed,
ip.is_nullable AS `Null`,
i.index_type AS Index_type,
NULL AS Comment,
i.index_comment AS Index_comment
FROM data_dictionary.index_parts ip
LEFT JOIN data_dictionary.indexes i
USING (table_schema, table_name, index_name)
WHERE table_schema = '" . PMA_Util::sqlAddSlashes($database) . "'
AND table_name = '" . PMA_Util::sqlAddSlashes($table) . "'
";
if ($where) {
$sql = "SELECT * FROM (" . $sql . ") A WHERE (" . $where . ")";
}
} else {
$sql = 'SHOW INDEXES FROM ' . PMA_Util::backquote($database) . '.'
. PMA_Util::backquote($table);
if ($where) {
$sql .= ' WHERE (' . $where . ')';
}
$sql = 'SHOW INDEXES FROM ' . PMA_Util::backquote($database) . '.'
. PMA_Util::backquote($table);
if ($where) {
$sql .= ' WHERE (' . $where . ')';
}
return $sql;
}
@ -1779,10 +1507,6 @@ class PMA_DatabaseInterface
'PMA_MARIADB',
PMA_Util::cacheGet('PMA_MARIADB')
);
define(
'PMA_DRIZZLE',
PMA_Util::cacheGet('PMA_DRIZZLE')
);
} else {
$version = $this->fetchSingleRow(
'SELECT @@version, @@version_comment',
@ -1836,79 +1560,44 @@ class PMA_DatabaseInterface
'PMA_MARIADB',
PMA_MARIADB
);
/* Detect Drizzle - it does not support charsets */
$charset_result = $this->query(
// The following does not work in MySQL 5.7:
//"SHOW VARIABLES LIKE 'character_set_results'",
// so a workaround was implemented:
"SELECT @@character_set_results",
$link
);
if ($this->numRows($charset_result) == 0) {
define('PMA_DRIZZLE', true);
} else {
define('PMA_DRIZZLE', false);
}
$this->freeResult($charset_result);
PMA_Util::cacheSet(
'PMA_DRIZZLE',
PMA_DRIZZLE
);
}
}
// Skip charsets for Drizzle
if (!PMA_DRIZZLE) {
if (PMA_MYSQL_INT_VERSION > 50503) {
$default_charset = 'utf8mb4';
$default_collation = 'utf8mb4_general_ci';
} else {
$default_charset = 'utf8';
$default_collation = 'utf8_general_ci';
}
if (! empty($GLOBALS['collation_connection'])) {
$this->query(
"SET CHARACTER SET '$default_charset';",
$link,
self::QUERY_STORE
);
/* Automatically adjust collation to mb4 variant */
if ($default_charset == 'utf8mb4'
&& strncmp('utf8_', $GLOBALS['collation_connection'], 5) == 0
) {
$GLOBALS['collation_connection'] = 'utf8mb4_' . substr(
$GLOBALS['collation_connection'],
5
);
}
$this->query(
"SET collation_connection = '"
. PMA_Util::sqlAddSlashes($GLOBALS['collation_connection'])
. "';",
$link,
self::QUERY_STORE
);
} else {
$this->query(
"SET NAMES '$default_charset' COLLATE '$default_collation';",
$link,
self::QUERY_STORE
);
}
if (PMA_MYSQL_INT_VERSION > 50503) {
$default_charset = 'utf8mb4';
$default_collation = 'utf8mb4_general_ci';
} else {
$default_charset = 'utf8';
$default_collation = 'utf8_general_ci';
}
// Cache plugin list for Drizzle
if (PMA_DRIZZLE && !PMA_Util::cacheExists('drizzle_engines')) {
$sql = "SELECT p.plugin_name, m.module_library
FROM data_dictionary.plugins p
JOIN data_dictionary.modules m USING (module_name)
WHERE p.plugin_type = 'StorageEngine'
AND p.plugin_name NOT IN ('FunctionEngine', 'schema')
AND p.is_active = 'YES'";
$engines = $this->fetchResult($sql, 'plugin_name', null, $link);
PMA_Util::cacheSet('drizzle_engines', $engines);
if (! empty($GLOBALS['collation_connection'])) {
$this->query(
"SET CHARACTER SET '$default_charset';",
$link,
self::QUERY_STORE
);
/* Automatically adjust collation to mb4 variant */
if ($default_charset == 'utf8mb4'
&& strncmp('utf8_', $GLOBALS['collation_connection'], 5) == 0
) {
$GLOBALS['collation_connection'] = 'utf8mb4_' . substr(
$GLOBALS['collation_connection'],
5
);
}
$this->query(
"SET collation_connection = '"
. PMA_Util::sqlAddSlashes($GLOBALS['collation_connection'])
. "';",
$link,
self::QUERY_STORE
);
} else {
$this->query(
"SET NAMES '$default_charset' COLLATE '$default_collation';",
$link,
self::QUERY_STORE
);
}
}
@ -2162,11 +1851,6 @@ class PMA_DatabaseInterface
*/
public function getCompatibilities()
{
// Drizzle doesn't support compatibility modes
if (PMA_DRIZZLE) {
return array();
}
$compats = array('NONE');
$compats[] = 'ANSI';
$compats[] = 'DB2';
@ -2211,10 +1895,6 @@ class PMA_DatabaseInterface
*/
public function getProceduresOrFunctions($db, $which, $link = null)
{
if (PMA_DRIZZLE) {
// Drizzle doesn't support functions and procedures
return array();
}
$shows = $this->fetchResult(
'SHOW ' . $which . ' STATUS;', null, null, $link
);
@ -2262,11 +1942,6 @@ class PMA_DatabaseInterface
*/
public function getRoutines($db, $which = null, $name = '')
{
if (PMA_DRIZZLE) {
// Drizzle doesn't support functions and procedures
return array();
}
$routines = array();
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$query = "SELECT"
@ -2355,11 +2030,6 @@ class PMA_DatabaseInterface
*/
public function getEvents($db, $name = '')
{
if (PMA_DRIZZLE) {
// Drizzle doesn't support events
return array();
}
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$query = "SELECT"
. " `EVENT_SCHEMA` AS `Db`,"
@ -2424,11 +2094,6 @@ class PMA_DatabaseInterface
*/
public function getTriggers($db, $table = '', $delimiter = '//')
{
if (PMA_DRIZZLE) {
// Drizzle doesn't support triggers
return array();
}
$result = array();
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$query = 'SELECT TRIGGER_SCHEMA, TRIGGER_NAME, EVENT_MANIPULATION'
@ -2599,16 +2264,6 @@ class PMA_DatabaseInterface
return PMA_Util::cacheGet('is_' . $type . 'user');
}
if (PMA_DRIZZLE) {
// Drizzle has no authorization by default, so when no plugin is
// enabled everyone is a superuser
// Known authorization libraries: regex_policy, simple_user_policy
// Plugins limit object visibility (dbs, tables, processes), we can
// safely assume we always deal with superuser
PMA_Util::cacheSet('is_' . $type . 'user', true);
return PMA_Util::cacheGet('is_' . $type . 'user');
}
if (! $GLOBALS['cfg']['Server']['DisableIS'] || $type === 'super') {
// Prepare query for each user type check
$query = '';
@ -2698,8 +2353,7 @@ class PMA_DatabaseInterface
public function getSystemSchemas()
{
$schemas = array(
'information_schema', 'performance_schema', 'data_dictionary', 'mysql',
'sys'
'information_schema', 'performance_schema', 'mysql', 'sys'
);
$systemSchemas = array();
foreach ($schemas as $schema) {
@ -2711,8 +2365,7 @@ class PMA_DatabaseInterface
}
/**
* Checks whether given schema is a system schema: information_schema
* (MySQL and Drizzle) or data_dictionary (Drizzle)
* Checks whether given schema is a system schema
*
* @param string $schema_name Name of schema (database) to test
* @param bool $testForMysqlSchema Whether 'mysql' schema should
@ -2724,10 +2377,9 @@ class PMA_DatabaseInterface
{
$schema_name = strtolower($schema_name);
return $schema_name == 'information_schema'
|| (!PMA_DRIZZLE && $schema_name == 'performance_schema')
|| (!PMA_DRIZZLE && $schema_name == 'mysql' && $testForMysqlSchema)
|| (!PMA_DRIZZLE && $schema_name == 'sys')
|| ( PMA_DRIZZLE && $schema_name == 'data_dictionary');
|| $schema_name == 'performance_schema'
|| ($schema_name == 'mysql' && $testForMysqlSchema)
|| $schema_name == 'sys';
}
/**

View File

@ -226,11 +226,8 @@ class PMA_DbSearch
|| /*overload*/mb_strlen($this->_criteriaColumnName) == 0
|| $column['Field'] == $this->_criteriaColumnName
) {
// Drizzle has no CONVERT and all text columns are UTF-8
$column = ((PMA_DRIZZLE)
? PMA_Util::backquote($column['Field'])
: 'CONVERT(' . PMA_Util::backquote($column['Field'])
. ' USING utf8)');
$column = 'CONVERT(' . PMA_Util::backquote($column['Field'])
. ' USING utf8)';
$likeClausesPerColumn[] = $column . ' ' . $like_or_regex . ' '
. "'"
. $automatic_wildcard . $search_word . $automatic_wildcard

View File

@ -1779,21 +1779,19 @@ class PMA_DisplayResults
)
. '</div>';
if (! PMA_DRIZZLE) {
$options_html .= '<div class="formelement">';
$choices = array(
'GEOM' => __('Geometry'),
'WKT' => __('Well Known Text'),
'WKB' => __('Well Known Binary')
);
$options_html .= '<div class="formelement">';
$choices = array(
'GEOM' => __('Geometry'),
'WKT' => __('Well Known Text'),
'WKB' => __('Well Known Binary')
);
$options_html .= PMA_Util::getRadioFields(
'geoOption', $choices,
$_SESSION['tmpval']['geoOption'],
true, true, '', 'geoOption_' . $this->__get('unique_id')
)
. '</div>';
}
$options_html .= PMA_Util::getRadioFields(
'geoOption', $choices,
$_SESSION['tmpval']['geoOption'],
true, true, '', 'geoOption_' . $this->__get('unique_id')
);
$options_html .= '</div>';
$options_html .= '<div class="clearfloat"></div>'
. '</fieldset>';
@ -4931,7 +4929,7 @@ class PMA_DisplayResults
private function _getLinkForCreateView($analyzed_sql_results, $url_query)
{
$results_operations_html = '';
if (!PMA_DRIZZLE && empty($analyzed_sql_results['procedure'])) {
if (empty($analyzed_sql_results['procedure'])) {
$ajax_class = ' ajax';

View File

@ -352,7 +352,7 @@ class PMA_Menu
$tabs['import']['text'] = __('Import');
}
if (($is_superuser || $isCreateOrGrantUser)
&& ! PMA_DRIZZLE && ! $db_is_system_schema
&& ! $db_is_system_schema
) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivsdb'] = $this->_db;
@ -385,7 +385,6 @@ class PMA_Menu
$tabs['tracking']['link'] = 'tbl_tracking.php';
}
if (! $db_is_system_schema
&& ! PMA_DRIZZLE
&& PMA_Util::currentUserHasPrivilege(
'TRIGGER',
$this->_db,
@ -459,7 +458,7 @@ class PMA_Menu
$tabs['operation']['text'] = __('Operations');
$tabs['operation']['icon'] = 'b_tblops.png';
if (($is_superuser || $isCreateOrGrantUser) && ! PMA_DRIZZLE) {
if (($is_superuser || $isCreateOrGrantUser)) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivsdb'] = $this->_db;
// stay on database view
@ -467,21 +466,18 @@ class PMA_Menu
$tabs['privileges']['text'] = __('Privileges');
$tabs['privileges']['icon'] = 's_rights.png';
}
if (! PMA_DRIZZLE) {
$tabs['routines']['link'] = 'db_routines.php';
$tabs['routines']['text'] = __('Routines');
$tabs['routines']['icon'] = 'b_routines.png';
}
if (! PMA_DRIZZLE
&& PMA_Util::currentUserHasPrivilege('EVENT', $this->_db)
) {
$tabs['routines']['link'] = 'db_routines.php';
$tabs['routines']['text'] = __('Routines');
$tabs['routines']['icon'] = 'b_routines.png';
if (PMA_Util::currentUserHasPrivilege('EVENT', $this->_db)) {
$tabs['events']['link'] = 'db_events.php';
$tabs['events']['text'] = __('Events');
$tabs['events']['icon'] = 'b_events.png';
}
if (! PMA_DRIZZLE
&& PMA_Util::currentUserHasPrivilege('TRIGGER', $this->_db)
) {
if (PMA_Util::currentUserHasPrivilege('TRIGGER', $this->_db)) {
$tabs['triggers']['link'] = 'db_triggers.php';
$tabs['triggers']['text'] = __('Triggers');
$tabs['triggers']['icon'] = 'b_triggers.png';
@ -522,19 +518,17 @@ class PMA_Menu
$isCreateOrGrantUser = $GLOBALS['dbi']->isUserType('grant')
|| $GLOBALS['dbi']->isUserType('create');
$binary_logs = null;
if (! defined('PMA_DRIZZLE') || ! PMA_DRIZZLE) {
if (PMA_Util::cacheExists('binary_logs')) {
$binary_logs = PMA_Util::cacheGet('binary_logs');
} else {
$binary_logs = $GLOBALS['dbi']->fetchResult(
'SHOW MASTER LOGS',
'Log_name',
null,
null,
PMA_DatabaseInterface::QUERY_STORE
);
PMA_Util::cacheSet('binary_logs', $binary_logs);
}
if (PMA_Util::cacheExists('binary_logs')) {
$binary_logs = PMA_Util::cacheGet('binary_logs');
} else {
$binary_logs = $GLOBALS['dbi']->fetchResult(
'SHOW MASTER LOGS',
'Log_name',
null,
null,
PMA_DatabaseInterface::QUERY_STORE
);
PMA_Util::cacheSet('binary_logs', $binary_logs);
}
$tabs = array();
@ -562,7 +556,7 @@ class PMA_Menu
)
);
if (($is_superuser || $isCreateOrGrantUser) && ! PMA_DRIZZLE) {
if ($is_superuser || $isCreateOrGrantUser) {
$tabs['rights']['icon'] = 's_rights.png';
$tabs['rights']['link'] = 'server_privileges.php';
$tabs['rights']['text'] = __('User accounts');
@ -595,7 +589,7 @@ class PMA_Menu
$tabs['binlog']['text'] = __('Binary log');
}
if ($is_superuser && ! PMA_DRIZZLE) {
if ($is_superuser) {
$tabs['replication']['icon'] = 's_replication.png';
$tabs['replication']['link'] = 'server_replication.php';
$tabs['replication']['text'] = __('Replication');
@ -609,22 +603,10 @@ class PMA_Menu
$tabs['charset']['link'] = 'server_collations.php';
$tabs['charset']['text'] = __('Charsets');
if (defined('PMA_DRIZZLE') && PMA_DRIZZLE) {
$tabs['plugins']['icon'] = 'b_engine.png';
$tabs['plugins']['link'] = 'server_plugins.php';
$tabs['plugins']['text'] = __('Plugins');
$tabs['plugins']['active'] = in_array(
basename($GLOBALS['PMA_PHP_SELF']),
array(
'server_plugins.php',
'server_modules.php',
)
);
} else {
$tabs['engine']['icon'] = 'b_engine.png';
$tabs['engine']['link'] = 'server_engines.php';
$tabs['engine']['text'] = __('Engines');
}
$tabs['engine']['icon'] = 'b_engine.png';
$tabs['engine']['link'] = 'server_engines.php';
$tabs['engine']['text'] = __('Engines');
return $tabs;
}

View File

@ -327,14 +327,6 @@ class PMA_ServerStatusData
$GLOBALS['dbi']->freeResult($server_status_result);
}
if (PMA_DRIZZLE) {
// Drizzle doesn't put query statistics into variables, add it
$sql = "SELECT concat('Com_', variable_name), variable_value "
. "FROM data_dictionary.GLOBAL_STATEMENTS";
$statements = $GLOBALS['dbi']->fetchResult($sql, 0, 1);
$server_status = array_merge($server_status, $statements);
}
// for some calculations we require also some server settings
$server_variables = $GLOBALS['dbi']->fetchResult(
'SHOW GLOBAL VARIABLES', 0, 1
@ -374,18 +366,9 @@ class PMA_ServerStatusData
$used_queries
);
if (PMA_DRIZZLE) {
$used_queries = $GLOBALS['dbi']->fetchResult(
'SELECT * FROM data_dictionary.global_statements',
0,
1
);
unset($used_queries['admin_commands']);
} else {
// admin commands are not queries (e.g. they include COM_PING,
// which is excluded from $server_status['Questions'])
unset($used_queries['Com_admin_commands']);
}
// admin commands are not queries (e.g. they include COM_PING,
// which is excluded from $server_status['Questions'])
unset($used_queries['Com_admin_commands']);
// Set all class properties
$this->db_isLocal = false;

View File

@ -94,35 +94,20 @@ class PMA_StorageEngine
static $storage_engines = null;
if (null == $storage_engines) {
if (PMA_DRIZZLE) {
$sql = "SELECT
p.plugin_name AS Engine,
(CASE
WHEN p.plugin_name = @@storage_engine THEN 'DEFAULT'
WHEN p.is_active THEN 'YES'
ELSE 'DISABLED' END) AS Support,
m.module_description AS Comment
FROM data_dictionary.plugins p
JOIN data_dictionary.modules m USING (module_name)
WHERE p.plugin_type = 'StorageEngine'
AND p.plugin_name NOT IN ('FunctionEngine', 'schema')";
$storage_engines = $GLOBALS['dbi']->fetchResult($sql, 'Engine');
} else {
$storage_engines
= $GLOBALS['dbi']->fetchResult('SHOW STORAGE ENGINES', 'Engine');
if (PMA_MYSQL_INT_VERSION >= 50708) {
$disabled = PMA_Util::cacheGet(
'disabled_storage_engines',
function() {
return $GLOBALS['dbi']->fetchValue(
'SELECT @@disabled_storage_engines'
);
}
);
foreach (explode(",", $disabled) as $engine) {
if (isset($storage_engines[$engine])) {
$storage_engines[$engine]['Support'] = 'DISABLED';
}
$storage_engines
= $GLOBALS['dbi']->fetchResult('SHOW STORAGE ENGINES', 'Engine');
if (PMA_MYSQL_INT_VERSION >= 50708) {
$disabled = PMA_Util::cacheGet(
'disabled_storage_engines',
function() {
return $GLOBALS['dbi']->fetchValue(
'SELECT @@disabled_storage_engines'
);
}
);
foreach (explode(",", $disabled) as $engine) {
if (isset($storage_engines[$engine])) {
$storage_engines[$engine]['Support'] = 'DISABLED';
}
}
}
@ -153,12 +138,10 @@ class PMA_StorageEngine
foreach (PMA_StorageEngine::getStorageEngines() as $key => $details) {
// Don't show PERFORMANCE_SCHEMA engine (MySQL 5.5)
// Don't show MyISAM for Drizzle (allowed only for temporary tables)
if (! $offerUnavailableEngines
&& ($details['Support'] == 'NO'
|| $details['Support'] == 'DISABLED'
|| $details['Engine'] == 'PERFORMANCE_SCHEMA')
|| (PMA_DRIZZLE && $details['Engine'] == 'MyISAM')
) {
continue;
}

View File

@ -530,12 +530,7 @@ class PMA_Table
return $row_count;
}
// Make an exception for views in I_S and D_D schema in
// Drizzle, as these map to in-memory data and should execute
// fast enough
if (! $is_view
|| (PMA_DRIZZLE && $this->_dbi->isSystemSchema($db))
) {
if (! $is_view) {
$row_count = $this->_dbi->fetchValue(
'SELECT COUNT(*) FROM ' . PMA_Util::backquote($db) . '.'
. PMA_Util::backquote($table)
@ -823,12 +818,9 @@ class PMA_Table
// Find server's SQL mode so the builder can generate correct
// queries.
// One of the options that alters the behaviour is `ANSI_QUOTES`.
// This is not availabile for Drizzle.
if (!PMA_DRIZZLE) {
SqlParser\Context::setMode(
$GLOBALS['dbi']->fetchValue("SELECT @@sql_mode")
);
}
SqlParser\Context::setMode(
$GLOBALS['dbi']->fetchValue("SELECT @@sql_mode")
);
// -----------------------------------------------------------------
// Phase 1: Dropping existent element of the same name (if exists
@ -1008,11 +1000,9 @@ class PMA_Table
if (($what == 'data' || $what == 'dataonly')
&& ! $_table->isView()
) {
if (! PMA_DRIZZLE) {
$sql_set_mode = "SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO'";
$GLOBALS['dbi']->query($sql_set_mode);
$GLOBALS['sql_query'] .= "\n\n" . $sql_set_mode . ';';
}
$sql_set_mode = "SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO'";
$GLOBALS['dbi']->query($sql_set_mode);
$GLOBALS['sql_query'] .= "\n\n" . $sql_set_mode . ';';
$sql_insert_data = 'INSERT INTO ' . $target
. ' SELECT * FROM ' . $source;

View File

@ -23,19 +23,6 @@ class PMA_Tracker
*/
static protected $enabled = false;
/**
* Flags copied from `tracking` column definition in `pma_tracking` table.
* Used for column type conversion in Drizzle.
*
* @var array
*/
static private $_tracking_set_flags = array(
'UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE',
'ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE',
'RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX',
'CREATE VIEW','ALTER VIEW','DROP VIEW'
);
/**
* Actually enables tracking. This needs to be done after all
* underlaying code is initialized.
@ -263,7 +250,7 @@ class PMA_Tracker
'" . PMA_Util::sqlAddSlashes($snapshot) . "',
'" . PMA_Util::sqlAddSlashes($create_sql) . "',
'" . PMA_Util::sqlAddSlashes("\n") . "',
'" . PMA_Util::sqlAddSlashes(self::_transformTrackingSet($tracking_set))
'" . PMA_Util::sqlAddSlashes($tracking_set)
. "' )";
$result = PMA_queryAsControlUser($sql_query);
@ -359,7 +346,7 @@ class PMA_Tracker
'" . PMA_Util::sqlAddSlashes('') . "',
'" . PMA_Util::sqlAddSlashes($create_sql) . "',
'" . PMA_Util::sqlAddSlashes("\n") . "',
'" . PMA_Util::sqlAddSlashes(self::_transformTrackingSet($tracking_set))
'" . PMA_Util::sqlAddSlashes($tracking_set)
. "' )";
$result = PMA_queryAsControlUser($sql_query);
@ -495,13 +482,8 @@ class PMA_Tracker
" AND `table_name` = '" . PMA_Util::sqlAddSlashes($tablename) . "' ";
if ($statement != "") {
if (PMA_DRIZZLE) {
$sql_query .= ' AND tracking & '
. self::_transformTrackingSet($statement) . ' <> 0';
} else {
$sql_query .= " AND FIND_IN_SET('"
. $statement . "',tracking) > 0" ;
}
$sql_query .= " AND FIND_IN_SET('"
. $statement . "',tracking) > 0" ;
}
$row = $GLOBALS['dbi']->fetchArray(PMA_queryAsControlUser($sql_query));
return isset($row[0])
@ -608,7 +590,7 @@ class PMA_Tracker
}
$data['ddlog'] = $ddlog;
$data['dmlog'] = $dmlog;
$data['tracking'] = self::_transformTrackingSet($mixed['tracking']);
$data['tracking'] = $mixed['tracking'];
$data['schema_snapshot'] = $mixed['schema_snapshot'];
return $data;
@ -962,60 +944,6 @@ class PMA_Tracker
}
}
/**
* Transforms tracking set for Drizzle, which has no SET type
*
* Converts int<>string for Drizzle, does nothing for MySQL
*
* @param int|string $tracking_set Set to convert
*
* @return int|string
*/
static private function _transformTrackingSet($tracking_set)
{
if (!PMA_DRIZZLE) {
return $tracking_set;
}
// init conversion array (key 3 doesn't exist in calculated array)
if (isset(self::$_tracking_set_flags[3])) {
// initialize flags
$set = self::$_tracking_set_flags;
$array = array();
for ($i = 0, $nb = count($set); $i < $nb; $i++) {
$flag = 1 << $i;
$array[$flag] = $set[$i];
$array[$set[$i]] = $flag;
}
self::$_tracking_set_flags = $array;
}
if (is_numeric($tracking_set)) {
// int > string conversion
$aflags = array();
// count/2 - conversion table has both int > string
// and string > int values
for ($i = 0, $nb = count(self::$_tracking_set_flags)/2; $i < $nb; $i++) {
$flag = 1 << $i;
if ($tracking_set & $flag) {
$aflags[] = self::$_tracking_set_flags[$flag];
}
}
$flags = implode(',', $aflags);
} else {
// string > int conversion
$flags = 0;
foreach (explode(',', $tracking_set) as $strflag) {
if ($strflag == '') {
continue;
}
$flags |= self::$_tracking_set_flags[$strflag];
}
}
return $flags;
}
/**
* Returns the tracking table
*

View File

@ -861,365 +861,3 @@ class PMA_Types_MySQL extends PMA_Types
return isset($relevantArray[$type]) ? $relevantArray[$type] : array('', '');
}
}
/**
* Class holding type definitions for Drizzle.
*
* @package PhpMyAdmin
*/
class PMA_Types_Drizzle extends PMA_Types
{
/**
* Returns the data type description.
*
* @param string $type The data type to get a description.
*
* @return string
*
*/
public function getTypeDescription($type)
{
$type = /*overload*/mb_strtoupper($type);
switch ($type) {
case 'INTEGER':
return __('A 4-byte integer, range is -2,147,483,648 to 2,147,483,647');
case 'BIGINT':
return __(
'An 8-byte integer, range is -9,223,372,036,854,775,808 to ' .
'9,223,372,036,854,775,807'
);
case 'DECIMAL':
return __(
'A fixed-point number (M, D) - the maximum number of digits ' .
'(M) is 65 (default 10), the maximum number of decimals (D) ' .
'is 30 (default 0)'
);
case 'DOUBLE':
return __("A system's default double-precision floating-point number");
case 'BOOLEAN':
return __('True or false');
case 'SERIAL':
return __('An alias for BIGINT NOT NULL AUTO_INCREMENT UNIQUE');
case 'UUID':
return __('Stores a Universally Unique Identifier (UUID)');
case 'DATE':
return sprintf(
__('A date, supported range is %1$s to %2$s'), '0001-01-01',
'9999-12-31'
);
case 'DATETIME':
return sprintf(
__(
'A date and time combination, supported range is %1$s to ' .
'%2$s'
), '0001-01-01 00:00:0', '9999-12-31 23:59:59'
);
case 'TIMESTAMP':
return __(
"A timestamp, range is '0001-01-01 00:00:00' UTC to " .
"'9999-12-31 23:59:59' UTC; TIMESTAMP(6) can store microseconds"
);
case 'TIME':
return sprintf(
__('A time, range is %1$s to %2$s'), '00:00:00', '23:59:59'
);
case 'VARCHAR':
return sprintf(
__(
'A variable-length (%s) string, the effective ' .
'maximum length is subject to the maximum row size'
), '0-16,383'
);
case 'TEXT':
return __(
'A TEXT column with a maximum length of 65,535 (2^16 - 1) ' .
'characters, stored with a two-byte prefix indicating the ' .
'length of the value in bytes'
);
case 'VARBINARY':
return __(
'A variable-length (0-65,535) string, uses binary collation ' .
'for all comparisons'
);
case 'BLOB':
return __(
'A BLOB column with a maximum length of 65,535 (2^16 - 1) ' .
'bytes, stored with a two-byte prefix indicating the length of ' .
'the value'
);
case 'ENUM':
return __("An enumeration, chosen from the list of defined values");
}
return '';
}
/**
* Returns class of a type, used for functions available for type
* or default values.
*
* @param string $type The data type to get a class.
*
* @return string
*
*/
public function getTypeClass($type)
{
$type = /*overload*/mb_strtoupper($type);
switch ($type) {
case 'INTEGER':
case 'BIGINT':
case 'DECIMAL':
case 'DOUBLE':
case 'BOOLEAN':
case 'SERIAL':
return 'NUMBER';
case 'DATE':
case 'DATETIME':
case 'TIMESTAMP':
case 'TIME':
return 'DATE';
case 'VARCHAR':
case 'TEXT':
case 'VARBINARY':
case 'BLOB':
case 'ENUM':
return 'CHAR';
case 'UUID':
return 'UUID';
}
return '';
}
/**
* Returns array of functions available for a class.
*
* @param string $class The class to get function list.
*
* @return string[]
*
*/
public function getFunctionsClass($class)
{
switch ($class) {
case 'CHAR':
$ret = array(
'BIN',
'CHAR',
'COMPRESS',
'CURRENT_USER',
'DATABASE',
'DAYNAME',
'HEX',
'LOAD_FILE',
'LOWER',
'LTRIM',
'MD5',
'MONTHNAME',
'QUOTE',
'REVERSE',
'RTRIM',
'SCHEMA',
'SPACE',
'TRIM',
'UNCOMPRESS',
'UNHEX',
'UPPER',
'USER',
'UUID',
'VERSION',
);
// check for some functions known to be in modules
$functions = array(
'MYSQL_PASSWORD',
'ROT13',
);
// add new functions
$sql = "SELECT upper(plugin_name) f
FROM data_dictionary.plugins
WHERE plugin_name IN ('" . implode("','", $functions) . "')
AND plugin_type = 'Function'
AND is_active";
$drizzle_functions = $GLOBALS['dbi']->fetchResult($sql, 'f', 'f');
if (count($drizzle_functions) > 0) {
$ret = array_merge($ret, $drizzle_functions);
sort($ret);
}
return $ret;
case 'UUID':
return array(
'UUID',
);
case 'DATE':
return array(
'CURRENT_DATE',
'CURRENT_TIME',
'DATE',
'FROM_DAYS',
'FROM_UNIXTIME',
'LAST_DAY',
'NOW',
'SYSDATE',
//'TIME', // https://bugs.launchpad.net/drizzle/+bug/804571
'TIMESTAMP',
'UTC_DATE',
'UTC_TIME',
'UTC_TIMESTAMP',
'YEAR',
);
case 'NUMBER':
return array(
'ABS',
'ACOS',
'ASCII',
'ASIN',
'ATAN',
'BIT_COUNT',
'CEILING',
'CHAR_LENGTH',
'CONNECTION_ID',
'COS',
'COT',
'CRC32',
'DAYOFMONTH',
'DAYOFWEEK',
'DAYOFYEAR',
'DEGREES',
'EXP',
'FLOOR',
'HOUR',
'LENGTH',
'LN',
'LOG',
'LOG2',
'LOG10',
'MICROSECOND',
'MINUTE',
'MONTH',
'OCT',
'ORD',
'PI',
'QUARTER',
'RADIANS',
'RAND',
'ROUND',
'SECOND',
'SIGN',
'SIN',
'SQRT',
'TAN',
'TO_DAYS',
'TIME_TO_SEC',
'UNCOMPRESSED_LENGTH',
'UNIX_TIMESTAMP',
//'WEEK', // same as TIME
'WEEKDAY',
'WEEKOFYEAR',
'YEARWEEK',
);
}
return array();
}
/**
* Returns array of all attributes available.
*
* @return string[]
*
*/
public function getAttributes()
{
return array(
'',
'on update CURRENT_TIMESTAMP',
);
}
/**
* Returns array of all column types available.
*
* @return string[]
*
*/
public function getColumns()
{
$types_num = array(
'INTEGER',
'BIGINT',
'-',
'DECIMAL',
'DOUBLE',
'-',
'BOOLEAN',
'SERIAL',
'UUID',
);
$types_date = array(
'DATE',
'DATETIME',
'TIMESTAMP',
'TIME',
);
$types_string = array(
'VARCHAR',
'TEXT',
'-',
'VARBINARY',
'BLOB',
'-',
'ENUM',
);
if (PMA_MYSQL_INT_VERSION >= 70132) {
$types_string[] = '-';
$types_string[] = 'IPV6';
}
$ret = parent::getColumns();
// numeric
$ret[_pgettext('numeric types', 'Numeric')] = $types_num;
// Date/Time
$ret[_pgettext('date and time types', 'Date and time')] = $types_date;
// Text
$ret[_pgettext('string types', 'String')] = $types_string;
return $ret;
}
/**
* Returns an array of integer types
*
* @return string[] integer types
*/
public function getIntegerTypes()
{
return array('integer', 'bigint');
}
/**
* Returns the min and max values of a given integer type
*
* @param string $type integer type
* @param boolean $signed whether signed (ignored for Drizzle)
*
* @return string[] min and max values
*/
public function getIntegerRange($type, $signed = true)
{
static $min_max_data = array(
'integer' => array('-2147483648', '2147483647'),
'bigint' => array('-9223372036854775808', '9223372036854775807')
);
return isset($min_max_data[$type]) ? $min_max_data[$type] : array('', '');
}
}

View File

@ -4132,17 +4132,13 @@ class PMA_Util
/**
* Returns server type for current connection
*
* Known types are: Drizzle, MariaDB and MySQL (default)
* Known types are: MariaDB and MySQL (default)
*
* @return string
*/
public static function getServerType()
{
$server_type = 'MySQL';
if (PMA_DRIZZLE) {
$server_type = 'Drizzle';
return $server_type;
}
if (/*overload*/mb_stripos(PMA_MYSQL_STR_VERSION, 'mariadb') !== false) {
$server_type = 'MariaDB';
@ -4853,7 +4849,7 @@ class PMA_Util
$tooltip_aliasname = array();
// Special speedup for newer MySQL Versions (in 4.0 format changed)
if (true === $cfg['SkipLockedTables'] && ! PMA_DRIZZLE) {
if (true === $cfg['SkipLockedTables']) {
$db_info_result = $GLOBALS['dbi']->query(
'SHOW OPEN TABLES FROM ' . PMA_Util::backquote($db) . ';'
);

View File

@ -163,7 +163,7 @@ function PMA_buildHtmlForDb(
}
}
if ($is_superuser && !PMA_DRIZZLE) {
if ($is_superuser) {
$out .= '<td class="tool">'
. '<a onclick="'
. 'PMA_commonActions.setDb(\''

View File

@ -376,31 +376,19 @@ function PMA_analyseShowGrant()
PMA_Util::cacheSet('dbs_to_test', $GLOBALS['dbs_to_test']);
} // end function
if (!PMA_DRIZZLE) {
$user = $GLOBALS['dbi']->fetchValue("SELECT CURRENT_USER();");
if ($user == '@') { // MySQL is started with --skip-grant-tables
$GLOBALS['is_create_db_priv'] = true;
$GLOBALS['is_reload_priv'] = true;
$GLOBALS['db_to_create'] = '';
$GLOBALS['dbs_where_create_table_allowed'] = array('*');
$GLOBALS['dbs_to_test'] = false;
} else {
PMA_analyseShowGrant();
}
// Check if privileges to 'mysql'.col_privs, 'mysql'.db,
// 'mysql'.table_privs, 'mysql'.proc_privs and privileges for
// flushing the privileges are available
PMA_checkRequiredPrivilegesForFlushing();
PMA_checkRequiredPrivilgesForAdjust();
} else {
// todo: for simple_user_policy only database with user's login can be created
// (unless logged in as root)
$GLOBALS['is_create_db_priv'] = $GLOBALS['is_superuser'];
$GLOBALS['is_reload_priv'] = false;
$user = $GLOBALS['dbi']->fetchValue("SELECT CURRENT_USER();");
if ($user == '@') { // MySQL is started with --skip-grant-tables
$GLOBALS['is_create_db_priv'] = true;
$GLOBALS['is_reload_priv'] = true;
$GLOBALS['db_to_create'] = '';
$GLOBALS['dbs_where_create_table_allowed'] = array('*');
$GLOBALS['dbs_to_test'] = false;
} else {
PMA_analyseShowGrant();
}
// Check if privileges to 'mysql'.col_privs, 'mysql'.db,
// 'mysql'.table_privs, 'mysql'.proc_privs and privileges for
// flushing the privileges are available
PMA_checkRequiredPrivilegesForFlushing();
PMA_checkRequiredPrivilgesForAdjust();

View File

@ -1041,26 +1041,13 @@ if (! defined('PMA_MINIMUM_COMMON')) {
/**
* Type handling object.
*/
if (PMA_DRIZZLE) {
$GLOBALS['PMA_Types'] = new PMA_Types_Drizzle();
} else {
$GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
}
if (PMA_DRIZZLE) {
// DisableIS must be set to false for Drizzle, it maps SHOW commands
// to INFORMATION_SCHEMA queries anyway so it's fast on large servers
$cfg['Server']['DisableIS'] = false;
// SHOW OPEN TABLES is not supported by Drizzle
$cfg['SkipLockedTables'] = false;
}
$GLOBALS['PMA_Types'] = new PMA_Types_MySQL();
/**
* Charset information
*/
if (!PMA_DRIZZLE) {
include_once './libraries/mysql_charsets.inc.php';
}
require_once './libraries/mysql_charsets.inc.php';
if (!isset($mysql_charsets)) {
$mysql_charsets = array();
$mysql_collations_flat = array();
@ -1072,9 +1059,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
include_once './libraries/sql-parser/autoload.php';
// Loads closest context to this version.
SqlParser\Context::loadClosest(
(PMA_DRIZZLE ? 'Drizzle' : 'MySql') . PMA_MYSQL_INT_VERSION
);
SqlParser\Context::loadClosest('MySql' . PMA_MYSQL_INT_VERSION);
// Sets the default delimiter (if specified).
if (!empty($_REQUEST['sql_delimiter'])) {

View File

@ -549,7 +549,7 @@ $cfg['Servers'][$i]['AllowDeny']['order'] = '';
$cfg['Servers'][$i]['AllowDeny']['rules'] = array();
/**
* Disable use of INFORMATION_SCHEMA. Is always 'false' for Drizzle.
* Disable use of INFORMATION_SCHEMA.
*
* @see https://sourceforge.net/p/phpmyadmin/bugs/2606/
* @see http://bugs.mysql.com/19588
@ -730,7 +730,6 @@ $cfg['MemoryLimit'] = '-1';
/**
* mark used tables, make possible to show locked tables (since MySQL 3.23.30)
* Is ignored for Drizzle.
*
* @global boolean $cfg['SkipLockedTables']
*/

View File

@ -241,37 +241,7 @@ class PMA_Validator
$extension = 'mysql';
}
// dead code (drizzle extension)
if ($extension == 'drizzle') {
while (1) {
$drizzle = @drizzle_create();
if (! $drizzle) {
$error = __('Could not initialize Drizzle connection library!');
break;
}
$conn = $socket
? @drizzle_con_add_uds($socket, $user, $pass, null, 0)
: @drizzle_con_add_tcp(
$drizzle, $host, $port, $user, $pass, null, 0
);
if (! $conn) {
$error = __('Could not connect to the database server!');
drizzle_free($drizzle);
break;
}
// connection object is set up but we have to send some query
// to actually connect
$res = @drizzle_query($conn, 'SELECT 1');
if (! $res) {
$error = __('Could not connect to the database server!');
} else {
drizzle_result_free($res);
}
drizzle_con_free($conn);
drizzle_free($drizzle);
break;
}
} else if ($extension == 'mysql') {
if ($extension == 'mysql') {
$conn = @mysql_connect($host . $port . $socket, $user, $pass);
if (! $conn) {
$error = __('Could not connect to the database server!');

View File

@ -161,11 +161,7 @@ class DatabaseStructureController extends DatabaseController
return;
}
if (!PMA_DRIZZLE) {
include_once 'libraries/replication.inc.php';
} else {
$GLOBALS['replication_info']['slave']['status'] = false;
}
require_once 'libraries/replication.inc.php';
PMA_PageSettings::showGroup('DbStructure');
@ -558,27 +554,6 @@ class DatabaseStructureController extends DatabaseController
$approx_rows = !$table_is_view
&& $current_table['ENGINE'] == 'InnoDB'
&& !$current_table['COUNTED'];
// Drizzle views use FunctionEngine, and the only place where
// they are available are I_S and D_D schemas, where we do exact
// counting
if ($table_is_view
&& $current_table['TABLE_ROWS'] >= $GLOBALS['cfg']['MaxExactCountViews']
&& $current_table['ENGINE'] != 'FunctionEngine'
) {
$approx_rows = true;
$show_superscript = PMA_Util::showHint(
PMA_sanitize(
sprintf(
__(
'This view has at least this number of '
. 'rows. Please refer to %sdocumentation%s.'
),
'[doc@cfg_MaxExactCountViews]', '[/doc]'
)
)
);
}
}
$this->response->addHTML(
@ -929,7 +904,6 @@ class DatabaseStructureController extends DatabaseController
= $this->getValuesForInnodbTable(
$current_table, $sum_size
);
//$display_rows = ' - ';
break;
// Mysql 5.0.x (and lower) uses MRG_MyISAM
// and MySQL 5.1.x (and higher) uses MRG_MYISAM
@ -948,9 +922,6 @@ class DatabaseStructureController extends DatabaseController
// or on some servers it's reported as "SYSTEM VIEW"
case null :
case 'SYSTEM VIEW' :
case 'FunctionEngine' :
// possibly a view, do nothing
break;
default :
// Unknown table type.
if ($this->_is_show_stats) {
@ -1047,8 +1018,7 @@ class DatabaseStructureController extends DatabaseController
$current_table['COUNTED'] = false;
}
// Drizzle doesn't provide data and index length, check for null
if ($this->_is_show_stats && $current_table['Data_length'] !== null) {
if ($this->_is_show_stats) {
$tblsize = $current_table['Data_length']
+ $current_table['Index_length'];
$sum_size += $tblsize;

View File

@ -335,10 +335,7 @@ class TableRelationController extends TableController
$tables = array();
$foreign = isset($_REQUEST['foreign']) && $_REQUEST['foreign'] === 'true';
// In Drizzle, 'SHOW TABLE STATUS' will show status only for the tables
// which are currently in the table cache. Hence we have to use 'SHOW TABLES'
// and manually retrieve table engine values.
if ($foreign && !PMA_DRIZZLE) {
if ($foreign) {
$query = 'SHOW TABLE STATUS FROM '
. PMA_Util::backquote($_REQUEST['foreignDb']);
$tables_rs = $this->dbi->query(
@ -363,20 +360,7 @@ class TableRelationController extends TableController
PMA_DatabaseInterface::QUERY_STORE
);
while ($row = $this->dbi->fetchArray($tables_rs)) {
if ($foreign && PMA_DRIZZLE) {
$engine = /*overload*/
mb_strtoupper(
$GLOBALS['dbi']->getTable(
$_REQUEST['foreignDb'],
$row[0]
)->getStatusInfo('Engine')
);
if (isset($engine) && $engine == $this->tbl_storage_engine) {
$tables[] = htmlspecialchars($row[0]);
}
} else {
$tables[] = htmlspecialchars($row[0]);
}
$tables[] = htmlspecialchars($row[0]);
}
}
$this->response->addJSON('tables', $tables);

View File

@ -840,8 +840,7 @@ class TableStructureController extends TableController
{
$changed = false;
if ((!defined('PMA_DRIZZLE') || !PMA_DRIZZLE)
&& Util\get($GLOBALS, 'col_priv', false)
if (Util\get($GLOBALS, 'col_priv', false)
&& Util\get($GLOBALS, 'flush_priv', false)
) {
$this->dbi->selectDb('mysql');

View File

@ -843,8 +843,6 @@ function PMA_isAllowedDomain($url)
'docs.phpmyadmin.net',
/* mysql.com domains */
'dev.mysql.com','bugs.mysql.com',
/* drizzle.org domains */
'www.drizzle.org',
/* mariadb domains */
'mariadb.org',
/* php.net domains */

View File

@ -1,166 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Definition of internal relations for data dictionary tables.
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
*
*/
$GLOBALS['data_dictionary_relations'] = array(
'CHARACTER_SETS' => array(
'DEFAULT_COLLATE_NAME' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'COLLATIONS',
'foreign_field' => 'COLLATION_NAME'
)
),
'COLLATIONS' => array(
'CHARACTER_SET_NAME' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'CHARACTER_SETS',
'foreign_field' => 'CHARACTER_SET_NAME'
)
),
'COLUMNS' => array(
'TABLE_SCHEMA' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'SCHEMAS',
'foreign_field' => 'SCHEMA_NAME'
),
'COLLATION_NAME' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'COLLATIONS',
'foreign_field' => 'COLLATION_NAME'
)
),
'INDEXES' => array(
'TABLE_SCHEMA' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'SCHEMAS',
'foreign_field' => 'SCHEMA_NAME'
)
),
'INDEX_PARTS' => array(
'TABLE_SCHEMA' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'SCHEMAS',
'foreign_field' => 'SCHEMA_NAME'
)
),
'INNODB_LOCKS' => array(
'LOCK_TRX_ID' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'INNODB_TRX',
'foreign_field' => 'TRX_ID'
)
),
'INNODB_LOCK_WAITS' => array(
'REQUESTING_TRX_ID' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'INNODB_TRX',
'foreign_field' => 'TRX_ID'
),
'REQUESTED_LOCK_ID' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'INNODB_LOCKS',
'foreign_field' => 'LOCK_ID'
),
'BLOCKING_TRX_ID' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'INNODB_TRX',
'foreign_field' => 'TRX_ID'
),
'BLOCKING_LOCK_ID' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'INNODB_LOCKS',
'foreign_field' => 'LOCK_ID'
)
),
'INNODB_SYS_COLUMNS' => array(
'TABLE_ID' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'INNODB_SYS_TABLES',
'foreign_field' => 'TABLE_ID'
)
),
'INNODB_SYS_FIELDS' => array(
'INDEX_ID' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'INNODB_SYS_INDEXES',
'foreign_field' => 'INDEX_ID'
)
),
'INNODB_SYS_INDEXES' => array(
'TABLE_ID' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'INNODB_SYS_TABLES',
'foreign_field' => 'TABLE_ID'
)
),
'INNODB_SYS_TABLESTATS' => array(
'TABLE_ID' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'INNODB_SYS_TABLES',
'foreign_field' => 'TABLE_ID'
)
),
'PLUGINS' => array(
'MODULE_NAME' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'MODULES',
'foreign_field' => 'MODULE_NAME'
)
),
'SCHEMAS' => array(
'DEFAULT_COLLATION_NAME' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'COLLATIONS',
'foreign_field' => 'COLLATION_NAME'
)
),
'TABLES' => array(
'TABLE_SCHEMA' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'SCHEMAS',
'foreign_field' => 'SCHEMA_NAME'
),
'TABLE_COLLATION' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'COLLATIONS',
'foreign_field' => 'COLLATION_NAME'
)
),
'TABLE_CACHE' => array(
'TABLE_SCHEMA' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'SCHEMAS',
'foreign_field' => 'SCHEMA_NAME'
)
),
'TABLE_CONSTRAINTS' => array(
'CONSTRAINT_SCHEMA' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'SCHEMAS',
'foreign_field' => 'SCHEMA_NAME'
),
'TABLE_SCHEMA' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'SCHEMAS',
'foreign_field' => 'SCHEMA_NAME'
)
),
'TABLE_DEFINITION_CACHE' => array(
'TABLE_SCHEMA' => array(
'foreign_db' => 'data_dictionary',
'foreign_table' => 'SCHEMAS',
'foreign_field' => 'SCHEMA_NAME'
)
)
);

View File

@ -1,554 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Interface to the Drizzle extension
*
* WARNING - EXPERIMENTAL, never use in production,
* drizzle module segfaults often and when you least expect it to
*
* TODO: This file and drizzle-wrappers.lib.php should be devoid
* of any segfault related hacks.
* TODO: Crashing versions of drizzle module and/or libdrizzle
* should be blacklisted
*
* @package PhpMyAdmin-DBI
* @subpackage Drizzle
*/
if (! defined('PHPMYADMIN')) {
exit;
}
require_once './libraries/dbi/drizzle-wrappers.lib.php';
require_once './libraries/dbi/DBIExtension.int.php';
/**
* MySQL client API
*/
if (! defined('PMA_MYSQL_CLIENT_API')) {
define('PMA_MYSQL_CLIENT_API', (int)drizzle_version());
}
/**
* Names of field flags.
*/
if (! defined('DRIZZLE_COLUMN_FLAGS_NUM')) {
$pma_drizzle_flag_names = array();
} else {
$pma_drizzle_flag_names = array(
DRIZZLE_COLUMN_FLAGS_NUM => 'num',
DRIZZLE_COLUMN_FLAGS_PART_KEY => 'part_key',
DRIZZLE_COLUMN_FLAGS_SET => 'set',
DRIZZLE_COLUMN_FLAGS_TIMESTAMP => 'timestamp',
DRIZZLE_COLUMN_FLAGS_AUTO_INCREMENT => 'auto_increment',
DRIZZLE_COLUMN_FLAGS_ENUM => 'enum',
DRIZZLE_COLUMN_FLAGS_ZEROFILL => 'zerofill',
DRIZZLE_COLUMN_FLAGS_UNSIGNED => 'unsigned',
DRIZZLE_COLUMN_FLAGS_BLOB => 'blob',
DRIZZLE_COLUMN_FLAGS_MULTIPLE_KEY => 'multiple_key',
DRIZZLE_COLUMN_FLAGS_UNIQUE_KEY => 'unique_key',
DRIZZLE_COLUMN_FLAGS_PRI_KEY => 'primary_key',
DRIZZLE_COLUMN_FLAGS_NOT_NULL => 'not_null',
);
}
/**
* Interface to the Drizzle extension
*
* @package PhpMyAdmin-DBI
* @subpackage Drizzle
*/
class PMA_DBI_Drizzle implements PMA_DBI_Extension
{
/**
* Helper function for connecting to the database server
*
* @param PMA_Drizzle $drizzle connection handle
* @param string $host Drizzle host
* @param integer $port Drizzle port
* @param string $uds server socket
* @param string $user username
* @param string $password password
* @param string $db database name
* @param integer $options connection options
*
* @return PMA_DrizzleCon
*/
private function _realConnect($drizzle, $host, $port, $uds, $user, $password,
$db = null, $options = 0
) {
if ($uds) {
$con = $drizzle->addUds($uds, $user, $password, $db, $options);
} else {
$con = $drizzle->addTcp($host, $port, $user, $password, $db, $options);
}
return $con;
}
/**
* connects to the database server
*
* @param string $user drizzle user name
* @param string $password drizzle user password
* @param bool $is_controluser whether this is a control user connection
* @param array $server host/port/socket/persistent
* @param bool $auxiliary_connection (when true, don't go back to login if
* connection fails)
*
* @return mixed false on error or a mysqli object on success
*/
public function connect($user, $password, $is_controluser = false,
$server = null, $auxiliary_connection = false
) {
global $cfg;
$server_port = $GLOBALS['dbi']->getServerPort($server);
$server_socket = $GLOBALS['dbi']->getServerSocket($server);
if ($server) {
$server['host'] = (empty($server['host']))
? 'localhost'
: $server['host'];
}
$drizzle = new PMA_Drizzle();
$client_flags = 0;
/* Optionally compress connection */
if ($GLOBALS['cfg']['Server']['compress']) {
$client_flags |= DRIZZLE_CAPABILITIES_COMPRESS;
}
/* Optionally enable SSL */
if ($GLOBALS['cfg']['Server']['ssl']) {
$client_flags |= DRIZZLE_CAPABILITIES_SSL;
}
if ($server) {
return @$this->_realConnect(
$drizzle, $server['host'], $server_port, $server_socket,
$user, $password
);
}
$link = @$this->_realConnect(
$drizzle, $cfg['Server']['host'], $server_port, $server_socket, $user,
$password, false, $client_flags
);
// Retry with empty password if we're allowed to
if ($link == false && isset($cfg['Server']['nopassword'])
&& $cfg['Server']['nopassword'] && ! $is_controluser
) {
$link = @$this->_realConnect(
$drizzle, $cfg['Server']['host'], $server_port, $server_socket,
$user, null, false, $client_flags
);
}
return $link;
}
/**
* selects given database
*
* @param string $dbname database name to select
* @param PMA_DrizzleCon $link connection object
*
* @return bool
*/
public function selectDb($dbname, $link)
{
return $link->selectDb($dbname);
}
/**
* runs a query and returns the result
*
* @param string $query query to execute
* @param PMA_DrizzleCon $link connection object
* @param int $options query options
*
* @return PMA_DrizzleResult
*/
public function realQuery($query, $link, $options)
{
$buffer_mode = $options & PMA_DatabaseInterface::QUERY_UNBUFFERED
? PMA_Drizzle::BUFFER_ROW
: PMA_Drizzle::BUFFER_RESULT;
$res = $link->query($query, $buffer_mode);
return $res;
}
/**
* Run the multi query and output the results
*
* @param resource $link connection object
* @param string $query multi query statement to execute
*
* @return array|bool
*/
public function realMultiQuery($link, $query)
{
return false;
}
/**
* returns array of rows with associative and numeric keys from $result
*
* @param PMA_DrizzleResult $result Drizzle result object
*
* @return array
*/
public function fetchArray($result)
{
return $result->fetchRow(PMA_Drizzle::FETCH_BOTH);
}
/**
* returns array of rows with associative keys from $result
*
* @param PMA_DrizzleResult $result Drizzle result object
*
* @return array
*/
public function fetchAssoc($result)
{
return $result->fetchRow(PMA_Drizzle::FETCH_ASSOC);
}
/**
* returns array of rows with numeric keys from $result
*
* @param PMA_DrizzleResult $result Drizzle result object
*
* @return array
*/
public function fetchRow($result)
{
return $result->fetchRow(PMA_Drizzle::FETCH_NUM);
}
/**
* Adjusts the result pointer to an arbitrary row in the result
*
* @param PMA_DrizzleResult $result Drizzle result object
* @param int $offset offset to seek
*
* @return boolean true on success, false on failure
*/
public function dataSeek($result, $offset)
{
return $result->seek($offset);
}
/**
* Frees memory associated with the result
*
* @param PMA_DrizzleResult $result database result
*
* @return void
*/
public function freeResult($result)
{
if ($result instanceof PMA_DrizzleResult) {
$result->free();
}
}
/**
* Check if there are any more query results from a multi query
*
* @param resource $link the connection object
*
* @return bool false
*/
public function moreResults($link)
{
// N.B.: PHP's 'mysql' extension does not support
// multi_queries so this function will always
// return false. Use the 'mysqli' extension, if
// you need support for multi_queries.
return false;
}
/**
* Prepare next result from multi_query
*
* @param resource $link the connection object
*
* @return bool false
*/
public function nextResult($link)
{
// N.B.: PHP's 'mysql' extension does not support
// multi_queries so this function will always
// return false. Use the 'mysqli' extension, if
// you need support for multi_queries.
return false;
}
/**
* Returns a string representing the type of connection used
*
* @param PMA_DrizzleCon $link connection object
*
* @return string type of connection used
*/
public function getHostInfo($link)
{
$str = $link->port()
? $link->host() . ':' . $link->port() . ' via TCP/IP'
: 'Localhost via UNIX socket';
return $str;
}
/**
* Returns the version of the Drizzle protocol used
*
* @param PMA_DrizzleCon $link connection object
*
* @return int version of the Drizzle protocol used
*/
public function getProtoInfo($link)
{
return $link->protocolVersion();
}
/**
* returns a string that represents the client library version
*
* @return string Drizzle client library version
*/
public function getClientInfo()
{
return 'libdrizzle (Drizzle ' . drizzle_version() . ')';
}
/**
* returns last error message or false if no errors occurred
*
* @param PMA_DrizzleCon $link connection object
*
* @return string|bool $error or false
*/
public function getError($link)
{
$GLOBALS['errno'] = 0;
if (null !== $link && false !== $link) {
$error_number = drizzle_con_errno($link->getConnectionObject());
$error_message = drizzle_con_error($link->getConnectionObject());
} else {
$error_number = drizzle_errno();
$error_message = drizzle_error();
}
if (0 == $error_number) {
return false;
}
// keep the error number for further check after
// the call to getError()
$GLOBALS['errno'] = $error_number;
return $GLOBALS['dbi']->formatError($error_number, $error_message);
}
/**
* returns the number of rows returned by last query
*
* @param PMA_DrizzleResult $result Drizzle result object
*
* @return string|int
*/
public function numRows($result)
{
// see the note for $GLOBALS['dbi']->tryQuery();
if (!is_bool($result)) {
return @$result->numRows();
} else {
return 0;
}
}
/**
* returns the number of rows affected by last query
*
* @param PMA_DrizzleResult $link connection object
*
* @return int
*/
public function affectedRows($link)
{
$affectedRows = $link->affectedRows();
return $affectedRows !== false ? $affectedRows : 0;
}
/**
* returns metainfo for fields in $result
*
* @param PMA_DrizzleResult $result Drizzle result object
*
* @return array meta info for fields in $result
*/
public function getFieldsMeta($result)
{
// Build an associative array for a type look up
$typeAr = array();
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_BLOB] = 'blob';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_DATE] = 'date';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_DATETIME] = 'datetime';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_DOUBLE] = 'real';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_ENUM] = 'unknown';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_LONG] = 'int';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_LONGLONG] = 'int';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_MAX] = 'unknown';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_NULL] = 'null';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_TIMESTAMP] = 'timestamp';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_TINY] = 'int';
$typeAr[DRIZZLE_COLUMN_TYPE_DRIZZLE_VARCHAR] = 'string';
// array of DrizzleColumn
$columns = $result->getColumns();
// columns in a standardized format
$std_columns = array();
foreach ($columns as $k => $column) {
$c = new stdClass();
$c->name = $column->name();
$c->orgname = $column->origName();
$c->table = $column->table();
$c->orgtable = $column->origTable();
$c->def = $column->defaultValue();
$c->db = $column->db();
$c->catalog = $column->catalog();
// $column->maxSize() returns always 0 while size() seems
// to return a correct value (drizzle extension v.0.5, API v.7)
$c->max_length = $column->size();
$c->decimals = $column->decimals();
$c->charsetnr = $column->charset();
$c->type = $typeAr[$column->typeDrizzle()];
$c->_type = $column->type();
$c->flags = $this->fieldFlags($result, $k);
$c->_flags = $column->flags();
$c->multiple_key = (int) (bool) (
$c->_flags & DRIZZLE_COLUMN_FLAGS_MULTIPLE_KEY
);
$c->primary_key = (int) (bool) (
$c->_flags & DRIZZLE_COLUMN_FLAGS_PRI_KEY
);
$c->unique_key = (int) (bool) (
$c->_flags & DRIZZLE_COLUMN_FLAGS_UNIQUE_KEY
);
$c->not_null = (int) (bool) (
$c->_flags & DRIZZLE_COLUMN_FLAGS_NOT_NULL
);
$c->unsigned = (int) (bool) (
$c->_flags & DRIZZLE_COLUMN_FLAGS_UNSIGNED
);
$c->zerofill = (int) (bool) (
$c->_flags & DRIZZLE_COLUMN_FLAGS_ZEROFILL
);
$c->numeric = (int) (bool) (
$c->_flags & DRIZZLE_COLUMN_FLAGS_NUM
);
$c->blob = (int) (bool) (
$c->_flags & DRIZZLE_COLUMN_FLAGS_BLOB
);
$std_columns[] = $c;
}
return $std_columns;
}
/**
* return number of fields in given $result
*
* @param PMA_DrizzleResult $result Drizzle result object
*
* @return int field count
*/
public function numFields($result)
{
return $result->numColumns();
}
/**
* returns the length of the given field $i in $result
*
* @param PMA_DrizzleResult $result Drizzle result object
* @param int $i field
*
* @return int length of field
*/
public function fieldLen($result, $i)
{
$colums = $result->getColumns();
return $colums[$i]->size();
}
/**
* returns name of $i. field in $result
*
* @param PMA_DrizzleResult $result Drizzle result object
* @param int $i field
*
* @return string name of $i. field in $result
*/
public function fieldName($result, $i)
{
$colums = $result->getColumns();
return $colums[$i]->name();
}
/**
* returns concatenated string of human readable field flags
*
* @param PMA_DrizzleResult $result Drizzle result object
* @param int $i field
*
* @return string field flags
*/
public function fieldFlags($result, $i)
{
$columns = $result->getColumns();
$f = $columns[$i];
$type = $f->typeDrizzle();
$charsetnr = $f->charset();
$f = $f->flags();
$flags = array();
foreach ($GLOBALS['pma_drizzle_flag_names'] as $flag => $name) {
if ($f & $flag) {
$flags[] = $name;
}
}
// See http://dev.mysql.com/doc/refman/6.0/en/c-api-datatypes.html:
// to determine if a string is binary, we should not use MYSQLI_BINARY_FLAG
// but instead the charsetnr member of the MYSQL_FIELD
// structure. Watch out: some types like DATE returns 63 in charsetnr
// so we have to check also the type.
// Unfortunately there is no equivalent in the mysql extension.
if (($type == DRIZZLE_COLUMN_TYPE_DRIZZLE_BLOB
|| $type == DRIZZLE_COLUMN_TYPE_DRIZZLE_VARCHAR)
&& 63 == $charsetnr
) {
$flags[] = 'binary';
}
return implode(' ', $flags);
}
/**
* Store the result returned from multi query
*
* @param PMA_DrizzleResult $link Drizzle result object
*
* @return false
*/
public function storeResult($link)
{
return false;
}
}

View File

@ -228,13 +228,6 @@ $GLOBALS['dummy_queries'] = array(
. ' WHERE `TABLE_SCHEMA`=\'pma_test\' AND `TABLE_TYPE`=\'BASE TABLE\'',
'result' => array(),
),
array(
'query' => 'SELECT upper(plugin_name) f FROM data_dictionary.plugins'
. ' WHERE plugin_name IN (\'MYSQL_PASSWORD\',\'ROT13\')'
. ' AND plugin_type = \'Function\' AND is_active',
'columns' => array('f'),
'result' => array(array('ROT13')),
),
array(
'query' => 'SELECT `column_name`, `mimetype`, `transformation`,'
. ' `transformation_options`, `input_transformation`,'
@ -425,14 +418,6 @@ $GLOBALS['dummy_queries'] = array(
array('utf8_general_ci')
)
),
array(
'query' => 'SELECT DEFAULT_COLLATION_NAME FROM data_dictionary.SCHEMAS'
. ' WHERE SCHEMA_NAME = \'pma_test\' LIMIT 1',
'columns' => array('DEFAULT_COLLATION_NAME'),
'result' => array(
array('utf8_general_ci_pma_drizzle')
)
),
array(
'query' => 'SELECT @@collation_database',
'columns' => array('@@collation_database'),
@ -666,9 +651,6 @@ $GLOBALS['dummy_db'] = '';
$GLOBALS['userlink'] = 1;
$GLOBALS['controllink'] = 2;
$GLOBALS['cfg']['DBG']['sql'] = false;
if (! defined('PMA_DRIZZLE')) {
define('PMA_DRIZZLE', 0);
}
if (! defined('PMA_MARIADB')) {
define('PMA_MARIADB', 0);
}

View File

@ -40,11 +40,6 @@ if (! defined('MYSQLI_TYPE_BIT')) {
define('MYSQLI_TYPE_BIT', 16);
}
// for Drizzle
if (! defined('MYSQLI_TYPE_VARCHAR')) {
define('MYSQLI_TYPE_VARCHAR', 15);
}
/**
* Names of field flags.
*/
@ -501,7 +496,6 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
$typeAr[MYSQLI_TYPE_BLOB] = 'blob';
$typeAr[MYSQLI_TYPE_VAR_STRING] = 'string';
$typeAr[MYSQLI_TYPE_STRING] = 'string';
$typeAr[MYSQLI_TYPE_VARCHAR] = 'string'; // for Drizzle
// MySQL returns MYSQLI_TYPE_STRING for CHAR
// and MYSQLI_TYPE_CHAR === MYSQLI_TYPE_TINY
// so this would override TINYINT and mark all TINYINT as string

View File

@ -1,432 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* Wrappers for Drizzle extension classes
*
* Drizzle extension exposes libdrizzle functions and requires user to have it in
* mind while using them.
* This wrapper is not complete and hides a lot of original functionality,
* but allows for easy usage of the drizzle PHP extension.
*
* @package PhpMyAdmin-DBI
* @subpackage Drizzle
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Workaround for crashing module
*
* @return void
*
* @todo drizzle module segfaults while freeing resources, often.
* This allows at least for some development
*/
function PMA_drizzleShutdownFlush()
{
flush();
}
register_shutdown_function('PMA_drizzleShutdownFlush');
/**
* Wrapper for Drizzle class
*
* @package PhpMyAdmin-DBI
* @subpackage Drizzle
*/
class PMA_Drizzle extends Drizzle
{
/**
* Fetch mode: result rows contain column names
*/
const FETCH_ASSOC = 1;
/**
* Fetch mode: result rows contain only numeric indices
*/
const FETCH_NUM = 2;
/**
* Fetch mode: result rows have both column names and numeric indices
*/
const FETCH_BOTH = 3;
/**
* Result buffering: entire result set is buffered upon execution
*/
const BUFFER_RESULT = 1;
/**
* Result buffering: buffering occurs only on row level
*/
const BUFFER_ROW = 2;
/**
* Creates a new database connection using TCP
*
* @param string $host Drizzle host
* @param integer $port Drizzle port
* @param string $user username
* @param string $password password
* @param string $db database name
* @param integer $options connection options
*
* @return PMA_DrizzleCon
*/
public function addTcp($host, $port, $user, $password, $db, $options)
{
$dcon = parent::addTcp($host, $port, $user, $password, $db, $options);
return $dcon instanceof DrizzleCon
? new PMA_DrizzleCon($dcon)
: $dcon;
}
/**
* Creates a new connection using unix domain socket
*
* @param string $uds socket
* @param string $user username
* @param string $password password
* @param string $db database name
* @param integer $options connection options
*
* @return PMA_DrizzleCon
*/
public function addUds($uds, $user, $password, $db, $options)
{
$dcon = parent::addUds($uds, $user, $password, $db, $options);
return $dcon instanceof DrizzleCon
? new PMA_DrizzleCon($dcon)
: $dcon;
}
}
/**
* Wrapper around DrizzleCon class
*
* Its main task is to wrap results with PMA_DrizzleResult class
*
* @package PhpMyAdmin-DBI
* @subpackage Drizzle
*
* @method string host() Get host
* @method int port() Get port
* @method int protocolVersion() Get protocol version
* @method resource selectDb(string $dbname) Select a DB
*/
class PMA_DrizzleCon
{
/**
* Instance of DrizzleCon class
* @var DrizzleCon
*/
private $_dcon;
/**
* Result of the most recent query
* @var PMA_DrizzleResult
*/
private $_lastResult;
/**
* Constructor
*
* @param DrizzleCon $dcon connection handle
*/
public function __construct(DrizzleCon $dcon)
{
$this->_dcon = $dcon;
}
/**
* Executes given query. Opens database connection if not already done.
*
* @param string $query query to execute
* @param int $bufferMode PMA_Drizzle::BUFFER_RESULT,PMA_Drizzle::BUFFER_ROW
* @param int $fetchMode PMA_Drizzle::FETCH_ASSOC, PMA_Drizzle::FETCH_NUM
* or PMA_Drizzle::FETCH_BOTH
*
* @return PMA_DrizzleResult
*/
public function query($query, $bufferMode = PMA_Drizzle::BUFFER_RESULT,
$fetchMode = PMA_Drizzle::FETCH_ASSOC
) {
$result = $this->_dcon->query($query);
if ($result instanceof DrizzleResult) {
$this->_lastResult = new PMA_DrizzleResult(
$result, $bufferMode, $fetchMode
);
return $this->_lastResult;
}
return $result;
}
/**
* Returns the number of rows affected by last query
*
* @return int|false
*/
public function affectedRows()
{
return $this->_lastResult
? $this->_lastResult->affectedRows()
: false;
}
/**
* Pass calls of undefined methods to DrizzleCon object
*
* @param string $method method name
* @param mixed $args method parameters
*
* @return mixed
*/
public function __call($method, $args)
{
return call_user_func_array(array($this->_dcon, $method), $args);
}
/**
* Returns original Drizzle connection object
*
* @return DrizzleCon
*/
public function getConnectionObject()
{
return $this->_dcon;
}
}
/**
* Wrapper around DrizzleResult.
*
* Allows for reading result rows as an associative array and hides complexity
* behind buffering.
*
* @package PhpMyAdmin-DBI
* @subpackage Drizzle
*/
class PMA_DrizzleResult
{
/**
* Instance of DrizzleResult class
* @var DrizzleResult
*/
private $_dresult;
/**
* Fetch mode
* @var int
*/
private $_fetchMode;
/**
* Buffering mode
* @var int
*/
private $_bufferMode;
/**
* Cached column data
* @var DrizzleColumn[]
*/
private $_columns = null;
/**
* Cached column names
* @var string[]
*/
private $_columnNames = null;
/**
* Constructor
*
* @param DrizzleResult $dresult result handler
* @param int $bufferMode buffering mode
* @param int $fetchMode fetching mode
*/
public function __construct(DrizzleResult $dresult, $bufferMode, $fetchMode)
{
$this->_dresult = $dresult;
$this->_bufferMode = $bufferMode;
$this->_fetchMode = $fetchMode;
if ($this->_bufferMode == PMA_Drizzle::BUFFER_RESULT) {
$this->_dresult->buffer();
}
}
/**
* Sets fetch mode
*
* @param int $fetchMode fetch mode
*
* @return void
*/
public function setFetchMode($fetchMode)
{
$this->_fetchMode = $fetchMode;
}
/**
* Reads information about columns contained in current result
* set into {@see $_columns} and {@see $_columnNames} arrays
*
* @return void
*/
private function _readColumns()
{
$this->_columns = array();
$this->_columnNames = array();
if ($this->_bufferMode == PMA_Drizzle::BUFFER_RESULT) {
while (($column = $this->_dresult->columnNext()) !== null) {
$this->_columns[] = $column;
$this->_columnNames[] = $column->name();
}
} else {
while (($column = $this->_dresult->columnRead()) !== null) {
$this->_columns[] = $column;
$this->_columnNames[] = $column->name();
}
}
}
/**
* Returns columns in current result
*
* @return DrizzleColumn[]
*/
public function getColumns()
{
if (! $this->_columns) {
$this->_readColumns();
}
return $this->_columns;
}
/**
* Returns number if columns in result
*
* @return int
*/
public function numColumns()
{
return $this->_dresult->columnCount();
}
/**
* Transforms result row to conform to current fetch mode
*
* @param mixed &$row row to process
* @param int $fetchMode fetch mode
*
* @return void
*/
private function _transformResultRow(&$row, $fetchMode)
{
if (! $row) {
return;
}
switch ($fetchMode) {
case PMA_Drizzle::FETCH_ASSOC:
$row = array_combine($this->_columnNames, $row);
break;
case PMA_Drizzle::FETCH_BOTH:
$length = count($row);
for ($i = 0; $i < $length; $i++) {
$row[$this->_columnNames[$i]] = $row[$i];
}
break;
default:
break;
}
}
/**
* Fetches next for from this result set
*
* @param int $fetchMode fetch mode to use, if not given the default one is used
*
* @return array|null
*/
public function fetchRow($fetchMode = null)
{
// read column names on first fetch, only buffered results
// allow for reading it later
if (! $this->_columns) {
$this->_readColumns();
}
if ($fetchMode === null) {
$fetchMode = $this->_fetchMode;
}
$row = null;
switch ($this->_bufferMode) {
case PMA_Drizzle::BUFFER_RESULT:
$row = $this->_dresult->rowNext();
break;
case PMA_Drizzle::BUFFER_ROW:
$row = $this->_dresult->rowBuffer();
break;
}
$this->_transformResultRow($row, $fetchMode);
return $row;
}
/**
* Adjusts the result pointer to an arbitrary row in buffered result
*
* @param integer $row_index where to seek
*
* @return bool
*/
public function seek($row_index)
{
if ($this->_bufferMode != PMA_Drizzle::BUFFER_RESULT) {
trigger_error(
__("Can't seek in an unbuffered result set"), E_USER_WARNING
);
return false;
}
// rowSeek always returns NULL (drizzle extension v.0.5, API v.7)
if ($row_index >= 0 && $row_index < $this->_dresult->rowCount()) {
$this->_dresult->rowSeek($row_index);
return true;
}
return false;
}
/**
* Returns the number of rows in buffered result set
*
* @return int|false
*/
public function numRows()
{
if ($this->_bufferMode != PMA_Drizzle::BUFFER_RESULT) {
trigger_error(
__("Can't count rows in an unbuffered result set"), E_USER_WARNING
);
return false;
}
return $this->_dresult->rowCount();
}
/**
* Returns the number of rows affected by query
*
* @return int|false
*/
public function affectedRows()
{
return $this->_dresult->affectedRows();
}
/**
* Frees resources taken by this result
*
* @return void
*/
public function free()
{
unset($this->_columns);
unset($this->_columnNames);
drizzle_result_free($this->_dresult);
unset($this->_dresult);
}
}

View File

@ -1002,14 +1002,9 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null,
$sql = array();
if ($create_db) {
if (PMA_DRIZZLE) {
$sql[] = "CREATE DATABASE IF NOT EXISTS " . PMA_Util::backquote($db_name)
. " COLLATE " . $collation . ";";
} else {
$sql[] = "CREATE DATABASE IF NOT EXISTS " . PMA_Util::backquote($db_name)
. " DEFAULT CHARACTER SET " . $charset . " COLLATE " . $collation
. ";";
}
$sql[] = "CREATE DATABASE IF NOT EXISTS " . PMA_Util::backquote($db_name)
. " DEFAULT CHARACTER SET " . $charset . " COLLATE " . $collation
. ";";
}
/**
@ -1099,8 +1094,7 @@ function PMA_buildSQL($db_name, &$tables, &$analyses = null,
$tempSQLStr .= ", ";
}
}
$tempSQLStr .= ")"
. (PMA_DRIZZLE ? "" : " DEFAULT CHARACTER SET " . $charset)
$tempSQLStr .= ") DEFAULT CHARACTER SET " . $charset
. " COLLATE " . $collation . ";";
/**

View File

@ -2949,6 +2949,5 @@ function PMA_userHasColumnPrivileges($table_column, $insert_mode)
{
$privileges = $table_column['Privileges'];
return ($insert_mode && strstr($privileges, 'insert') !== false)
|| (! $insert_mode && strstr($privileges, 'update') !== false)
|| is_null($privileges); // Drizzle
|| (! $insert_mode && strstr($privileges, 'update') !== false);
}

View File

@ -17,9 +17,7 @@ if (! PMA_Util::cacheExists('mysql_charsets')) {
global $mysql_charsets, $mysql_charsets_descriptions,
$mysql_charsets_available, $mysql_collations, $mysql_collations_available,
$mysql_default_collations, $mysql_collations_flat;
$sql = PMA_DRIZZLE
? 'SELECT * FROM data_dictionary.CHARACTER_SETS'
: 'SELECT * FROM information_schema.CHARACTER_SETS';
$sql = 'SELECT * FROM information_schema.CHARACTER_SETS';
$res = $GLOBALS['dbi']->query($sql);
$mysql_charsets = array();
@ -38,14 +36,10 @@ if (! PMA_Util::cacheExists('mysql_charsets')) {
$mysql_default_collations = $mysql_collations_flat
= $mysql_charsets_available = $mysql_collations_available = array();
$sql = PMA_DRIZZLE
? 'SELECT * FROM data_dictionary.COLLATIONS'
: 'SELECT * FROM information_schema.COLLATIONS';
$sql = 'SELECT * FROM information_schema.COLLATIONS';
$res = $GLOBALS['dbi']->query($sql);
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
$char_set_name = PMA_DRIZZLE
? $row['DESCRIPTION']
: $row['CHARACTER_SET_NAME'];
$char_set_name = $row['CHARACTER_SET_NAME'];
if (! is_array($mysql_collations[$char_set_name])) {
$mysql_collations[$char_set_name] = array($row['COLLATION_NAME']);
} else {

View File

@ -90,13 +90,9 @@ function PMA_generateCharsetDropdownBox($type = PMA_CSDROPDOWN_COLLATION,
*/
function PMA_generateCharsetQueryPart($collation)
{
if (!PMA_DRIZZLE) {
list($charset) = explode('_', $collation);
return ' CHARACTER SET ' . $charset
. ($charset == $collation ? '' : ' COLLATE ' . $collation);
} else {
return ' COLLATE ' . $collation;
}
list($charset) = explode('_', $collation);
return ' CHARACTER SET ' . $charset
. ($charset == $collation ? '' : ' COLLATE ' . $collation);
}
/**
@ -116,11 +112,7 @@ function PMA_getDbCollation($db)
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
// this is slow with thousands of databases
$sql = PMA_DRIZZLE
? 'SELECT DEFAULT_COLLATION_NAME FROM data_dictionary.SCHEMAS'
. ' WHERE SCHEMA_NAME = \'' . PMA_Util::sqlAddSlashes($db)
. '\' LIMIT 1'
: 'SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA'
$sql = 'SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA'
. ' WHERE SCHEMA_NAME = \'' . PMA_Util::sqlAddSlashes($db)
. '\' LIMIT 1';
return $GLOBALS['dbi']->fetchValue($sql);

View File

@ -1249,9 +1249,7 @@ class PMA_NavigationTree
. ' apath="' . $paths['aPath'] . '"'
. ' vpath="' . $paths['vPath'] . '"'
. ' pos="' . $this->_pos . '"';
if ($node->real_name == $selected
|| (PMA_DRIZZLE && strtolower($node->real_name) == strtolower($selected))
) {
if ($node->real_name == $selected) {
$retval .= ' selected="selected"';
}
$retval .= '>' . htmlspecialchars($node->real_name);

View File

@ -111,16 +111,12 @@ class Node_Database extends Node
$condition = '!=';
}
if (! $GLOBALS['cfg']['Server']['DisableIS'] || PMA_DRIZZLE) {
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$db = PMA_Util::sqlAddSlashes($db);
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
if (PMA_DRIZZLE) {
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE' ";
} else {
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE TABLE' ";
}
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE TABLE' ";
if (! empty($searchClause)) {
$query .= "AND " . $this->_getWhereClauseForSearch(
$searchClause, $singleItem, 'TABLE_NAME'
@ -421,16 +417,12 @@ class Node_Database extends Node
$maxItems = $GLOBALS['cfg']['MaxNavigationItems'];
$retval = array();
$db = $this->real_name;
if (! $GLOBALS['cfg']['Server']['DisableIS'] || PMA_DRIZZLE) {
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$escdDb = PMA_Util::sqlAddSlashes($db);
$query = "SELECT `TABLE_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$escdDb' ";
if (PMA_DRIZZLE) {
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE' ";
} else {
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE TABLE' ";
}
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE TABLE' ";
if (! empty($searchClause)) {
$query .= "AND `TABLE_NAME` LIKE '%";
$query .= PMA_Util::sqlAddSlashes(

View File

@ -80,29 +80,27 @@ function PMA_getHtmlForRenameDatabase($db)
. 'maxlength="64" size="30" class="textfield" required="required" '
. 'value="' . htmlspecialchars($db) . '"/>';
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_adjust_privileges" checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_adjust_privileges" title="' . __(
'You don\'t have sufficient privileges to perform this '
. 'operation; Please refer to the documentation for more details'
)
. '" disabled/>';
}
$html_output .= '<label for="checkbox_adjust_privileges">'
. __('Adjust privileges') . PMA_Util::showDocu('faq', 'faq6-39')
. '</label><br />';
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_adjust_privileges" checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_adjust_privileges" title="' . __(
'You don\'t have sufficient privileges to perform this '
. 'operation; Please refer to the documentation for more details'
)
. '" disabled/>';
}
$html_output .= '<label for="checkbox_adjust_privileges">'
. __('Adjust privileges') . PMA_Util::showDocu('faq', 'faq6-39')
. '</label><br />';
$html_output .= ''
. '</fieldset>'
. '<fieldset class="tblFooters">'
@ -228,27 +226,25 @@ function PMA_getHtmlForCopyDatabase($db)
. __('Add constraints') . '</label><br />';
$html_output .= '<br />';
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges" checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges" title="' . __(
'You don\'t have sufficient privileges to perform this '
. 'operation; Please refer to the documentation for more details'
)
. '" disabled/>';
}
$html_output .= '<label for="checkbox_privileges">'
. __('Adjust privileges') . PMA_Util::showDocu('faq', 'faq6-39')
. '</label><br />';
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges" checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges" title="' . __(
'You don\'t have sufficient privileges to perform this '
. 'operation; Please refer to the documentation for more details'
)
. '" disabled/>';
}
$html_output .= '<label for="checkbox_privileges">'
. __('Adjust privileges') . PMA_Util::showDocu('faq', 'faq6-39')
. '</label><br />';
$html_output .= '<input type="checkbox" name="switch_to_new" value="true"'
. 'id="checkbox_switch"'
@ -360,15 +356,13 @@ function PMA_runProcedureAndFunctionDefinitions($db)
function PMA_createDbBeforeCopy()
{
// lower_case_table_names=1 `DB` becomes `db`
if (! PMA_DRIZZLE) {
$lowerCaseTableNames = $GLOBALS['dbi']->fetchValue(
'SELECT @@lower_case_table_names'
$lowerCaseTableNames = $GLOBALS['dbi']->fetchValue(
'SELECT @@lower_case_table_names'
);
if ($lowerCaseTableNames === '1') {
$_REQUEST['newname'] = /*overload*/mb_strtolower(
$_REQUEST['newname']
);
if ($lowerCaseTableNames === '1') {
$_REQUEST['newname'] = /*overload*/mb_strtolower(
$_REQUEST['newname']
);
}
}
$local_query = 'CREATE DATABASE IF NOT EXISTS '
@ -389,10 +383,8 @@ function PMA_createDbBeforeCopy()
// Set the SQL mode to NO_AUTO_VALUE_ON_ZERO to prevent MySQL from creating
// export statements it cannot import
if (! PMA_DRIZZLE) {
$sql_set_mode = "SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO'";
$GLOBALS['dbi']->query($sql_set_mode);
}
$sql_set_mode = "SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO'";
$GLOBALS['dbi']->query($sql_set_mode);
// rebuild the database list because PMA_Table::moveCopy
// checks in this list if the target db exists
@ -586,43 +578,41 @@ function PMA_handleTheViews($views, $move, $db)
*/
function PMA_AdjustPrivileges_moveDB($oldDb, $newname)
{
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
// For Db specific privileges
$query_db_specific = 'UPDATE ' . PMA_Util::backquote('db')
. 'SET Db = "' . $newname
. '" where Db = "' . $oldDb . '";';
$GLOBALS['dbi']->query($query_db_specific);
// For Db specific privileges
$query_db_specific = 'UPDATE ' . PMA_Util::backquote('db')
. 'SET Db = "' . $newname
. '" where Db = "' . $oldDb . '";';
$GLOBALS['dbi']->query($query_db_specific);
// For table specific privileges
$query_table_specific = 'UPDATE ' . PMA_Util::backquote('tables_priv')
. 'SET Db = "' . $newname
. '" where Db = "' . $oldDb . '";';
$GLOBALS['dbi']->query($query_table_specific);
// For table specific privileges
$query_table_specific = 'UPDATE ' . PMA_Util::backquote('tables_priv')
. 'SET Db = "' . $newname
. '" where Db = "' . $oldDb . '";';
$GLOBALS['dbi']->query($query_table_specific);
// For column specific privileges
$query_col_specific = 'UPDATE ' . PMA_Util::backquote('columns_priv')
. 'SET Db = "' . $newname
. '" where Db = "' . $oldDb . '";';
$GLOBALS['dbi']->query($query_col_specific);
// For column specific privileges
$query_col_specific = 'UPDATE ' . PMA_Util::backquote('columns_priv')
. 'SET Db = "' . $newname
. '" where Db = "' . $oldDb . '";';
$GLOBALS['dbi']->query($query_col_specific);
// For procedures specific privileges
$query_proc_specific = 'UPDATE ' . PMA_Util::backquote('procs_priv')
. 'SET Db = "' . $newname
. '" where Db = "' . $oldDb . '";';
$GLOBALS['dbi']->query($query_proc_specific);
// For procedures specific privileges
$query_proc_specific = 'UPDATE ' . PMA_Util::backquote('procs_priv')
. 'SET Db = "' . $newname
. '" where Db = "' . $oldDb . '";';
$GLOBALS['dbi']->query($query_proc_specific);
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$GLOBALS['dbi']->query($flush_query);
}
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$GLOBALS['dbi']->query($flush_query);
}
}
@ -636,102 +626,100 @@ function PMA_AdjustPrivileges_moveDB($oldDb, $newname)
*/
function PMA_AdjustPrivileges_copyDB($oldDb, $newname)
{
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
if (isset($GLOBALS['db_priv']) && $GLOBALS['db_priv']
&& isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
$query_db_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('db') . ' WHERE '
. 'Db = "' . $oldDb . '";';
$query_db_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('db') . ' WHERE '
. 'Db = "' . $oldDb . '";';
$old_privs_db = $GLOBALS['dbi']->fetchResult($query_db_specific_old, 0);
$old_privs_db = $GLOBALS['dbi']->fetchResult($query_db_specific_old, 0);
foreach ($old_privs_db as $old_priv) {
$newDb_db_privs_query = 'INSERT INTO ' . PMA_Util::backquote('db')
. ' VALUES("' . $old_priv[0] . '", "' . $newname . '", "'
. $old_priv[2] . '", "' . $old_priv[3] . '", "' . $old_priv[4]
. '", "' . $old_priv[5] . '", "' . $old_priv[6] . '", "'
. $old_priv[7] . '", "' . $old_priv[8] . '", "' . $old_priv[9]
. '", "' . $old_priv[10] . '", "' . $old_priv[11] . '", "'
. $old_priv[12] . '", "' . $old_priv[13] . '", "' . $old_priv[14]
. '", "' . $old_priv[15] . '", "' . $old_priv[16] . '", "'
. $old_priv[17] . '", "' . $old_priv[18] . '", "' . $old_priv[19]
. '", "' . $old_priv[20] . '", "' . $old_priv[21] . '");';
$GLOBALS['dbi']->query($newDb_db_privs_query);
}
// For Table Specific privileges
$query_table_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('tables_priv') . ' WHERE '
. 'Db = "' . $oldDb . '";';
$old_privs_table = $GLOBALS['dbi']->fetchResult(
$query_table_specific_old,
0
);
foreach ($old_privs_table as $old_priv) {
$newDb_table_privs_query = 'INSERT INTO ' . PMA_Util::backquote(
'tables_priv'
) . ' VALUES("' . $old_priv[0] . '", "' . $newname . '", "'
foreach ($old_privs_db as $old_priv) {
$newDb_db_privs_query = 'INSERT INTO ' . PMA_Util::backquote('db')
. ' VALUES("' . $old_priv[0] . '", "' . $newname . '", "'
. $old_priv[2] . '", "' . $old_priv[3] . '", "' . $old_priv[4]
. '", "' . $old_priv[5] . '", "' . $old_priv[6] . '", "'
. $old_priv[7] . '");';
. $old_priv[7] . '", "' . $old_priv[8] . '", "' . $old_priv[9]
. '", "' . $old_priv[10] . '", "' . $old_priv[11] . '", "'
. $old_priv[12] . '", "' . $old_priv[13] . '", "' . $old_priv[14]
. '", "' . $old_priv[15] . '", "' . $old_priv[16] . '", "'
. $old_priv[17] . '", "' . $old_priv[18] . '", "' . $old_priv[19]
. '", "' . $old_priv[20] . '", "' . $old_priv[21] . '");';
$GLOBALS['dbi']->query($newDb_table_privs_query);
}
// For Column Specific privileges
$query_col_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('columns_priv') . ' WHERE '
. 'Db = "' . $oldDb . '";';
$old_privs_col = $GLOBALS['dbi']->fetchResult(
$query_col_specific_old,
0
);
foreach ($old_privs_col as $old_priv) {
$newDb_col_privs_query = 'INSERT INTO ' . PMA_Util::backquote(
'columns_priv'
) . ' VALUES("' . $old_priv[0] . '", "' . $newname . '", "'
. $old_priv[2] . '", "' . $old_priv[3] . '", "' . $old_priv[4]
. '", "' . $old_priv[5] . '", "' . $old_priv[6] . '");';
$GLOBALS['dbi']->query($newDb_col_privs_query);
}
// For Procedure Specific privileges
$query_proc_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('procs_priv') . ' WHERE '
. 'Db = "' . $oldDb . '";';
$old_privs_proc = $GLOBALS['dbi']->fetchResult(
$query_proc_specific_old,
0
);
foreach ($old_privs_proc as $old_priv) {
$newDb_proc_privs_query = 'INSERT INTO ' . PMA_Util::backquote(
'procs_priv'
) . ' VALUES("' . $old_priv[0] . '", "' . $newname . '", "'
. $old_priv[2] . '", "' . $old_priv[3] . '", "' . $old_priv[4]
. '", "' . $old_priv[5] . '", "' . $old_priv[6] . '", "'
. $old_priv[7] . '");';
$GLOBALS['dbi']->query($newDb_proc_privs_query);
}
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$GLOBALS['dbi']->query($flush_query);
$GLOBALS['dbi']->query($newDb_db_privs_query);
}
// For Table Specific privileges
$query_table_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('tables_priv') . ' WHERE '
. 'Db = "' . $oldDb . '";';
$old_privs_table = $GLOBALS['dbi']->fetchResult(
$query_table_specific_old,
0
);
foreach ($old_privs_table as $old_priv) {
$newDb_table_privs_query = 'INSERT INTO ' . PMA_Util::backquote(
'tables_priv'
) . ' VALUES("' . $old_priv[0] . '", "' . $newname . '", "'
. $old_priv[2] . '", "' . $old_priv[3] . '", "' . $old_priv[4]
. '", "' . $old_priv[5] . '", "' . $old_priv[6] . '", "'
. $old_priv[7] . '");';
$GLOBALS['dbi']->query($newDb_table_privs_query);
}
// For Column Specific privileges
$query_col_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('columns_priv') . ' WHERE '
. 'Db = "' . $oldDb . '";';
$old_privs_col = $GLOBALS['dbi']->fetchResult(
$query_col_specific_old,
0
);
foreach ($old_privs_col as $old_priv) {
$newDb_col_privs_query = 'INSERT INTO ' . PMA_Util::backquote(
'columns_priv'
) . ' VALUES("' . $old_priv[0] . '", "' . $newname . '", "'
. $old_priv[2] . '", "' . $old_priv[3] . '", "' . $old_priv[4]
. '", "' . $old_priv[5] . '", "' . $old_priv[6] . '");';
$GLOBALS['dbi']->query($newDb_col_privs_query);
}
// For Procedure Specific privileges
$query_proc_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('procs_priv') . ' WHERE '
. 'Db = "' . $oldDb . '";';
$old_privs_proc = $GLOBALS['dbi']->fetchResult(
$query_proc_specific_old,
0
);
foreach ($old_privs_proc as $old_priv) {
$newDb_proc_privs_query = 'INSERT INTO ' . PMA_Util::backquote(
'procs_priv'
) . ' VALUES("' . $old_priv[0] . '", "' . $newname . '", "'
. $old_priv[2] . '", "' . $old_priv[3] . '", "' . $old_priv[4]
. '", "' . $old_priv[5] . '", "' . $old_priv[6] . '", "'
. $old_priv[7] . '");';
$GLOBALS['dbi']->query($newDb_proc_privs_query);
}
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$GLOBALS['dbi']->query($flush_query);
}
}
@ -859,26 +847,24 @@ function PMA_getHtmlForMoveTable()
. __('Add AUTO_INCREMENT value')
. '</label><br />';
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges_tables_move" '
. 'checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges_tables_move" title="' . __(
'You don\'t have sufficient privileges to perform this '
. 'operation; Please refer to the documentation for more details'
)
. '" disabled/>';
}
$html_output .= '<label for="checkbox_privileges_tables_move">'
. __('Adjust privileges') . PMA_Util::showDocu('faq', 'faq6-39')
. '</label><br />';
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges_tables_move" '
. 'checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges_tables_move" title="' . __(
'You don\'t have sufficient privileges to perform this '
. 'operation; Please refer to the documentation for more details'
)
. '" disabled/>';
}
$html_output .= '<label for="checkbox_privileges_tables_move">'
. __('Adjust privileges') . PMA_Util::showDocu('faq', 'faq6-39')
. '</label><br />';
$html_output .= '</fieldset><fieldset class="tblFooters">'
. '<input type="submit" name="submit_move" value="' . __('Go') . '" />'
@ -953,26 +939,24 @@ function PMA_getHtmlForRenameTable()
. '</td></tr>'
. '<tr><td></td><td>';
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges_table_options" '
. 'checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges_table_options" title="' . __(
'You don\'t have sufficient privileges to perform this '
. 'operation; Please refer to the documentation for more details'
)
. '" disabled/>';
}
$html_output .= '<label for="checkbox_privileges_table_options">'
. __('Adjust privileges') . '&nbsp;'
. PMA_Util::showDocu('faq', 'faq6-39') . '</label>';
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges_table_options" '
. 'checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_privileges_table_options" title="' . __(
'You don\'t have sufficient privileges to perform this '
. 'operation; Please refer to the documentation for more details'
)
. '" disabled/>';
}
$html_output .= '<label for="checkbox_privileges_table_options">'
. __('Adjust privileges') . '&nbsp;'
. PMA_Util::showDocu('faq', 'faq6-39') . '</label>';
$html_output .= '</td></tr>';
return $html_output;
@ -1308,25 +1292,23 @@ function PMA_getHtmlForCopytable()
$html_output .= '<br />';
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_adjust_privileges" checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_adjust_privileges" title="' . __(
'You don\'t have sufficient privileges to perform this '
. 'operation; Please refer to the documentation for more details'
)
. '" disabled/>';
}
$html_output .= '<label for="checkbox_adjust_privileges">'
. __('Adjust privileges') . PMA_Util::showDocu('faq', 'faq6-39')
. '</label><br />';
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_adjust_privileges" checked="checked" />';
} else {
$html_output .= '<input type="checkbox" name="adjust_privileges" '
. 'value="1" id="checkbox_adjust_privileges" title="' . __(
'You don\'t have sufficient privileges to perform this '
. 'operation; Please refer to the documentation for more details'
)
. '" disabled/>';
}
$html_output .= '<label for="checkbox_adjust_privileges">'
. __('Adjust privileges') . PMA_Util::showDocu('faq', 'faq6-39')
. '</label><br />';
if (isset($_COOKIE['pma_switch_to_new'])
&& $_COOKIE['pma_switch_to_new'] == 'true'
@ -1428,19 +1410,17 @@ function PMA_getListofMaintainActionLink($is_myisam_or_aria,
}
// checksum table
if (! PMA_DRIZZLE) {
$params = array(
'sql_query' => 'CHECKSUM TABLE '
. PMA_Util::backquote($GLOBALS['table']),
'table_maintenance' => 'Go',
);
$html_output .= PMA_getMaintainActionlink(
__('Checksum table'),
$params,
$url_params,
'CHECKSUM_TABLE'
);
}
$params = array(
'sql_query' => 'CHECKSUM TABLE '
. PMA_Util::backquote($GLOBALS['table']),
'table_maintenance' => 'Go',
);
$html_output .= PMA_getMaintainActionlink(
__('Checksum table'),
$params,
$url_params,
'CHECKSUM_TABLE'
);
// defragment table
if ($is_innodb) {
@ -1475,9 +1455,7 @@ function PMA_getListofMaintainActionLink($is_myisam_or_aria,
);
// optimize table
if (($is_myisam_or_aria || $is_innodb || $is_berkeleydb)
&& !PMA_DRIZZLE
) {
if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
$params = array(
'sql_query' => 'OPTIMIZE TABLE '
. PMA_Util::backquote($GLOBALS['table']),
@ -1492,7 +1470,7 @@ function PMA_getListofMaintainActionLink($is_myisam_or_aria,
}
// repair table
if ($is_myisam_or_aria && !PMA_DRIZZLE) {
if ($is_myisam_or_aria) {
$params = array(
'sql_query' => 'REPAIR TABLE '
. PMA_Util::backquote($GLOBALS['table']),
@ -1959,31 +1937,29 @@ function PMA_getQueryAndResultForPartition()
*/
function PMA_AdjustPrivileges_renameOrMoveTable($oldDb, $oldTable, $newDb, $newTable)
{
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
// For table specific privileges
$query_table_specific = 'UPDATE ' . PMA_Util::backquote('tables_priv')
. 'SET Db = "' . $newDb . '", Table_name = "' . $newTable
. '" where Db = "' . $oldDb . '" AND Table_name = "' . $oldTable
. '";';
$GLOBALS['dbi']->query($query_table_specific);
// For table specific privileges
$query_table_specific = 'UPDATE ' . PMA_Util::backquote('tables_priv')
. 'SET Db = "' . $newDb . '", Table_name = "' . $newTable
. '" where Db = "' . $oldDb . '" AND Table_name = "' . $oldTable
. '";';
$GLOBALS['dbi']->query($query_table_specific);
// For column specific privileges
$query_col_specific = 'UPDATE ' . PMA_Util::backquote('columns_priv')
. 'SET Db = "' . $newDb . '", Table_name = "' . $newTable
. '" where Db = "' . $oldDb . '" AND Table_name = "' . $oldTable
. '";';
$GLOBALS['dbi']->query($query_col_specific);
// For column specific privileges
$query_col_specific = 'UPDATE ' . PMA_Util::backquote('columns_priv')
. 'SET Db = "' . $newDb . '", Table_name = "' . $newTable
. '" where Db = "' . $oldDb . '" AND Table_name = "' . $oldTable
. '";';
$GLOBALS['dbi']->query($query_col_specific);
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$GLOBALS['dbi']->query($flush_query);
}
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$GLOBALS['dbi']->query($flush_query);
}
}
@ -1999,57 +1975,55 @@ function PMA_AdjustPrivileges_renameOrMoveTable($oldDb, $oldTable, $newDb, $newT
*/
function PMA_AdjustPrivileges_copyTable($oldDb, $oldTable, $newDb, $newTable)
{
if (! PMA_DRIZZLE) {
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
if (isset($GLOBALS['table_priv']) && $GLOBALS['table_priv']
&& isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$GLOBALS['dbi']->selectDb('mysql');
// For Table Specific privileges
$query_table_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('tables_priv') . ' where '
. 'Db = "' . $oldDb . '" AND Table_name = "' . $oldTable . '";';
// For Table Specific privileges
$query_table_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('tables_priv') . ' where '
. 'Db = "' . $oldDb . '" AND Table_name = "' . $oldTable . '";';
$old_privs_table = $GLOBALS['dbi']->fetchResult(
$query_table_specific_old,
0
);
$old_privs_table = $GLOBALS['dbi']->fetchResult(
$query_table_specific_old,
0
);
foreach ($old_privs_table as $old_priv) {
$newDb_table_privs_query = 'INSERT INTO '
. PMA_Util::backquote('tables_priv') . ' VALUES("'
. $old_priv[0] . '", "' . $newDb . '", "' . $old_priv[2] . '", "'
. $newTable . '", "' . $old_priv[4] . '", "' . $old_priv[5]
. '", "' . $old_priv[6] . '", "' . $old_priv[7] . '");';
foreach ($old_privs_table as $old_priv) {
$newDb_table_privs_query = 'INSERT INTO '
. PMA_Util::backquote('tables_priv') . ' VALUES("'
. $old_priv[0] . '", "' . $newDb . '", "' . $old_priv[2] . '", "'
. $newTable . '", "' . $old_priv[4] . '", "' . $old_priv[5]
. '", "' . $old_priv[6] . '", "' . $old_priv[7] . '");';
$GLOBALS['dbi']->query($newDb_table_privs_query);
}
// For Column Specific privileges
$query_col_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('columns_priv') . ' WHERE '
. 'Db = "' . $oldDb . '" AND Table_name = "' . $oldTable . '";';
$old_privs_col = $GLOBALS['dbi']->fetchResult(
$query_col_specific_old,
0
);
foreach ($old_privs_col as $old_priv) {
$newDb_col_privs_query = 'INSERT INTO '
. PMA_Util::backquote('columns_priv') . ' VALUES("'
. $old_priv[0] . '", "' . $newDb . '", "' . $old_priv[2] . '", "'
. $newTable . '", "' . $old_priv[4] . '", "' . $old_priv[5]
. '", "' . $old_priv[6] . '");';
$GLOBALS['dbi']->query($newDb_col_privs_query);
}
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$GLOBALS['dbi']->query($flush_query);
$GLOBALS['dbi']->query($newDb_table_privs_query);
}
// For Column Specific privileges
$query_col_specific_old = 'SELECT * FROM '
. PMA_Util::backquote('columns_priv') . ' WHERE '
. 'Db = "' . $oldDb . '" AND Table_name = "' . $oldTable . '";';
$old_privs_col = $GLOBALS['dbi']->fetchResult(
$query_col_specific_old,
0
);
foreach ($old_privs_col as $old_priv) {
$newDb_col_privs_query = 'INSERT INTO '
. PMA_Util::backquote('columns_priv') . ' VALUES("'
. $old_priv[0] . '", "' . $newDb . '", "' . $old_priv[2] . '", "'
. $newTable . '", "' . $old_priv[4] . '", "' . $old_priv[5]
. '", "' . $old_priv[6] . '");';
$GLOBALS['dbi']->query($newDb_col_privs_query);
}
// Finally FLUSH the new privileges
$flush_query = "FLUSH PRIVILEGES;";
$GLOBALS['dbi']->query($flush_query);
}
}

View File

@ -247,12 +247,8 @@ class ExportSql extends ExportPlugin
$drop_clause = '<code>DROP TABLE</code>';
}
} else {
if (PMA_DRIZZLE) {
$drop_clause = '<code>DROP TABLE</code>';
} else {
$drop_clause = '<code>DROP TABLE / VIEW / PROCEDURE'
. ' / FUNCTION / EVENT</code>';
}
$drop_clause = '<code>DROP TABLE / VIEW / PROCEDURE'
. ' / FUNCTION / EVENT</code>';
}
$drop_clause .= '<code> / TRIGGER</code>';
@ -299,18 +295,15 @@ class ExportSql extends ExportPlugin
);
$subgroup->addProperty($leaf);
// Drizzle doesn't support procedures and functions
if (! PMA_DRIZZLE) {
$leaf = new BoolPropertyItem();
$leaf->setName('procedure_function');
$leaf->setText(
sprintf(
__('Add %s statement'),
'<code>CREATE PROCEDURE / FUNCTION / EVENT</code>'
)
);
$subgroup->addProperty($leaf);
}
$leaf = new BoolPropertyItem();
$leaf->setName('procedure_function');
$leaf->setText(
sprintf(
__('Add %s statement'),
'<code>CREATE PROCEDURE / FUNCTION / EVENT</code>'
)
);
$subgroup->addProperty($leaf);
// Add triggers option
$leaf = new BoolPropertyItem();
@ -353,19 +346,18 @@ class ExportSql extends ExportPlugin
$leaf = new MessageOnlyPropertyItem();
$leaf->setText(__('Instead of <code>INSERT</code> statements, use:'));
$subgroup->setSubgroupHeader($leaf);
// Not supported in Drizzle
if (! PMA_DRIZZLE) {
$leaf = new BoolPropertyItem();
$leaf->setName("delayed");
$leaf->setText(__('<code>INSERT DELAYED</code> statements'));
$leaf->setDoc(
array(
'manual_MySQL_Database_Administration',
'insert_delayed'
)
);
$subgroup->addProperty($leaf);
}
$leaf = new BoolPropertyItem();
$leaf->setName("delayed");
$leaf->setText(__('<code>INSERT DELAYED</code> statements'));
$leaf->setDoc(
array(
'manual_MySQL_Database_Administration',
'insert_delayed'
)
);
$subgroup->addProperty($leaf);
$leaf = new BoolPropertyItem();
$leaf->setName("ignore");
$leaf->setText(__('<code>INSERT IGNORE</code> statements'));
@ -442,20 +434,17 @@ class ExportSql extends ExportPlugin
);
$dataOptions->addProperty($leaf);
// Drizzle works only with UTC timezone
if (! PMA_DRIZZLE) {
// Dump time in UTC
$leaf = new BoolPropertyItem();
$leaf->setName("utc_time");
$leaf->setText(
__(
'Dump TIMESTAMP columns in UTC <i>(enables TIMESTAMP columns'
. ' to be dumped and reloaded between servers in different'
. ' time zones)</i>'
)
);
$dataOptions->addProperty($leaf);
}
// Dump time in UTC
$leaf = new BoolPropertyItem();
$leaf->setName("utc_time");
$leaf->setText(
__(
'Dump TIMESTAMP columns in UTC <i>(enables TIMESTAMP columns'
. ' to be dumped and reloaded between servers in different'
. ' time zones)</i>'
)
);
$dataOptions->addProperty($leaf);
// add the main group to the root group
$exportSpecificOptions->addProperty($dataOptions);
@ -637,7 +626,6 @@ class ExportSql extends ExportPlugin
? $GLOBALS['charset'] : '';
if (! empty($GLOBALS['asfile'])
&& isset($mysql_charset_map[$charset])
&& ! PMA_DRIZZLE
) {
$foot .= $crlf
. '/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;'
@ -716,7 +704,6 @@ class ExportSql extends ExportPlugin
// do this only for recent MySQL exports
if ((! isset($GLOBALS['sql_compatibility'])
|| $GLOBALS['sql_compatibility'] == 'NONE')
&& ! PMA_DRIZZLE
) {
$head .= 'SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";' . $crlf;
}
@ -736,7 +723,7 @@ class ExportSql extends ExportPlugin
$head .= $this->_possibleCRLF();
if (! empty($GLOBALS['asfile']) && ! PMA_DRIZZLE) {
if (! empty($GLOBALS['asfile'])) {
// we are saving as file, therefore we provide charset information
// so that a utility like the mysql client can interpret
// the file correctly
@ -806,20 +793,16 @@ class ExportSql extends ExportPlugin
$db_alias, $compat, isset($GLOBALS['sql_backquotes'])
);
$collation = PMA_getDbCollation($db);
if (PMA_DRIZZLE) {
$create_query .= ' COLLATE ' . $collation;
if (/*overload*/mb_strpos($collation, '_')) {
$create_query .= ' DEFAULT CHARACTER SET '
. /*overload*/mb_substr(
$collation,
0,
/*overload*/mb_strpos($collation, '_')
)
. ' COLLATE ' . $collation;
} else {
if (/*overload*/mb_strpos($collation, '_')) {
$create_query .= ' DEFAULT CHARACTER SET '
. /*overload*/mb_substr(
$collation,
0,
/*overload*/mb_strpos($collation, '_')
)
. ' COLLATE ' . $collation;
} else {
$create_query .= ' DEFAULT CHARACTER SET ' . $collation;
}
$create_query .= ' DEFAULT CHARACTER SET ' . $collation;
}
$create_query .= ';' . $crlf;
if (! PMA_exportOutputHandler($create_query)) {
@ -841,9 +824,8 @@ class ExportSql extends ExportPlugin
{
global $crlf;
if ((isset($GLOBALS['sql_compatibility'])
&& $GLOBALS['sql_compatibility'] == 'NONE')
|| PMA_DRIZZLE
if (isset($GLOBALS['sql_compatibility'])
&& $GLOBALS['sql_compatibility'] == 'NONE'
) {
$result = PMA_exportOutputHandler(
'USE '
@ -1360,26 +1342,10 @@ class ExportSql extends ExportPlugin
if ($result != false) {
if ($GLOBALS['dbi']->numRows($result) > 0) {
$tmpres = $GLOBALS['dbi']->fetchAssoc($result);
if (PMA_DRIZZLE && $show_dates) {
// Drizzle doesn't give Create_time and Update_time in
// SHOW TABLE STATUS, add it
$sql ="SELECT
TABLE_CREATION_TIME AS Create_time,
TABLE_UPDATE_TIME AS Update_time
FROM data_dictionary.TABLES
WHERE TABLE_SCHEMA = '"
. PMA_Util::sqlAddSlashes($db) . "'
AND TABLE_NAME = '"
. PMA_Util::sqlAddSlashes($table) . "'";
$tmpres = array_merge(
$GLOBALS['dbi']->fetchSingleRow($sql), $tmpres
);
}
// Here we optionally add the AUTO_INCREMENT next value,
// but starting with MySQL 5.0.24, the clause is already included
// in SHOW CREATE TABLE so we'll remove it below
// It's required for Drizzle because SHOW CREATE TABLE uses
// the value from table's creation time
if (isset($GLOBALS['sql_auto_increment'])
&& ! empty($tmpres['Auto_increment'])
) {
@ -1442,13 +1408,10 @@ class ExportSql extends ExportPlugin
// Complete table dump,
// Whether to quote table and column names or not
// Drizzle always quotes names
if (! PMA_DRIZZLE) {
if ($sql_backquotes) {
$GLOBALS['dbi']->query('SET SQL_QUOTE_SHOW_CREATE = 1');
} else {
$GLOBALS['dbi']->query('SET SQL_QUOTE_SHOW_CREATE = 0');
}
if ($sql_backquotes) {
$GLOBALS['dbi']->query('SET SQL_QUOTE_SHOW_CREATE = 1');
} else {
$GLOBALS['dbi']->query('SET SQL_QUOTE_SHOW_CREATE = 0');
}
// I don't see the reason why this unbuffered query could cause problems,
@ -1537,16 +1500,6 @@ class ExportSql extends ExportPlugin
);
}
// Drizzle (checked on 2011.03.13) returns `ROW_FORMAT`'s value
// surrounded with quotes, which is not accepted by parser
if (PMA_DRIZZLE) {
$create_query = preg_replace(
'/ROW_FORMAT=\'(\S+)\'/',
'ROW_FORMAT=$1',
$create_query
);
}
// Views have no constraints, indexes, etc. They do not require any
// analysis.
if (!$view) {

View File

@ -100,35 +100,32 @@ class ExportXml extends ExportPlugin
$structure = new OptionsPropertyMainGroup();
$structure->setName("structure");
$structure->setText(__('Object creation options (all are recommended)'));
// create primary items and add them to the group
if (! PMA_DRIZZLE) {
$leaf = new BoolPropertyItem();
$leaf->setName("export_events");
$leaf->setText(__('Events'));
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem();
$leaf->setName("export_functions");
$leaf->setText(__('Functions'));
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem();
$leaf->setName("export_procedures");
$leaf->setText(__('Procedures'));
$structure->addProperty($leaf);
}
$leaf = new BoolPropertyItem();
$leaf->setName("export_events");
$leaf->setText(__('Events'));
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem();
$leaf->setName("export_functions");
$leaf->setText(__('Functions'));
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem();
$leaf->setName("export_procedures");
$leaf->setText(__('Procedures'));
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem();
$leaf->setName("export_tables");
$leaf->setText(__('Tables'));
$structure->addProperty($leaf);
if (! PMA_DRIZZLE) {
$leaf = new BoolPropertyItem();
$leaf->setName("export_triggers");
$leaf->setText(__('Triggers'));
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem();
$leaf->setName("export_views");
$leaf->setText(__('Views'));
$structure->addProperty($leaf);
}
$leaf = new BoolPropertyItem();
$leaf->setName("export_triggers");
$leaf->setText(__('Triggers'));
$structure->addProperty($leaf);
$leaf = new BoolPropertyItem();
$leaf->setName("export_views");
$leaf->setText(__('Views'));
$structure->addProperty($leaf);
$exportSpecificOptions->addProperty($structure);
// data main group
@ -197,22 +194,11 @@ class ExportXml extends ExportPlugin
. '>' . $crlf;
if ($export_struct) {
if (PMA_DRIZZLE) {
$result = $GLOBALS['dbi']->fetchResult(
"SELECT
'utf8' AS DEFAULT_CHARACTER_SET_NAME,
DEFAULT_COLLATION_NAME
FROM data_dictionary.SCHEMAS
WHERE SCHEMA_NAME = '"
. PMA_Util::sqlAddSlashes($db) . "'"
);
} else {
$result = $GLOBALS['dbi']->fetchResult(
'SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME`'
. ' FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`'
. ' = \'' . PMA_Util::sqlAddSlashes($db) . '\' LIMIT 1'
);
}
$result = $GLOBALS['dbi']->fetchResult(
'SELECT `DEFAULT_CHARACTER_SET_NAME`, `DEFAULT_COLLATION_NAME`'
. ' FROM `information_schema`.`SCHEMATA` WHERE `SCHEMA_NAME`'
. ' = \'' . PMA_Util::sqlAddSlashes($db) . '\' LIMIT 1'
);
$db_collation = $result[0]['DEFAULT_COLLATION_NAME'];
$db_charset = $result[0]['DEFAULT_CHARACTER_SET_NAME'];

View File

@ -10,12 +10,6 @@ if (! defined('PHPMYADMIN')) {
exit;
}
// Drizzle does not support GIS data types
if (PMA_DRIZZLE) {
$GLOBALS['skip_import'] = true;
return;
}
/* Get the import interface*/
require_once 'libraries/plugins/ImportPlugin.class.php';
/* Get the ShapeFile class */

View File

@ -749,21 +749,16 @@ function PMA_getForeigners($db, $table, $column = '', $source = 'both')
}
/**
* Emulating relations for some information_schema and data_dictionary tables
* Emulating relations for some information_schema tables
*/
$isInformationSchema = /*overload*/mb_strtolower($db) == 'information_schema';
$is_data_dictionary = PMA_DRIZZLE
&& /*overload*/mb_strtolower($db) == 'data_dictionary';
$isMysql = /*overload*/mb_strtolower($db) == 'mysql';
if (($isInformationSchema || $is_data_dictionary || $isMysql)
$isMysql = /*overload*/mb_strtolower($db) == 'mysql';
if (($isInformationSchema || $isMysql)
&& ($source == 'internal' || $source == 'both')
) {
if ($isInformationSchema) {
$relations_key = 'information_schema_relations';
include_once './libraries/information_schema_relations.lib.php';
} else if ($is_data_dictionary) {
$relations_key = 'data_dictionary_relations';
include_once './libraries/data_dictionary_relations.lib.php';
} else {
$relations_key = 'mysql_relations';
include_once './libraries/mysql_relations.lib.php';
@ -1766,15 +1761,9 @@ function PMA_searchColumnInForeigners($foreigners, $column)
function PMA_getDefaultPMATableNames()
{
$pma_tables = array();
if (PMA_DRIZZLE) {
$create_tables_file = file_get_contents(
SQL_DIR . 'create_tables_drizzle.sql'
);
} else {
$create_tables_file = file_get_contents(
SQL_DIR . 'create_tables.sql'
);
}
$create_tables_file = file_get_contents(
SQL_DIR . 'create_tables.sql'
);
$queries = explode(';', $create_tables_file);

View File

@ -312,10 +312,6 @@ function PMA_RTN_handleRequestCreateOrEdit($errors, $db)
*/
function PMA_RTN_backupPrivileges()
{
if (defined('PMA_DRIZZLE') && PMA_DRIZZLE) {
return array();
}
if (!(isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv'])
&& $GLOBALS['flush_priv'])
@ -390,28 +386,26 @@ function PMA_RTN_createRoutine(
// Default value
$resultAdjust = false;
if (!defined('PMA_DRIZZLE') || !PMA_DRIZZLE) {
if (isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv'])
&& $GLOBALS['flush_priv']
) {
// Insert all the previous privileges
// but with the new name and the new type
foreach ($privilegesBackup as $priv) {
$adjustProcPrivilege = 'INSERT INTO '
. PMA_Util::backquote('mysql') . '.'
. PMA_Util::backquote('procs_priv')
. ' VALUES("' . $priv[0] . '", "'
. $priv[1] . '", "' . $priv[2] . '", "'
. $_REQUEST['item_name'] . '", "'
. $_REQUEST['item_type'] . '", "'
. $priv[5] . '", "'
. $priv[6] . '", "'
. $priv[7] . '");';
$resultAdjust = $GLOBALS['dbi']->query(
$adjustProcPrivilege
);
}
if (isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv'])
&& $GLOBALS['flush_priv']
) {
// Insert all the previous privileges
// but with the new name and the new type
foreach ($privilegesBackup as $priv) {
$adjustProcPrivilege = 'INSERT INTO '
. PMA_Util::backquote('mysql') . '.'
. PMA_Util::backquote('procs_priv')
. ' VALUES("' . $priv[0] . '", "'
. $priv[1] . '", "' . $priv[2] . '", "'
. $_REQUEST['item_name'] . '", "'
. $_REQUEST['item_type'] . '", "'
. $priv[5] . '", "'
. $priv[6] . '", "'
. $priv[7] . '");';
$resultAdjust = $GLOBALS['dbi']->query(
$adjustProcPrivilege
);
}
}
@ -998,21 +992,19 @@ function PMA_RTN_getEditorForm($mode, $operation, $routine)
$retval .= " <td>" . __('Adjust privileges');
$retval .= PMA_Util::showDocu('faq', 'faq6-39');
$retval .= "</td>";
if (! defined('PMA_DRIZZLE') || ! PMA_DRIZZLE) {
if (isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$retval .= " <td><input type='checkbox' "
. "name='item_adjust_privileges' value='1' checked /></td>";
} else {
$retval .= " <td><input type='checkbox' "
. "name='item_adjust_privileges' value='1' title='" . __(
"You do not have sufficient privileges to perform this "
. "operation; Please refer to the documentation for more "
. "details"
)
. "' disabled/></td>";
}
if (isset($GLOBALS['proc_priv']) && $GLOBALS['proc_priv']
&& isset($GLOBALS['flush_priv']) && $GLOBALS['flush_priv']
) {
$retval .= " <td><input type='checkbox' "
. "name='item_adjust_privileges' value='1' checked /></td>";
} else {
$retval .= " <td><input type='checkbox' "
. "name='item_adjust_privileges' value='1' title='" . __(
"You do not have sufficient privileges to perform this "
. "operation; Please refer to the documentation for more "
. "details"
)
. "' disabled/></td>";
}
$retval .= "</tr>";
}

View File

@ -37,7 +37,7 @@ $GLOBALS['is_grantuser'] = $GLOBALS['dbi']->isUserType('grant');
$GLOBALS['is_createuser'] = $GLOBALS['dbi']->isUserType('create');
// now, select the mysql db
if ($GLOBALS['is_superuser'] && ! PMA_DRIZZLE) {
if ($GLOBALS['is_superuser']) {
$GLOBALS['dbi']->selectDb('mysql', $GLOBALS['userlink']);
}

View File

@ -405,7 +405,7 @@ function PMA_getHtmlForReplicationType(
}
}
if ($is_superuser && ! PMA_DRIZZLE) {
if ($is_superuser) {
$html .= ' <th>' . ($cfg_iconic ? '' : __('Action')) . "\n"
. ' </th>' . "\n";
}

View File

@ -1,268 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* functions for displaying server plugins
*
* @usedby server_plugins.php
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Get the HTML for the sub tabs
*
* @param string $activeUrl url of the active sub tab
*
* @return string HTML for sub tabs
*/
function PMA_getHtmlForPluginsSubTabs($activeUrl)
{
$url_params = PMA_URL_getCommon();
$items = array(
array(
'name' => __('Plugins'),
'url' => 'server_plugins.php'
),
array(
'name' => __('Modules'),
'url' => 'server_modules.php'
)
);
$retval = '<ul id="topmenu2">';
foreach ($items as $item) {
$class = '';
if ($item['url'] === $activeUrl) {
$class = ' class="tabactive"';
}
$retval .= '<li>';
$retval .= '<a' . $class;
$retval .= ' href="' . $item['url'] . $url_params . '">';
$retval .= $item['name'];
$retval .= '</a>';
$retval .= '</li>';
}
$retval .= '</ul>';
$retval .= '<div class="clearfloat"></div>';
return $retval;
}
/**
* Returns the common SQL used to retrieve plugin and modules data
*
* @return string SQL
*/
function PMA_getServerPluginModuleSQL()
{
return "SELECT p.plugin_name, p.plugin_type, p.is_active, m.module_name,
m.module_library, m.module_version, m.module_author,
m.module_description, m.module_license
FROM data_dictionary.plugins p
JOIN data_dictionary.modules m USING (module_name)
ORDER BY m.module_name, p.plugin_type, p.plugin_name";
}
/**
* Returns details about server plugins
*
* @return array server plugins data
*/
function PMA_getServerPlugins()
{
$sql = PMA_getServerPluginModuleSQL();
$res = $GLOBALS['dbi']->query($sql);
$plugins = array();
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
$plugins[$row['plugin_type']][] = $row;
}
$GLOBALS['dbi']->freeResult($res);
ksort($plugins);
return $plugins;
}
/**
* Returns details about server modules
*
* @return array server modules data
*/
function PMA_getServerModules()
{
$sql = PMA_getServerPluginModuleSQL();
$res = $GLOBALS['dbi']->query($sql);
$modules = array();
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
$modules[$row['module_name']]['info'] = $row;
$modules[$row['module_name']]['plugins'][$row['plugin_type']][] = $row;
}
$GLOBALS['dbi']->freeResult($res);
return $modules;
}
/**
* Returns the html for plugin Tab.
*
* @param Array $plugins list
*
* @return string
*/
function PMA_getPluginTab($plugins)
{
$html = '<div id="plugins_plugins">';
$html .= '<div id="sectionlinks">';
foreach ($plugins as $plugin_type => $plugin_list) {
$key = 'plugins-'
. preg_replace('/[^a-z]/', '', /*overload*/mb_strtolower($plugin_type));
$html .= '<a href="#' . $key . '">'
. htmlspecialchars($plugin_type) . '</a>' . "\n";
}
$html .= '</div>';
$html .= '<br />';
foreach ($plugins as $plugin_type => $plugin_list) {
$key = 'plugins-'
. preg_replace('/[^a-z]/', '', /*overload*/mb_strtolower($plugin_type));
sort($plugin_list);
$html .= '<table class="data_full_width" id="' . $key . '">';
$html .= '<caption class="tblHeaders">';
$html .= htmlspecialchars($plugin_type);
$html .= '</caption>';
$html .= '<thead>';
$html .= '<tr>';
$html .= '<th>' . __('Plugin') . '</th>';
$html .= '<th>' . __('Module') . '</th>';
$html .= '<th>' . __('Library') . '</th>';
$html .= '<th>' . __('Version') . '</th>';
$html .= '<th>' . __('Author') . '</th>';
$html .= '<th>' . __('License') . '</th>';
$html .= '</tr>';
$html .= '</thead>';
$html .= '<tbody>';
$html .= PMA_getPluginList($plugin_list);
$html .= '</tbody>';
$html .= '</table>';
}
$html .= '</div>';
return $html;
}
/**
* Returns the html for plugin List.
*
* @param Array $plugin_list list
*
* @return string
*/
function PMA_getPluginList($plugin_list)
{
$html = "";
$odd_row = false;
foreach ($plugin_list as $plugin) {
$odd_row = !$odd_row;
$html .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$html .= '<th>' . htmlspecialchars($plugin['plugin_name']) . '</th>';
$html .= '<td>' . htmlspecialchars($plugin['module_name']) . '</td>';
$html .= '<td>' . htmlspecialchars($plugin['module_library']) . '</td>';
$html .= '<td>' . htmlspecialchars($plugin['module_version']) . '</td>';
$html .= '<td>' . htmlspecialchars($plugin['module_author']) . '</td>';
$html .= '<td>' . htmlspecialchars($plugin['module_license']) . '</td>';
$html .= '</tr>';
}
return $html;
}
/**
* Returns the html for Module Tab.
*
* @param Array $modules list
*
* @return string
*/
function PMA_getModuleTab($modules)
{
$html = '<div id="plugins_modules">';
$html .= '<table class="data_full_width">';
$html .= '<thead>';
$html .= '<tr>';
$html .= '<th>' . __('Module') . '</th>';
$html .= '<th>' . __('Description') . '</th>';
$html .= '<th>' . __('Library') . '</th>';
$html .= '<th>' . __('Version') . '</th>';
$html .= '<th>' . __('Author') . '</th>';
$html .= '<th>' . __('License') . '</th>';
$html .= '</tr>';
$html .= '</thead>';
$html .= '<tbody>';
$html .= PMA_getModuleList($modules);
$html .= '</tbody>';
$html .= '</table>';
$html .= '</div>';
return $html;
}
/**
* Returns the html for module List.
*
* @param Array $modules list
*
* @return string
*/
function PMA_getModuleList($modules)
{
$html = "";
$odd_row = false;
foreach ($modules as $module_name => $module) {
$odd_row = !$odd_row;
$html .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$html .= '<th rowspan="2">' . htmlspecialchars($module_name) . '</th>';
$html .= '<td>' . htmlspecialchars($module['info']['module_description'])
. '</td>';
$html .= '<td>' . htmlspecialchars($module['info']['module_library'])
. '</td>';
$html .= '<td>' . htmlspecialchars($module['info']['module_version'])
. '</td>';
$html .= '<td>' . htmlspecialchars($module['info']['module_author'])
. '</td>';
$html .= '<td>' . htmlspecialchars($module['info']['module_license'])
. '</td>';
$html .= '</tr>';
$html .= '<tr class="noclick ' . ($odd_row ? 'odd' : 'even') . '">';
$html .= '<td colspan="5">';
$html .= '<table>';
$html .= '<tbody>';
foreach ($module['plugins'] as $plugin_type => $plugin_list) {
$html .= '<tr class="noclick">';
$html .= '<td><b class="plugin-type">'
. htmlspecialchars($plugin_type) . '</b></td>';
$html .= '<td>';
for ($i = 0, $nb = count($plugin_list); $i < $nb; $i++) {
$html .= ($i != 0 ? '<br />' : '')
. htmlspecialchars($plugin_list[$i]['plugin_name']);
if (!$plugin_list[$i]['is_active']) {
$html .= ' <small class="attention">' . __('disabled')
. '</small>';
}
}
$html .= '</td>';
$html .= '</tr>';
}
$html .= '</tbody>';
$html .= '</table>';
$html .= '</td>';
$html .= '</tr>';
}
return $html;
}

View File

@ -29,9 +29,7 @@ function PMA_getHtmlForMonitor($ServerStatusData)
$retval .= PMA_getHtmlForAddChartDialog();
if (! PMA_DRIZZLE) {
$retval .= PMA_getHtmlForAnalyseDialog();
}
$retval .= PMA_getHtmlForAnalyseDialog();
$retval .= '<table class="clearfloat" id="chartGrid"></table>';
$retval .= '<div id="logTable">';
@ -256,10 +254,8 @@ function PMA_getHtmlForTabLinks()
$retval .= '<a href="#settingsPopup" class="popupLink">';
$retval .= PMA_Util::getImage('s_cog.png') . __('Settings');
$retval .= '</a>';
if (! PMA_DRIZZLE) {
$retval .= '<a href="#monitorInstructionsDialog">';
$retval .= PMA_Util::getImage('b_help.png') . __('Instructions/Setup');
}
$retval .= '<a href="#monitorInstructionsDialog">';
$retval .= PMA_Util::getImage('b_help.png') . __('Instructions/Setup');
$retval .= '<a href="#endChartEditMode" style="display:none;">';
$retval .= PMA_Util::getImage('s_okay.png');
$retval .= __('Done dragging (rearranging) charts');

View File

@ -103,49 +103,22 @@ function PMA_getHtmlForServerProcesslist()
);
$sortableColCount = count($sortable_columns);
if (PMA_DRIZZLE) {
$left_str = 'left(p.info, '
. (int)$GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] . ')';
$sql_query = "SELECT
p.id AS Id,
p.username AS User,
p.host AS Host,
p.db AS db,
p.command AS Command,
p.time AS Time,
p.state AS State,"
. ($show_full_sql ? 's.query' : $left_str )
. " AS Info FROM data_dictionary.PROCESSLIST p "
. ($show_full_sql
? 'LEFT JOIN data_dictionary.SESSIONS s ON s.session_id = p.id'
: '');
if (! empty($_REQUEST['showExecuting'])) {
$sql_query .= ' WHERE p.state = "executing" ';
}
if (! empty($_REQUEST['order_by_field'])
&& ! empty($_REQUEST['sort_order'])
) {
$sql_query .= ' ORDER BY p.' . $_REQUEST['order_by_field'] . ' '
. $_REQUEST['sort_order'];
}
} else {
$sql_query = $show_full_sql
? 'SHOW FULL PROCESSLIST'
: 'SHOW PROCESSLIST';
if ((! empty($_REQUEST['order_by_field'])
&& ! empty($_REQUEST['sort_order']))
|| (! empty($_REQUEST['showExecuting']))
) {
$sql_query = 'SELECT * FROM `INFORMATION_SCHEMA`.`PROCESSLIST` ';
}
if (! empty($_REQUEST['showExecuting'])) {
$sql_query .= ' WHERE state = "executing" ';
}
if (!empty($_REQUEST['order_by_field']) && !empty($_REQUEST['sort_order'])) {
$sql_query .= ' ORDER BY '
. PMA_Util::backquote($_REQUEST['order_by_field'])
. ' ' . $_REQUEST['sort_order'];
}
$sql_query = $show_full_sql
? 'SHOW FULL PROCESSLIST'
: 'SHOW PROCESSLIST';
if ((! empty($_REQUEST['order_by_field'])
&& ! empty($_REQUEST['sort_order']))
|| (! empty($_REQUEST['showExecuting']))
) {
$sql_query = 'SELECT * FROM `INFORMATION_SCHEMA`.`PROCESSLIST` ';
}
if (! empty($_REQUEST['showExecuting'])) {
$sql_query .= ' WHERE state = "executing" ';
}
if (!empty($_REQUEST['order_by_field']) && !empty($_REQUEST['sort_order'])) {
$sql_query .= ' ORDER BY '
. PMA_Util::backquote($_REQUEST['order_by_field'])
. ' ' . $_REQUEST['sort_order'];
}
$result = $GLOBALS['dbi']->query($sql_query);
@ -194,7 +167,7 @@ function PMA_getHtmlForServerProcesslist()
$retval .= '</a>';
if (! PMA_DRIZZLE && (0 === --$sortableColCount)) {
if (0 === --$sortableColCount) {
$retval .= '<a href="' . $full_text_link . '">';
if ($show_full_sql) {
$retval .= PMA_Util::getImage(

View File

@ -21,15 +21,13 @@ require_once 'libraries/server_bin_log.lib.php';
/**
* array binary log files
*/
$binary_logs = PMA_DRIZZLE
? null
: $GLOBALS['dbi']->fetchResult(
'SHOW MASTER LOGS',
'Log_name',
null,
null,
PMA_DatabaseInterface::QUERY_STORE
);
$binary_logs = $GLOBALS['dbi']->fetchResult(
'SHOW MASTER LOGS',
'Log_name',
null,
null,
PMA_DatabaseInterface::QUERY_STORE
);
if (! isset($_REQUEST['log'])
|| ! array_key_exists($_REQUEST['log'], $binary_logs)

View File

@ -18,12 +18,7 @@ $header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('server_databases.js');
if (! PMA_DRIZZLE) {
include_once 'libraries/replication.inc.php';
} else {
$replication_types = array();
$GLOBALS['replication_info'] = null;
}
require_once 'libraries/replication.inc.php';
require 'libraries/build_html_for_db.lib.php';
/**

View File

@ -1,39 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* object the server plugin page
*
* @package PhpMyAdmin
*/
/**
* requirements
*/
require_once 'libraries/common.inc.php';
/**
* JS includes
*/
$response = PMA_Response::getInstance();
$header = $response->getHeader();
$scripts = $header->getScripts();
$scripts->addFile('jquery/jquery.tablesorter.js');
$scripts->addFile('server_plugins.js');
/**
* Does the common work
*/
require 'libraries/server_common.inc.php';
require 'libraries/server_plugins.lib.php';
$plugins = PMA_getServerPlugins();
/**
* Displays the page
*/
$response->addHTML('<div>');
$response->addHTML(PMA_getHtmlForPluginsSubTabs('server_plugins.php'));
$response->addHTML(PMA_getPluginTab($plugins));
$response->addHTML('</div>');
exit;

View File

@ -14,14 +14,8 @@ require_once 'libraries/server_status.lib.php';
/**
* Replication library
*/
if (PMA_DRIZZLE) {
$GLOBALS['replication_info'] = array();
$GLOBALS['replication_info']['master']['status'] = false;
$GLOBALS['replication_info']['slave']['status'] = false;
} else {
include_once 'libraries/replication.inc.php';
include_once 'libraries/replication_gui.lib.php';
}
require_once 'libraries/replication.inc.php';
require_once 'libraries/replication_gui.lib.php';
/**
* start output

View File

@ -10,15 +10,8 @@ require_once 'libraries/common.inc.php';
require_once 'libraries/Advisor.class.php';
require_once 'libraries/ServerStatusData.class.php';
require_once 'libraries/server_status_advisor.lib.php';
if (PMA_DRIZZLE) {
$GLOBALS['replication_info'] = array();
$GLOBALS['replication_info']['master']['status'] = false;
$GLOBALS['replication_info']['slave']['status'] = false;
} else {
include_once 'libraries/replication.inc.php';
include_once 'libraries/replication_gui.lib.php';
}
require_once 'libraries/replication.inc.php';
require_once 'libraries/replication_gui.lib.php';
$serverStatusData = new PMA_ServerStatusData();

View File

@ -10,15 +10,8 @@ require_once 'libraries/common.inc.php';
require_once 'libraries/server_common.inc.php';
require_once 'libraries/ServerStatusData.class.php';
require_once 'libraries/server_status_monitor.lib.php';
if (PMA_DRIZZLE) {
$GLOBALS['replication_info'] = array();
$GLOBALS['replication_info']['master']['status'] = false;
$GLOBALS['replication_info']['slave']['status'] = false;
} else {
include_once 'libraries/replication.inc.php';
include_once 'libraries/replication_gui.lib.php';
}
require_once 'libraries/replication.inc.php';
require_once 'libraries/replication_gui.lib.php';
/**
* Ajax request

View File

@ -14,14 +14,8 @@ require_once 'libraries/server_status_processes.lib.php';
/**
* Replication library
*/
if (PMA_DRIZZLE) {
$GLOBALS['replication_info'] = array();
$GLOBALS['replication_info']['master']['status'] = false;
$GLOBALS['replication_info']['slave']['status'] = false;
} else {
include_once 'libraries/replication.inc.php';
include_once 'libraries/replication_gui.lib.php';
}
require_once 'libraries/replication.inc.php';
require_once 'libraries/replication_gui.lib.php';
$ServerStatusData = new PMA_ServerStatusData();
$response = PMA_Response::getInstance();

View File

@ -11,15 +11,8 @@ require_once 'libraries/common.inc.php';
require_once 'libraries/server_common.inc.php';
require_once 'libraries/ServerStatusData.class.php';
require_once 'libraries/server_status_queries.lib.php';
if (PMA_DRIZZLE) {
$GLOBALS['replication_info'] = array();
$GLOBALS['replication_info']['master']['status'] = false;
$GLOBALS['replication_info']['slave']['status'] = false;
} else {
include_once 'libraries/replication.inc.php';
include_once 'libraries/replication_gui.lib.php';
}
require_once 'libraries/replication.inc.php';
require_once 'libraries/replication_gui.lib.php';
$serverStatusData = new PMA_ServerStatusData();

View File

@ -10,15 +10,8 @@ require_once 'libraries/common.inc.php';
require_once 'libraries/server_common.inc.php';
require_once 'libraries/ServerStatusData.class.php';
require_once 'libraries/server_status_variables.lib.php';
if (PMA_DRIZZLE) {
$GLOBALS['replication_info'] = array();
$GLOBALS['replication_info']['master']['status'] = false;
$GLOBALS['replication_info']['slave']['status'] = false;
} else {
include_once 'libraries/replication.inc.php';
include_once 'libraries/replication_gui.lib.php';
}
require_once 'libraries/replication.inc.php';
require_once 'libraries/replication_gui.lib.php';
/**
* flush status variables if requested

View File

@ -1,307 +0,0 @@
-- --------------------------------------------------------
-- SQL Commands to set up the pmadb as described in the documentation.
--
-- This file is meant for use with Drizzle 2011.03.13 and above!
--
-- This script expects that you take care of database permissions.
--
-- Please don't forget to set up the tablenames in config.inc.php
--
-- --------------------------------------------------------
--
-- Database : `phpmyadmin`
--
CREATE DATABASE IF NOT EXISTS `phpmyadmin`
COLLATE utf8_bin;
USE phpmyadmin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__bookmark`
--
CREATE TABLE IF NOT EXISTS `pma__bookmark` (
`id` int(11) NOT NULL auto_increment,
`dbase` varchar(255) NOT NULL default '',
`user` varchar(255) NOT NULL default '',
`label` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
`query` text NOT NULL,
PRIMARY KEY (`id`)
)
COMMENT='Bookmarks'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__column_info`
--
CREATE TABLE IF NOT EXISTS `pma__column_info` (
`id` int(5) NOT NULL auto_increment,
`db_name` varchar(64) NOT NULL default '',
`table_name` varchar(64) NOT NULL default '',
`column_name` varchar(64) NOT NULL default '',
`comment` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
`mimetype` varchar(255) COLLATE utf8_general_ci NOT NULL default '',
`transformation` varchar(255) NOT NULL default '',
`transformation_options` varchar(255) NOT NULL default '',
`input_transformation` varchar(255) NOT NULL default '',
`input_transformation_options` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`),
UNIQUE KEY `db_name` (`db_name`,`table_name`,`column_name`)
)
COMMENT='Column information for phpMyAdmin'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__history`
--
CREATE TABLE IF NOT EXISTS `pma__history` (
`id` bigint(20) NOT NULL auto_increment,
`username` varchar(64) NOT NULL default '',
`db` varchar(64) NOT NULL default '',
`table` varchar(64) NOT NULL default '',
`timevalue` timestamp NOT NULL,
`sqlquery` text NOT NULL,
PRIMARY KEY (`id`),
KEY `username` (`username`,`db`,`table`,`timevalue`)
)
COMMENT='SQL history for phpMyAdmin'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__pdf_pages`
--
CREATE TABLE IF NOT EXISTS `pma__pdf_pages` (
`db_name` varchar(64) NOT NULL default '',
`page_nr` int(10) NOT NULL auto_increment,
`page_descr` varchar(50) COLLATE utf8_general_ci NOT NULL default '',
PRIMARY KEY (`page_nr`),
KEY `db_name` (`db_name`)
)
COMMENT='PDF relation pages for phpMyAdmin'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__recent`
--
CREATE TABLE IF NOT EXISTS `pma__recent` (
`username` varchar(64) NOT NULL,
`tables` text NOT NULL,
PRIMARY KEY (`username`)
)
COMMENT='Recently accessed tables'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__table_uiprefs`
--
CREATE TABLE IF NOT EXISTS `pma__table_uiprefs` (
`username` varchar(64) NOT NULL,
`db_name` varchar(64) NOT NULL,
`table_name` varchar(64) NOT NULL,
`prefs` text NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`username`,`db_name`,`table_name`)
)
COMMENT='Tables'' UI preferences'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__relation`
--
CREATE TABLE IF NOT EXISTS `pma__relation` (
`master_db` varchar(64) NOT NULL default '',
`master_table` varchar(64) NOT NULL default '',
`master_field` varchar(64) NOT NULL default '',
`foreign_db` varchar(64) NOT NULL default '',
`foreign_table` varchar(64) NOT NULL default '',
`foreign_field` varchar(64) NOT NULL default '',
PRIMARY KEY (`master_db`,`master_table`,`master_field`),
KEY `foreign_field` (`foreign_db`,`foreign_table`)
)
COMMENT='Relation table'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__table_coords`
--
CREATE TABLE IF NOT EXISTS `pma__table_coords` (
`db_name` varchar(64) NOT NULL default '',
`table_name` varchar(64) NOT NULL default '',
`pdf_page_number` int(11) NOT NULL default '0',
`x` float NOT NULL default '0',
`y` float NOT NULL default '0',
PRIMARY KEY (`db_name`,`table_name`,`pdf_page_number`)
)
COMMENT='Table coordinates for phpMyAdmin PDF output'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__table_info`
--
CREATE TABLE IF NOT EXISTS `pma__table_info` (
`db_name` varchar(64) NOT NULL default '',
`table_name` varchar(64) NOT NULL default '',
`display_field` varchar(64) NOT NULL default '',
PRIMARY KEY (`db_name`,`table_name`)
)
COMMENT='Table information for phpMyAdmin'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__tracking`
--
CREATE TABLE IF NOT EXISTS `pma__tracking` (
`db_name` varchar(64) NOT NULL,
`table_name` varchar(64) NOT NULL,
`version` int(10) NOT NULL,
`date_created` datetime NOT NULL,
`date_updated` datetime NOT NULL,
`schema_snapshot` text NOT NULL,
`schema_sql` text,
`data_sql` text,
`tracking` varchar(15) default NULL,
`tracking_active` int(1) NOT NULL default '1',
PRIMARY KEY (`db_name`,`table_name`,`version`)
)
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__userconfig`
--
CREATE TABLE IF NOT EXISTS `pma__userconfig` (
`username` varchar(64) NOT NULL,
`timevalue` timestamp NOT NULL,
`config_data` text NOT NULL,
PRIMARY KEY (`username`)
)
COMMENT='User preferences storage for phpMyAdmin'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__users`
--
CREATE TABLE IF NOT EXISTS `pma__users` (
`username` varchar(64) NOT NULL,
`usergroup` varchar(64) NOT NULL,
PRIMARY KEY (`username`,`usergroup`)
)
COMMENT='Users and their assignments to user groups'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__usergroups`
--
CREATE TABLE IF NOT EXISTS `pma__usergroups` (
`usergroup` varchar(64) NOT NULL,
`tab` varchar(64) NOT NULL,
`allowed` enum('Y','N') NOT NULL DEFAULT 'N',
PRIMARY KEY (`usergroup`,`tab`,`allowed`)
)
COMMENT='User groups with configured menu items'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__navigationhiding`
--
CREATE TABLE IF NOT EXISTS `pma__navigationhiding` (
`username` varchar(64) NOT NULL,
`item_name` varchar(64) NOT NULL,
`item_type` varchar(64) NOT NULL,
`db_name` varchar(64) NOT NULL,
`table_name` varchar(64) NOT NULL,
PRIMARY KEY (`username`,`item_name`,`item_type`,`db_name`,`table_name`)
)
COMMENT='Hidden items of navigation tree'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__savedsearches`
--
CREATE TABLE IF NOT EXISTS `pma__savedsearches` (
`id` int(5) unsigned NOT NULL auto_increment,
`username` varchar(64) NOT NULL default '',
`db_name` varchar(64) NOT NULL default '',
`search_name` varchar(64) NOT NULL default '',
`search_data` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `u_savedsearches_username_dbname` (`username`,`db_name`,`search_name`)
)
COMMENT='Saved searches'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__designer_settings`
--
CREATE TABLE IF NOT EXISTS `pma__designer_settings` (
`username` varchar(64) NOT NULL,
`settings_data` text NOT NULL,
PRIMARY KEY (`username`)
)
COMMENT='Settings related to Designer'
COLLATE utf8_bin;
-- --------------------------------------------------------
--
-- Table structure for table `pma__export_templates`
--
CREATE TABLE IF NOT EXISTS `pma__export_templates` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(64) NOT NULL,
`export_type` varchar(10) NOT NULL,
`template_name` varchar(64) NOT NULL,
`template_data` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `u_user_type_template` (`username`,`export_type`,`template_name`)
)
COMMENT='Saved export templates'
COLLATE utf8_bin;

View File

@ -84,7 +84,7 @@ $ci_offset = -1;
'columnMeta' => isset($columnMeta) ? $columnMeta : null
)); ?>
</td>
<?php if (isset($_REQUEST['change_column']) && !empty($_REQUEST['change_column']) && ! PMA_DRIZZLE): ?>
<?php if (isset($_REQUEST['change_column']) && !empty($_REQUEST['change_column'])): ?>
<!-- column Adjust privileges, Only for 'Edit' Column(s) -->
<td class="center">
<?php $privs_available = isset($GLOBALS['col_priv']) && $GLOBALS['col_priv']

View File

@ -17,16 +17,14 @@
<?php echo ((isset($columnMeta['Key']) && $columnMeta['Key'] == 'MUL') ? 'selected="selected"' : '');?>>
INDEX
</option>
<?php if (!PMA_DRIZZLE): ?>
<option value="fulltext_<?php echo $columnNumber; ?>"
title="<?php echo __("Fulltext"); ?>"
<?php echo ((isset($columnMeta['Key']) && $columnMeta['Key'] == 'FULLTEXT') ? 'selected="selected"' : '');?>>
FULLTEXT
</option>
<option value="spatial_<?php echo $columnNumber; ?>"
title="<?php echo __("Spatial"); ?>"
<?php echo ((isset($columnMeta['Key']) && $columnMeta['Key'] == 'SPATIAL') ? 'selected="selected"' : '');?>>
SPATIAL
</option>
<?php endif; ?>
<option value="fulltext_<?php echo $columnNumber; ?>"
title="<?php echo __("Fulltext"); ?>"
<?php echo ((isset($columnMeta['Key']) && $columnMeta['Key'] == 'FULLTEXT') ? 'selected="selected"' : '');?>>
FULLTEXT
</option>
<option value="spatial_<?php echo $columnNumber; ?>"
title="<?php echo __("Spatial"); ?>"
<?php echo ((isset($columnMeta['Key']) && $columnMeta['Key'] == 'SPATIAL') ? 'selected="selected"' : '');?>>
SPATIAL
</option>
</select>

View File

@ -18,11 +18,9 @@
<optgroup label="<?php echo __('Table maintenance'); ?>">
<option value="analyze_tbl" ><?php echo __('Analyze table'); ?></option>
<option value="check_tbl" ><?php echo __('Check table'); ?></option>
<?php if (!PMA_DRIZZLE): ?>
<option value="checksum_tbl" ><?php echo __('Checksum table'); ?></option>
<option value="optimize_tbl" ><?php echo __('Optimize table'); ?></option>
<option value="repair_tbl" ><?php echo __('Repair table'); ?></option>
<?php endif; ?>
<option value="checksum_tbl" ><?php echo __('Checksum table'); ?></option>
<option value="optimize_tbl" ><?php echo __('Optimize table'); ?></option>
<option value="repair_tbl" ><?php echo __('Repair table'); ?></option>
</optgroup>
<optgroup label="<?php echo __('Prefix'); ?>">
<option value="add_prefix_tbl" ><?php echo __('Add prefix to table'); ?></option>

View File

@ -45,38 +45,16 @@ if ($foreign_db) {
$foreign_table = isset($one_key['ref_table_name'])
? $one_key['ref_table_name'] : '';
// In Drizzle, 'SHOW TABLE STATUS' will show status only for the tables
// which are currently in the table cache. Hence we have to use
// 'SHOW TABLES' and manualy retrieve table engine values.
if (PMA_DRIZZLE) {
$tables_rs = $GLOBALS['dbi']->query(
'SHOW TABLES FROM ' . PMA_Util::backquote($foreign_db),
null,
PMA_DatabaseInterface::QUERY_STORE
);
while ($row = $GLOBALS['dbi']->fetchArray($tables_rs)) {
$engine = $GLOBALS['dbi']->getTable(
$foreign_db,
$row[0]
)->getStatusInfo('Engine');
if (isset($engine)
&& /*overload*/mb_strtoupper($engine) == $tbl_storage_engine
) {
$tables[] = $row[0];
}
}
} else {
$tables_rs = $GLOBALS['dbi']->query(
'SHOW TABLE STATUS FROM ' . PMA_Util::backquote($foreign_db),
null,
PMA_DatabaseInterface::QUERY_STORE
);
while ($row = $GLOBALS['dbi']->fetchRow($tables_rs)) {
if (isset($row[1])
&& /*overload*/mb_strtoupper($row[1]) == $tbl_storage_engine
) {
$tables[] = $row[0];
}
$tables_rs = $GLOBALS['dbi']->query(
'SHOW TABLE STATUS FROM ' . PMA_Util::backquote($foreign_db),
null,
PMA_DatabaseInterface::QUERY_STORE
);
while ($row = $GLOBALS['dbi']->fetchRow($tables_rs)) {
if (isset($row[1])
&& /*overload*/mb_strtoupper($row[1]) == $tbl_storage_engine
) {
$tables[] = $row[0];
}
}
}

View File

@ -59,54 +59,53 @@
)
);
?>
<?php if (!PMA_DRIZZLE): ?>
<!-- Add spatial -->
<?php
$spatial_types = array(
'geometry', 'point', 'linestring', 'polygon', 'multipoint',
'multilinestring', 'multipolygon', 'geomtrycollection'
);
echo PMA\Template::get('table/structure/action_row_in_structure_table')->render(
array(
'type' => $type,
'tbl_storage_engine' => $tbl_storage_engine,
'class' => 'spatial nowrap',
'hasField' => ! (in_array($type, $spatial_types) && ('MYISAM' == $tbl_storage_engine || PMA_MYSQL_INT_VERSION >= 50705)),
'hasLinkClass' => false,
'url_query' => $url_query,
'primary' => $primary,
'syntax' => 'ADD SPATIAL',
'message' => __('An index has been added on %s.'),
'action' => 'Spatial',
'titles' => $titles,
'row' => $row,
'isPrimary' => false
)
);
?>
<!-- FULLTEXT is possible on TEXT, CHAR and VARCHAR -->
<li class="fulltext nowrap">
<?php if (! empty($tbl_storage_engine)
&& ($tbl_storage_engine == 'MYISAM'
|| $tbl_storage_engine == 'ARIA'
|| $tbl_storage_engine == 'MARIA'
|| ($tbl_storage_engine == 'INNODB' && PMA_MYSQL_INT_VERSION >= 50604))
&& (/*overload*/mb_strpos($type, 'text') !== false
|| /*overload*/mb_strpos($type, 'char') !== false)
): ?>
<a rel="samepage" class="ajax add_key add_fulltext_anchor" href="tbl_structure.php<?php echo $url_query; ?>&amp;add_key=1&amp;sql_query=<?php echo urlencode(
'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table'])
. ' ADD FULLTEXT(' . PMA_Util::backquote($row['Field'])
. ');'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(
__('An index has been added on %s.'),
htmlspecialchars($row['Field']))); ?>">
<?php echo $titles['IdxFulltext']; ?>
</a>
<?php else: ?>
<?php echo $titles['NoIdxFulltext']; ?>
<?php endif; ?>
</li>
<!-- Add spatial -->
<?php
$spatial_types = array(
'geometry', 'point', 'linestring', 'polygon', 'multipoint',
'multilinestring', 'multipolygon', 'geomtrycollection'
);
echo PMA\Template::get('table/structure/action_row_in_structure_table')->render(
array(
'type' => $type,
'tbl_storage_engine' => $tbl_storage_engine,
'class' => 'spatial nowrap',
'hasField' => ! (in_array($type, $spatial_types) && ('MYISAM' == $tbl_storage_engine || PMA_MYSQL_INT_VERSION >= 50705)),
'hasLinkClass' => false,
'url_query' => $url_query,
'primary' => $primary,
'syntax' => 'ADD SPATIAL',
'message' => __('An index has been added on %s.'),
'action' => 'Spatial',
'titles' => $titles,
'row' => $row,
'isPrimary' => false
)
);
?>
<!-- FULLTEXT is possible on TEXT, CHAR and VARCHAR -->
<li class="fulltext nowrap">
<?php if (! empty($tbl_storage_engine)
&& ($tbl_storage_engine == 'MYISAM'
|| $tbl_storage_engine == 'ARIA'
|| $tbl_storage_engine == 'MARIA'
|| ($tbl_storage_engine == 'INNODB' && PMA_MYSQL_INT_VERSION >= 50604))
&& (/*overload*/mb_strpos($type, 'text') !== false
|| /*overload*/mb_strpos($type, 'char') !== false)
): ?>
<a rel="samepage" class="ajax add_key add_fulltext_anchor" href="tbl_structure.php<?php echo $url_query; ?>&amp;add_key=1&amp;sql_query=<?php echo urlencode(
'ALTER TABLE ' . PMA_Util::backquote($GLOBALS['table'])
. ' ADD FULLTEXT(' . PMA_Util::backquote($row['Field'])
. ');'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(
__('An index has been added on %s.'),
htmlspecialchars($row['Field']))); ?>">
<?php echo $titles['IdxFulltext']; ?>
</a>
<?php else: ?>
<?php echo $titles['NoIdxFulltext']; ?>
<?php endif; ?>
</li>
<!-- Distinct value action -->
<li class="browse nowrap">
<a href="sql.php<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode(

View File

@ -44,7 +44,7 @@
<?php endif; ?>
<!-- Optimize link if overhead -->
<?php if (isset($free_size) && !PMA_DRIZZLE
<?php if (isset($free_size)
&& ($tbl_storage_engine == 'MYISAM'
|| $tbl_storage_engine == 'ARIA'
|| $tbl_storage_engine == 'MARIA'

View File

@ -1,18 +1,16 @@
<a href="#" id="printView"><?php echo PMA_Util::getIcon('b_print.png', __('Print view'), true); ?></a>
<?php if (! $tbl_is_view && ! $db_is_system_schema): ?>
<?php if (!PMA_DRIZZLE): ?>
<a href="sql.php<?php echo $url_query; ?>&amp;session_max_rows=all&amp;sql_query=' . <?php echo urlencode(
'SELECT * FROM ' . PMA_Util::backquote($GLOBALS['table'])
. ' PROCEDURE ANALYSE()'
); ?>" style="margin-right: 0;">
<?php echo PMA_Util::getIcon(
'b_tblanalyse.png',
__('Propose table structure'),
true
); ?>
</a>
<?php echo PMA_Util::showMySQLDocu('procedure_analyse'); ?>
<?php endif; ?>
<a href="sql.php<?php echo $url_query; ?>&amp;session_max_rows=all&amp;sql_query=' . <?php echo urlencode(
'SELECT * FROM ' . PMA_Util::backquote($GLOBALS['table'])
. ' PROCEDURE ANALYSE()'
); ?>" style="margin-right: 0;">
<?php echo PMA_Util::getIcon(
'b_tblanalyse.png',
__('Propose table structure'),
true
); ?>
</a>
<?php echo PMA_Util::showMySQLDocu('procedure_analyse'); ?>
<?php if (PMA_Tracker::isActive()): ?>
<a href="tbl_tracking.php<?php echo $url_query; ?>">
<?php echo PMA_Util::getIcon('eye.png', __('Track table'), true); ?>

View File

@ -13,9 +13,6 @@
<?php if (! $db_is_system_schema && ! $tbl_is_view): ?>
<?php
$colspan = 9;
if (PMA_DRIZZLE) {
$colspan -= 2;
}
if (PMA_Util::showIcons('ActionLinksMode')) {
$colspan--;
}

View File

@ -261,30 +261,6 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
->will($this->returnValue(false));
$GLOBALS['dbi'] = $dbi;
//RunKit, we test:
//1. without Runkit, PMA_DRIZZLE = true;
//2. with Runkit, PMA_DRIZZLE = false;
if (!defined("PMA_DRIZZLE")) {
define("PMA_DRIZZLE", true);
}
if (PMA_HAS_RUNKIT) {
runkit_constant_redefine("PMA_DRIZZLE", false);
}
}
/**
* tearDown function for test cases
*
* @access protected
* @return void
*/
protected function tearDown()
{
if (PMA_HAS_RUNKIT) {
runkit_constant_redefine("PMA_DRIZZLE", false);
}
}
/**
@ -707,16 +683,9 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
$extra, $comment, $virtuality, $expression, $move_to
);
$expect = "";
if (PMA_DRIZZLE) {
$expect = "`name` `new_name` VARCHAR(2) new_name "
. "COLLATE charset1 NULL DEFAULT 'VARCHAR' "
. "AUTO_INCREMENT COMMENT 'PMA comment' AFTER `new_name`";
} else {
$expect = "`name` `new_name` VARCHAR(2) new_name CHARACTER "
. "SET charset1 NULL DEFAULT 'VARCHAR' "
. "AUTO_INCREMENT COMMENT 'PMA comment' AFTER `new_name`";
}
$expect = "`name` `new_name` VARCHAR(2) new_name CHARACTER "
. "SET charset1 NULL DEFAULT 'VARCHAR' "
. "AUTO_INCREMENT COMMENT 'PMA comment' AFTER `new_name`";
$this->assertEquals(
$expect,
@ -1098,36 +1067,6 @@ class PMA_Table_Test extends PHPUnit_Framework_TestCase
}
}
/**
* Tests behaviour of PMA_Table class with Runkit and PMA_Drizzle = false
*
* @package PhpMyAdmin-test
*/
class PMA_Table_Runkit_Test extends PMA_Table_Test
{
/**
* Configures environment
*
* @return void
*/
protected function setUp()
{
//we test:
//1. without Runkit, PMA_DRIZZLE = false;
//2. with Runkit, PMA_DRIZZLE = true;
if (!defined("PMA_DRIZZLE")) {
define("PMA_DRIZZLE", false);
}
parent::setUp();
//RunKit
if (PMA_HAS_RUNKIT) {
runkit_constant_redefine("PMA_DRIZZLE", true);
}
}
}
/**
* Mock class for DataBasePMAMock
*

View File

@ -1,392 +0,0 @@
<?php
/**
* Tests for Types.class.php
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/Types.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/Tracker.class.php';
/**
* Tests for Types.class.php
*
* @package PhpMyAdmin-test
*/
class PMA_Types_Drizzle_Test extends PHPUnit_Framework_TestCase
{
/**
* @var PMA_Types
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @return void
*/
protected function setUp()
{
$this->object = new PMA_Types_Drizzle();
}
/**
* Test for getTypeDescription
*
* @param string $type The data type to get a description.
* @param string $output Expected string
*
* @return void
* @dataProvider providerForTestGetTypeDescription
*/
public function testGetTypeDescription($type, $output)
{
$this->assertEquals(
$output,
$this->object->getTypeDescription($type)
);
}
/**
* Provider for testGetTypeDescription
*
* @return array
*/
public function providerForTestGetTypeDescription()
{
return array(
array(
'INTEGER',
'A 4-byte integer, range is -2,147,483,648 to 2,147,483,647'
),
array(
'BIGINT',
'An 8-byte integer, range is -9,223,372,036,854,775,808 to 9,223,'
. '372,036,854,775,807'
),
array(
'DECIMAL',
'A fixed-point number (M, D) - the maximum number of digits (M) '
. 'is 65 (default 10), the maximum number of decimals (D) is 30 '
. '(default 0)'
),
array(
'DOUBLE',
'A system\'s default double-precision floating-point number'
),
array(
'BOOLEAN',
'True or false'
),
array(
'SERIAL',
'An alias for BIGINT NOT NULL AUTO_INCREMENT UNIQUE'
),
array(
'UUID',
'Stores a Universally Unique Identifier (UUID)'
),
array(
'DATE',
'A date, supported range is 0001-01-01 to 9999-12-31'
),
array(
'DATETIME',
'A date and time combination, supported range is 0001-01-01 00:00:0 '
. 'to 9999-12-31 23:59:59'
),
array(
'TIMESTAMP',
'A timestamp, range is \'0001-01-01 00:00:00\' UTC to \'9999-12-31 '
. '23:59:59\' UTC; TIMESTAMP(6) can store microseconds'
),
array(
'TIME',
'A time, range is 00:00:00 to 23:59:59'
),
array(
'VARCHAR',
'A variable-length (0-16,383) string, the effective maximum length '
. 'is subject to the maximum row size'
),
array(
'TEXT',
'A TEXT column with a maximum length of 65,535 (2^16 - 1) characters'
. ', stored with a two-byte prefix indicating the length of the valu'
. 'e in bytes'
),
array(
'VARBINARY',
'A variable-length (0-65,535) string, uses binary collation for all '
. 'comparisons'
),
array(
'BLOB',
'A BLOB column with a maximum length of 65,535 (2^16 - 1) bytes, '
. 'stored with a two-byte prefix indicating the length of the value'
),
array(
'ENUM',
'An enumeration, chosen from the list of defined values'
),
array(
'UNKNOWN',
''
)
);
}
/**
* Test for getTypeClass
*
* @param string $type Type to test
* @param string $output Expected result
*
* @return void
* @dataProvider providerFortTestGetTypeClass
*/
public function testGetTypeClass($type, $output)
{
$this->assertEquals(
$output,
$this->object->getTypeClass($type)
);
}
/**
* Data provider
*
* @return array Test-data
*/
public function providerFortTestGetTypeClass()
{
return array(
array(
'SERIAL',
'NUMBER'
),
array(
'TIME',
'DATE'
),
array(
'ENUM',
'CHAR'
),
array(
'UUID',
'UUID'
),
array(
'UNKNOWN',
''
)
);
}
/**
* Test for getFunctionsClass
*
* @param string $class The class to get function list.
* @param array $output Expected result
*
* @return void
* @dataProvider providerFortTestGetFunctionsClass
*/
public function testGetFunctionsClass($class, $output)
{
$this->assertEquals(
$output,
$this->object->getFunctionsClass($class)
);
}
/**
* Provider for testGetFunctionsClass
*
* @return array
*/
public function providerFortTestGetFunctionsClass()
{
return array(
array(
'UUID',
array(
'UUID'
)
),
array(
'DATE',
array(
'CURRENT_DATE',
'CURRENT_TIME',
'DATE',
'FROM_DAYS',
'FROM_UNIXTIME',
'LAST_DAY',
'NOW',
'SYSDATE',
'TIMESTAMP',
'UTC_DATE',
'UTC_TIME',
'UTC_TIMESTAMP',
'YEAR',
)
),
array(
'NUMBER',
array(
'ABS',
'ACOS',
'ASCII',
'ASIN',
'ATAN',
'BIT_COUNT',
'CEILING',
'CHAR_LENGTH',
'CONNECTION_ID',
'COS',
'COT',
'CRC32',
'DAYOFMONTH',
'DAYOFWEEK',
'DAYOFYEAR',
'DEGREES',
'EXP',
'FLOOR',
'HOUR',
'LENGTH',
'LN',
'LOG',
'LOG2',
'LOG10',
'MICROSECOND',
'MINUTE',
'MONTH',
'OCT',
'ORD',
'PI',
'QUARTER',
'RADIANS',
'RAND',
'ROUND',
'SECOND',
'SIGN',
'SIN',
'SQRT',
'TAN',
'TO_DAYS',
'TIME_TO_SEC',
'UNCOMPRESSED_LENGTH',
'UNIX_TIMESTAMP',
//'WEEK', // same as TIME
'WEEKDAY',
'WEEKOFYEAR',
'YEARWEEK',
)
),
array(
'CHAR',
array(
0 => 'BIN',
1 => 'CHAR',
2 => 'COMPRESS',
3 => 'CURRENT_USER',
4 => 'DATABASE',
5 => 'DAYNAME',
6 => 'HEX',
7 => 'LOAD_FILE',
8 => 'LOWER',
9 => 'LTRIM',
10 => 'MD5',
11 => 'MONTHNAME',
12 => 'QUOTE',
13 => 'REVERSE',
14 => 'ROT13',
15 => 'RTRIM',
16 => 'SCHEMA',
17 => 'SPACE',
18 => 'TRIM',
19 => 'UNCOMPRESS',
20 => 'UNHEX',
21 => 'UPPER',
22 => 'USER',
23 => 'UUID',
24 => 'VERSION',
)
),
array(
'UNKNOWN',
array()
)
);
}
/**
* Test for getAttributes
*
* @return void
*/
public function testGetAttributes()
{
$this->assertEquals(
array(
'',
'on update CURRENT_TIMESTAMP',
),
$this->object->getAttributes()
);
}
/**
* Test for getColumns
*
* @return void
*/
public function testGetColumns()
{
$this->assertEquals(
array(
0 => 'INT',
1 => 'VARCHAR',
2 => 'TEXT',
3 => 'DATE',
'Numeric' => array (
'INTEGER',
'BIGINT',
'-',
'DECIMAL',
'DOUBLE',
'-',
'BOOLEAN',
'SERIAL',
'UUID',
),
'Date and time' => array (
'DATE',
'DATETIME',
'TIMESTAMP',
'TIME',
),
'String' => array (
'VARCHAR',
'TEXT',
'-',
'VARBINARY',
'BLOB',
'-',
'ENUM',
),
),
$this->object->getColumns()
);
}
}

View File

@ -160,7 +160,7 @@ class TableRelationController_Test extends PHPUnit_Framework_TestCase
/**
* Tests for getDropdownValueForDbAction()
*
* Case one: foreign and not Drizzle
* Case one: foreign
*
* @return void
* @test
@ -206,7 +206,7 @@ class TableRelationController_Test extends PHPUnit_Framework_TestCase
/**
* Tests for getDropdownValueForDbAction()
*
* Case two: not foreign and not Drizzle
* Case two: not foreign
*
* @return void
* @test
@ -248,68 +248,6 @@ class TableRelationController_Test extends PHPUnit_Framework_TestCase
$json['tables']
);
}
/**
* Tests for getDropdownValueForDbAction()
*
* Case three: foreign and Drizzle
*
* @return void
* @test
*/
public function testGetDropdownValueForDbActionThree()
{
if (! PMA_HAS_RUNKIT) {
$this->markTestSkipped("Cannot redefine PMA_DRIZZLE constant");
}
runkit_constant_redefine('PMA_DRIZZLE', true);
$tableMock = $this->getMockBuilder('PMA_Table')
->disableOriginalConstructor()
->getMock();
$statusInfo = 'InnoDB';
$tableMock->expects($this->any())->method('getStatusInfo')
->will($this->returnValue($statusInfo));
$GLOBALS['dbi']->expects($this->any())->method('getTable')
->will($this->returnValue($tableMock));
$GLOBALS['dbi']->expects($this->any())->method('fetchArray')
->will(
$this->returnCallback(
function () {
static $count = 0;
if ($count == 0) {
$count++;
return array('table');
}
return null;
}
)
);
$container = Container::getDefaultContainer();
$container->set('dbi', $GLOBALS['dbi']);
$container->factory('PMA\Controllers\Table\TableRelationController');
$container->alias(
'TableRelationController',
'PMA\Controllers\Table\TableRelationController'
);
$ctrl = $container->get(
'TableRelationController',
array(
'tbl_storage_engine' => 'INNODB',
)
);
$_REQUEST['foreign'] = 'true';
$ctrl->getDropdownValueForDbAction();
$json = $this->response->getJSONResult();
$this->assertEquals(
array('table'),
$json['tables']
);
}
}
/**

View File

@ -192,48 +192,6 @@ class TableStructureController_Test extends PHPUnit_Framework_TestCase
);
}
/**
* Tests for adjustColumnPrivileges()
* For the Drizzle environment
*
* @return void
* @test
*/
public function testAdjustColumnPrivilegesDrizzle()
{
if (! PMA_HAS_RUNKIT) {
$this->markTestSkipped("Cannot redefine PMA_DRIZZLE constant");
}
$class = new ReflectionClass('\PMA\Controllers\TableStructureController');
$method = $class->getMethod('adjustColumnPrivileges');
$method->setAccessible(true);
$container = Container::getDefaultContainer();
$container->set('dbi', $GLOBALS['dbi']);
$container->factory('PMA\Controllers\TableStructureController');
$container->alias(
'TableStructureController', 'PMA\Controllers\TableStructureController'
);
$ctrl = $container->get('TableStructureController');
$this->assertEquals(
false,
$method->invokeArgs($ctrl, array(null))
);
runkit_constant_redefine('PMA_DRIZZLE', false);
$adjust_privileges = array(
'col1' => 'col2'
);
$GLOBALS['col_priv'] = true;
$GLOBALS['flush_priv'] = true;
$this->assertEquals(
true,
$method->invokeArgs($ctrl, array($adjust_privileges))
);
}
/**
* Tests for getMultipleFieldCommandType()
*

View File

@ -1,431 +0,0 @@
<?php
/**
* Tests for PMA_DBI_Drizzle class
*
* @package PhpMyAdmin-test
*/
/*
* Include to test and mock Drizzle class.
*/
/**
* Drizzle for Mock drizzle class
*
* this class is for Mock Drizzle
*
* @package PhpMyAdmin-test
*/
if (!defined("DRIZZLE_CAPABILITIES_COMPRESS")) {
define("DRIZZLE_CAPABILITIES_COMPRESS", 2);
}
/**
* function to return drizzle_version
*
* @return string
*/
function drizzle_version()
{
return "1.0.0";
}
require_once 'libraries/Util.class.php';
require_once 'libraries/relation.lib.php';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/Index.class.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/dbi/DBIDrizzle.class.php';
require_once 'libraries/Theme.class.php';
/**
* Tests for PMA_DBI_Drizzle class
*
* @package PhpMyAdmin-test
*/
class PMA_DBI_Drizzle_Test extends PHPUnit_Framework_TestCase
{
/**
* @access protected
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
* @return void
*/
protected function setUp()
{
$GLOBALS['cfg']['Server']['host'] = "localhost";
$GLOBALS['cfg']['Server']['socket'] = "socket";
$GLOBALS['cfg']['Server']['port'] = 4080;
$GLOBALS['cfg']['Server']['connect_type'] = "http";
$GLOBALS['cfg']['PersistentConnections'] = false;
$GLOBALS['cfg']['Server']['compress'] = true;
$GLOBALS['cfg']['Server']['ssl'] = false;
$GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
$GLOBALS['cfg']['ActionLinksMode'] = "both";
$GLOBALS['cfg']['DefaultTabDatabase'] = 'structure';
$GLOBALS['pmaThemeImage'] = 'image';
//$_SESSION
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
$_SESSION['PMA_Theme'] = new PMA_Theme();
$this->object = new PMA_DBI_Drizzle();
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*
* @access protected
* @return void
*/
protected function tearDown()
{
unset($this->object);
}
/**
* Test for realMultiQuery
*
* @return void
*
* @group medium
*/
public function testRealMultiQuery()
{
//does not support multi_queries
$this->assertEquals(
false,
$this->object->realMultiQuery(null, "select * from PMA")
);
}
/**
* Test for selectDb
*
* @return void
*
* @group medium
*/
public function testSelectDb()
{
$this->markTestIncomplete('Not testing anything');
//$link is empty
$GLOBALS['userlink'] = null;
$this->assertEquals(
false,
$this->object->selectDb("PMA", null)
);
}
/**
* Test for moreResults
*
* @return void
*
* @group medium
*/
public function testrMoreResults()
{
//PHP's 'mysql' extension does not support multi_queries
$this->assertEquals(
false,
$this->object->moreResults(null)
);
//PHP's 'mysql' extension does not support multi_queries
$this->assertEquals(
false,
$this->object->nextResult(null)
);
}
/**
* Test for getClientInfo
*
* @return void
*
* @group medium
*/
public function testrGetClientInfo()
{
$drizzle_info = 'libdrizzle (Drizzle ' . drizzle_version() . ')';
$this->assertEquals(
$drizzle_info,
$this->object->getClientInfo()
);
}
/**
* Test for numRows
*
* @return void
*
* @group medium
*/
public function testrNumRows()
{
$this->assertEquals(
false,
$this->object->numRows(true)
);
}
/**
* Test for storeResult
*
* @return void
*
* @group medium
*/
public function testrStoreResult()
{
$this->assertEquals(
false,
$this->object->storeResult(null)
);
}
/**
* Test for connect
*
* @return void
*
* @group medium
*/
public function testDBIFunction()
{
$user = "PMA_user";
$password = "pma_password";
$server = null;
//$server = null;
$link = $this->object->connect($user, $password);
$this->assertEquals(
"DrizzleCon_addUds",
$link->getType()
);
//$server['host'] = 'host'
$server['host'] = 'host';
$link = $this->object->connect($user, $password);
$this->assertEquals(
"DrizzleCon_addUds",
$link->getType()
);
//selectDb
$dbname = "dbname";
$this->assertEquals(
"selectDb" . $dbname,
$this->object->selectDb($dbname, $link)
);
//realQuery
$query = "query";
$options = false;
$this->assertEquals(
"query" . $query,
$this->object->realQuery($query, $link, $options)
);
//fetchArray
$result = $link;
$this->assertEquals(
"fetchRow " . PMA_Drizzle::FETCH_BOTH,
$this->object->fetchArray($result)
);
//fetchAssoc
$result = $link;
$this->assertEquals(
"fetchRow " . PMA_Drizzle::FETCH_ASSOC,
$this->object->fetchAssoc($result)
);
//fetchRow
$result = $link;
$this->assertEquals(
"fetchRow " . PMA_Drizzle::FETCH_NUM,
$this->object->fetchRow($result)
);
//dataSeek
$result = $link;
$offset = 10;
$this->assertEquals(
"seek" . $offset,
$this->object->dataSeek($result, 10)
);
//numRows
$result = $link;
$this->assertEquals(
"numRows",
$this->object->numRows($result)
);
//numFields
$result = $link;
$this->assertEquals(
"numColumns",
$this->object->numFields($result)
);
}
}
/**
* Mock class for Drizzle
*
* @package PhpMyAdmin-test
*/
class Drizzle
{
/**
* Constructor
*/
public function __construct()
{
}
/**
* Creates a new connection using unix domain socket
*
* @param string $uds socket
* @param string $user username
* @param string $password password
* @param string $db database name
* @param integer $options connection options
*
* @return Mock_Con
*/
public function addUds($uds, $user, $password, $db, $options)
{
return new Mock_Con("DrizzleCon_addUds");
}
/**
* Creates a new database connection using TCP
*
* @param string $host Drizzle host
* @param integer $port Drizzle port
* @param string $user username
* @param string $password password
* @param string $db database name
* @param integer $options connection options
*
* @return Mock_Con
*/
public function addTcp($host, $port, $user, $password, $db, $options)
{
return new Mock_Con("DrizzleCon_addTcp");
}
}
/**
* Mock class for Mock_Connection
*
* @package PhpMyAdmin-test
*/
class Mock_Con
{
var $type;
/**
* Constructor
*
* @param string $type type
*/
public function __construct($type)
{
$this->type = $type;
}
/**
* Creates a new database connection using TCP
*
* @return Mock_Con
*/
public function getType()
{
return $this->type;
}
/**
* selectDb
*
* @param string $dbname database name
*
* @return string
*/
public function selectDb($dbname)
{
return "selectDb" . $dbname;
}
/**
* query
*
* @param string $query query string
* @param int $buffer_mode buffer mode
*
* @return string
*/
public function query($query, $buffer_mode)
{
return "query" . $query;
}
/**
* fetchRow
*
* @param string $mode fetch mode
*
* @return string
*/
public function fetchRow($mode)
{
return "fetchRow " . $mode;
}
/**
* $offset
*
* @param int $offset offset
*
* @return string
*/
public function seek($offset)
{
return "seek" . $offset;
}
/**
* numRows
*
* @return string
*/
public function numRows()
{
return "numRows";
}
/**
* numColumns
*
* @return string
*/
public function numColumns()
{
return "numColumns";
}
}

View File

@ -33,10 +33,6 @@ class PMA_ExportHtmlword_Test extends PHPUnit_Framework_TestCase
*/
function setup()
{
if (!defined("PMA_DRIZZLE")) {
define("PMA_DRIZZLE", false);
}
$GLOBALS['server'] = 0;
$this->object = new ExportHtmlword();
$GLOBALS['output_kanji_conversion'] = false;

View File

@ -33,10 +33,6 @@ class PMA_ExportLatex_Test extends PHPUnit_Framework_TestCase
*/
function setup()
{
if (!defined("PMA_DRIZZLE")) {
define("PMA_DRIZZLE", false);
}
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;

View File

@ -34,10 +34,6 @@ class PMA_ExportOdt_Test extends PHPUnit_Framework_TestCase
*/
function setup()
{
if (!defined("PMA_DRIZZLE")) {
define("PMA_DRIZZLE", false);
}
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['output_charset_conversion'] = false;

View File

@ -36,10 +36,6 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
*/
function setup()
{
if (!defined("PMA_DRIZZLE")) {
define("PMA_DRIZZLE", false);
}
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
@ -71,20 +67,6 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
*/
public function testSetProperties()
{
$restoreDrizzle = $restoreMySQLIntVersion = 'PMANORESTORE';
if (PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
if (PMA_DRIZZLE) {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
}
}
}
// test with hide structure and hide sql as true
$GLOBALS['plugin_param']['export_type'] = 'table';
$GLOBALS['plugin_param']['single_table'] = false;
@ -333,142 +315,6 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
2,
$properties[1]->getProperties()
);
if ($restoreDrizzle !== 'PMANORESTORE') {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
if ($restoreMySQLIntVersion !== 'PMANORESTORE') {
runkit_constant_redefine(
'PMA_MYSQL_INT_VERSION', $restoreMySQLIntVersion
);
}
}
/**
* Test for ExportSql::setProperties
*
* @return void
*/
public function testSetPropertiesWithDrizzle()
{
$restoreDrizzle = $restoreMySQLIntVersion = 'PMANORESTORE';
if (!PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
if (!PMA_DRIZZLE) {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', true);
}
$restoreMySQLIntVersion = PMA_MYSQL_INT_VERSION;
runkit_constant_redefine('PMA_MYSQL_INT_VERSION', 50000);
}
}
$GLOBALS['plugin_param']['export_type'] = 'tableNot';
$GLOBALS['plugin_param']['single_table'] = true;
$GLOBALS['cfgRelation']['mimework'] = false;
$GLOBALS['cfgRelation']['relation'] = false;
$method = new ReflectionMethod('ExportSql', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
$attrProperties = new ReflectionProperty('ExportSql', 'properties');
$attrProperties->setAccessible(true);
$properties = $attrProperties->getValue($this->object);
$options = $properties->getOptions();
$generalOptionsArray = $options->getProperties();
$this->assertCount(
3,
$generalOptionsArray
);
// generalOptions
$option = array_shift($generalOptionsArray);
$properties = $option->getProperties();
$this->assertCount(
6,
$properties
);
$this->assertCount(
2,
$properties[0]->getProperties()
);
// structureOptions
$option = array_shift($generalOptionsArray);
$properties = $option->getProperties();
$this->assertCount(
2,
$properties
);
$properties = $properties[0]->getProperties();
$this->assertCount(
4,
$properties
);
$this->assertNotcontains(
'<code> / EVENT </code>',
$properties[0]->getText()
);
// dataOptions
$option = array_shift($generalOptionsArray);
$properties = $option->getProperties();
$this->assertCount(
6,
$properties
);
$properties = $properties[1]->getProperties();
$this->assertCount(
1,
$properties
);
// case 2 with export type as table
$GLOBALS['plugin_param']['export_type'] = 'table';
$method->invoke($this->object, null);
$properties = $attrProperties->getValue($this->object);
$options = $properties->getOptions();
$generalOptionsArray = $options->getProperties();
$structOption = $generalOptionsArray[1];
$properties = $structOption->getProperties();
$subgroupProps = $properties[0]->getProperties();
$this->assertContains(
'<code>DROP TABLE</code>',
$subgroupProps[0]->getText()
);
if ($restoreDrizzle !== 'PMANORESTORE') {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
if ($restoreMySQLIntVersion !== 'PMANORESTORE') {
runkit_constant_redefine(
'PMA_MYSQL_INT_VERSION', $restoreMySQLIntVersion
);
}
}
/**
@ -604,19 +450,6 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
*/
public function testExportFooter()
{
$restoreDrizzle = 'PMANORESTORE';
if (PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
}
}
$GLOBALS['sql_disable_fk'] = true;
$GLOBALS['sql_use_transaction'] = true;
$GLOBALS['charset'] = 'utf-8';
@ -646,11 +479,6 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
$this->assertTrue(
$this->object->exportFooter()
);
if ($restoreDrizzle !== 'PMANORESTORE') {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**
@ -664,19 +492,6 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
define("PMA_MYSQL_STR_VERSION", "5.0.0");
}
$restoreDrizzle = 'PMANORESTORE';
if (PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
}
}
$GLOBALS['crlf'] = "\n";
$GLOBALS['sql_compatibility'] = 'NONE';
$GLOBALS['cfg']['Server']['host'] = 'localhost';
@ -746,11 +561,6 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
"SET time_zone = \"+00:00\";\n",
$result
);
if ($restoreDrizzle !== 'PMANORESTORE') {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**
@ -1124,21 +934,8 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
* @return void
* @group medium
*/
public function testGetTableDefWithoutDrizzle()
public function testGetTableDef()
{
$restoreDrizzle = 'PMANORESTORE';
if (PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
}
}
$GLOBALS['sql_compatibility'] = 'MSSQL';
$GLOBALS['sql_auto_increment'] = true;
$GLOBALS['sql_drop_table'] = true;
@ -1300,136 +1097,6 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
'DROP FOREIGN KEY',
$GLOBALS['sql_drop_foreign_keys']
);
if ($restoreDrizzle !== "PMANORESTORE") {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**
* Test for ExportSql::getTableDef
*
* @return void
*/
public function testGetTableDefWithDrizzle()
{
$restoreDrizzle = 'PMANORESTORE';
if (!PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', true);
}
}
$GLOBALS['sql_auto_increment'] = true;
$GLOBALS['sql_drop_table'] = true;
$GLOBALS['sql_backquotes'] = true;
$GLOBALS['sql_if_not_exists'] = true;
$GLOBALS['sql_include_comments'] = true;
$GLOBALS['crlf'] = "\n";
if (isset($GLOBALS['sql_compatibility'])) {
unset($GLOBALS['sql_compatibility']);
}
if (isset($GLOBALS['sql_constraints'])) {
unset($GLOBALS['sql_constraints']);
}
$GLOBALS['no_constraints_comments'] = true;
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->at(0))
->method('query')
->with(
'SHOW TABLE STATUS FROM `db` WHERE Name = \'table\'', null,
PMA_DatabaseInterface::QUERY_STORE
)
->will($this->returnValue('res'));
$dbi->expects($this->once())
->method('numRows')
->with('res')
->will($this->returnValue(2));
$dbi->expects($this->once())
->method('fetchSingleRow')
->will($this->returnValue(array()));
$dbi->expects($this->any())
->method('fetchValue')
->will($this->returnValue(false));
$tmpres = array(
'Auto_increment' => 1,
'Create_time' => '2000-01-01 10:00:00',
'Update_time' => '2000-01-02 12:00:00',
'Check_time' => '2000-01-02 13:00:00',
);
$dbi->expects($this->once())
->method('fetchAssoc')
->with('res')
->will($this->returnValue($tmpres));
$dbi->expects($this->once())
->method('tryQuery')
->with('SHOW CREATE TABLE `db`.`table`')
->will($this->returnValue('res'));
$row = array(
'',
"CREATE TABLE `table` (\n" .
"`id` INT NOT NULL AUTO_INCREMENT,\n" .
"username VARCHAR(64) NULL,\n" .
"`password` VARCHAR(256) DEFAULT '123456',\n" .
"CONSTRAINT pk_id PRIMARY KEY (`id`),\n" .
"UNIQUE (username)\n" .
")"
);
$dbi->expects($this->once())
->method('fetchRow')
->with('res')
->will($this->returnValue($row));
$dbi->expects($this->once())
->method('getTable')
->will($this->returnValue(new PMA_Table('table', 'db')));
$GLOBALS['dbi'] = $dbi;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$result = $this->object->getTableDef(
'db', 'table', "\n", "example.com/err", true, true, false
);
$this->assertContains(
"CREATE TABLE IF NOT EXISTS `table`",
$result
);
$this->assertNotContains(
'-- Constraints for table',
$GLOBALS['sql_constraints']
);
$this->assertNotContains(
'-- Constraints for table "table"',
$GLOBALS['sql_constraints']
);
if ($restoreDrizzle !== "PMANORESTORE") {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**
@ -1439,19 +1106,6 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
*/
public function testGetTableDefWithError()
{
$restoreDrizzle = 'PMANORESTORE';
if (PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
}
}
$GLOBALS['sql_compatibility'] = '';
$GLOBALS['sql_auto_increment'] = true;
$GLOBALS['sql_drop_table'] = true;
@ -1533,10 +1187,6 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
'-- in use(error occurred)',
$result
);
if ($restoreDrizzle !== "PMANORESTORE") {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**

View File

@ -33,10 +33,6 @@ class PMA_ExportTexytext_Test extends PHPUnit_Framework_TestCase
*/
function setup()
{
if (!defined("PMA_DRIZZLE")) {
define("PMA_DRIZZLE", false);
}
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['buffer_needed'] = false;

View File

@ -33,10 +33,6 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
*/
function setup()
{
if (!defined("PMA_DRIZZLE")) {
define("PMA_DRIZZLE", false);
}
$GLOBALS['server'] = 0;
$GLOBALS['output_kanji_conversion'] = false;
$GLOBALS['buffer_needed'] = false;
@ -67,19 +63,6 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
*/
public function testSetProperties()
{
$restoreDrizzle = 'PMANORESTORE';
if (PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
}
}
$method = new ReflectionMethod('ExportXml', 'setProperties');
$method->setAccessible(true);
$method->invoke($this->object, null);
@ -212,10 +195,6 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
'BoolPropertyItem',
$property
);
if ($restoreDrizzle !== "PMANORESTORE") {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**
@ -224,25 +203,12 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
* @return void
* @group medium
*/
public function testExportHeaderWithoutDrizzle()
public function testExportHeader()
{
if (!defined("PMA_MYSQL_STR_VERSION")) {
define("PMA_MYSQL_STR_VERSION", "5.0.0");
}
$restoreDrizzle = 'PMANORESTORE';
if (PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
}
}
$GLOBALS['xml_export_functions'] = 1;
$GLOBALS['xml_export_contents'] = 1;
$GLOBALS['output_charset_conversion'] = 1;
@ -473,94 +439,6 @@ class PMA_ExportXml_Test extends PHPUnit_Framework_TestCase
' &lt;/pma:structure_schemas&gt;',
$result
);
if ($restoreDrizzle !== "PMANORESTORE") {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**
* Test for ExportXml::exportHeader
*
* @return void
*/
public function testExportHeaderWithDrizzle()
{
$restoreDrizzle = 'PMANORESTORE';
if (!PMA_DRIZZLE) {
if (!PMA_HAS_RUNKIT) {
$this->markTestSkipped(
"Cannot redefine constant. Missing runkit extension"
);
} else {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', true);
}
}
$GLOBALS['output_charset_conversion'] = false;
$GLOBALS['xml_export_triggers'] = true;
$GLOBALS['cfg']['Server']['port'] = 80;
$GLOBALS['cfg']['Server']['host'] = 'localhost';
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['crlf'] = "\n";
$GLOBALS['db'] = 'd<b';
$result = array(
0 => array(
'DEFAULT_COLLATION_NAME' => 'utf8_general_ci',
'DEFAULT_CHARACTER_SET_NAME' => 'utf-8',
),
'table' => array(null, '"tbl"')
);
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->at(0))
->method('fetchResult')
->with(
"SELECT
'utf8' AS DEFAULT_CHARACTER_SET_NAME,
DEFAULT_COLLATION_NAME
FROM data_dictionary.SCHEMAS
WHERE SCHEMA_NAME = 'd<b'"
)
->will($this->returnValue($result));
$dbi->expects($this->at(1))
->method('fetchResult')
->with(
'SHOW CREATE TABLE `d<b`.`table`',
0
)
->will($this->returnValue($result));
// isView
$dbi->expects($this->at(2))
->method('fetchResult')
->will($this->returnValue(false));
$dbi->expects($this->once())
->method('getTable')
->will($this->returnValue(new PMA_Table('table', 'd<b')));
$GLOBALS['dbi'] = $dbi;
$GLOBALS['tables'] = array();
$GLOBALS['table'] = 'table';
ob_start();
$this->assertTrue(
$this->object->exportHeader()
);
$result = ob_get_clean();
if ($restoreDrizzle !== "PMANORESTORE") {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**

View File

@ -134,18 +134,10 @@ class ImportCsv_Test extends PHPUnit_Framework_TestCase
$this->object->doImport();
//asset that all sql are executed
if (PMA_DRIZZLE) {
$this->assertContains(
'CREATE DATABASE IF NOT EXISTS `CSV_DB` COLLATE',
$sql_query
);
} else {
$this->assertContains(
'CREATE DATABASE IF NOT EXISTS `CSV_DB` DEFAULT CHARACTER',
$sql_query
);
}
$this->assertContains(
'CREATE DATABASE IF NOT EXISTS `CSV_DB` DEFAULT CHARACTER',
$sql_query
);
$this->assertContains(
'CREATE TABLE IF NOT EXISTS `CSV_DB`.`TBL_NAME`',
$sql_query
@ -196,17 +188,10 @@ class ImportCsv_Test extends PHPUnit_Framework_TestCase
$this->object->doImport();
//asset that all sql are executed
if (PMA_DRIZZLE) {
$this->assertContains(
'CREATE DATABASE IF NOT EXISTS `CSV_DB` COLLATE',
$sql_query
);
} else {
$this->assertContains(
'CREATE DATABASE IF NOT EXISTS `CSV_DB` DEFAULT CHARACTER',
$sql_query
);
}
$this->assertContains(
'CREATE DATABASE IF NOT EXISTS `CSV_DB` DEFAULT CHARACTER',
$sql_query
);
$this->assertContains(
'CREATE TABLE IF NOT EXISTS `CSV_DB`.`TBL_NAME`',

View File

@ -135,19 +135,11 @@ class ImportOds_Test extends PHPUnit_Framework_TestCase
//Test function called
$this->object->doImport();
//asset that all sql are executed
if (PMA_DRIZZLE) {
$this->assertContains(
'CREATE DATABASE IF NOT EXISTS `ODS_DB` COLLATE utf8_general_ci',
$sql_query
);
} else {
$this->assertContains(
'CREATE DATABASE IF NOT EXISTS `ODS_DB` DEFAULT CHARACTER SET '
. 'utf8 COLLATE utf8_general_ci',
$sql_query
);
}
$this->assertContains(
'CREATE DATABASE IF NOT EXISTS `ODS_DB` DEFAULT CHARACTER SET '
. 'utf8 COLLATE utf8_general_ci',
$sql_query
);
$this->assertContains(
'CREATE TABLE IF NOT EXISTS `ODS_DB`.`pma_bookmark`',
$sql_query

View File

@ -42,19 +42,6 @@ class ImportShp_Test extends PHPUnit_Framework_TestCase
*/
protected function setUp()
{
// Drizzle does not support GIS data types
if (!defined("PMA_DRIZZLE")) {
define("PMA_DRIZZLE", false);
} else if (PMA_DRIZZLE) {
//PMA_DRIZZLE is defined and PMA_DRIZZLE = true
if (PMA_HAS_RUNKIT) {
runkit_constant_redefine("PMA_DRIZZLE", false);
} else {
//Drizzle does not support GIS data types
$this->markTestSkipped("Drizzle does not support GIS data types");
}
}
//setting
$GLOBALS['plugin_param'] = 'table';
$GLOBALS['finished'] = false;

View File

@ -49,32 +49,7 @@ class PMA_Tracker_Test extends PHPUnit_Framework_TestCase
'db' => 'pmadb',
'tracking' => 'tracking'
);
if (!defined("PMA_DRIZZLE")) {
define("PMA_DRIZZLE", false);
} elseif (PMA_DRIZZLE) {
if (PMA_HAS_RUNKIT) {
runkit_constant_redefine("PMA_DRIZZLE", false);
} else {
$this->markTestSkipped("Cannot redefine constant");
}
}
}
/**
* tearDown function for test cases
*
* @access protected
* @return void
*/
protected function tearDown()
{
if (PMA_HAS_RUNKIT) {
runkit_constant_redefine("PMA_DRIZZLE", false);
}
}
/**
* Test for PMA_Tracker::enable
*
@ -602,70 +577,6 @@ class PMA_Tracker_Test extends PHPUnit_Framework_TestCase
$this->testChangeTracking('pma_db', 'pma_tbl', '0.1', '0', 'deactivate');
}
/**
* Test for PMA_Tracker::getVersion()
*
* @return void
* @test
*/
public function testGetVersion()
{
if (! PMA_HAS_RUNKIT) {
$this->markTestSkipped("Cannot redefine constant");
}
runkit_constant_redefine("PMA_DRIZZLE", true);
$sql_query = " SELECT MAX(version) FROM `pmadb`.`tracking`" .
" WHERE `db_name` = 'pma''db' " .
" AND `table_name` = 'pma''table' ";
$sql_query_drizzle = ' AND tracking & 1 <> 0';
$sql_query_non_drizzle = " AND FIND_IN_SET('UPDATE',tracking) > 0" ;
$GLOBALS['controllink'] = null;
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$dbi->expects($this->at(0))
->method('query')
->with($sql_query . $sql_query_drizzle, null, 0, false)
->will($this->returnValue("executed_1"));
$dbi->expects($this->at(1))
->method('fetchArray')
->with("executed_1")
->will($this->returnValue(array("executed_3")));
$dbi->expects($this->at(2))
->method('query')
->with($sql_query . $sql_query_non_drizzle, null, 0, false)
->will($this->returnValue("executed_2"));
$dbi->expects($this->at(3))
->method('fetchArray')
->with("executed_2")
->will($this->returnValue(array()));
$GLOBALS['dbi'] = $dbi;
// first assertion
$this->assertEquals(
"executed_3",
PMA_Tracker::getVersion("pma'db", "pma'table", "UPDATE")
);
// second assertion
runkit_constant_redefine("PMA_DRIZZLE", false);
$this->assertEquals(
-1,
PMA_Tracker::getVersion("pma'db", "pma'table", "UPDATE")
);
}
/**
* Test for PMA_Tracker::getTrackedData()
*
@ -987,32 +898,4 @@ class PMA_Tracker_Test extends PHPUnit_Framework_TestCase
return $query;
}
/**
* Test for PMA_Tracker::_transformTrackingSet
*
* @return void
* @test
*/
public function testTransformTrackingSet()
{
if (! PMA_HAS_RUNKIT) {
$this->markTestSkipped("Cannot redefine constant");
}
runkit_constant_redefine("PMA_DRIZZLE", true);
$method = new \ReflectionMethod("PMA_Tracker", "_transformTrackingSet");
$method->setAccessible(true);
$this->assertEquals(
$method->invoke(null, "CREATE DATABASE,ALTER DATABASE,DROP DATABASE"),
224
);
$this->assertEquals(
$method->invoke(null, 224),
"CREATE DATABASE,ALTER DATABASE,DROP DATABASE"
);
}
}

View File

@ -3072,27 +3072,5 @@ class PMA_InsertEditTest extends PHPUnit_Framework_TestCase
'bar',
$actual
);
// Drizzle
$table_columns = array(
array(
'Field' => 'foo',
'Type' => 'longtext',
'Null' => 'Yes',
'pma_type' => 'longtext',
'True_Type' => 'longtext',
'Privileges' => null,
)
);
$actual = PMA_getHtmlForInsertEditRow(
array(), $table_columns, array(), false, array(), '', '',
'', false, array(), $o_rows, $tabindex, 1, false, 0,
array(), 0, 0, 'table', 'db', 0, array(), 0, '',
array(), array('wc')
);
$this->assertContains(
'foo',
$actual
);
}
}

View File

@ -22,7 +22,6 @@ class PMA_MySQL_Charsets_Test extends PHPUnit_Framework_TestCase
/**
* Test for PMA_generateCharsetQueryPart
*
* @param bool $drizzle Value for PMA_DRIZZLE
* @param string $collation Collation
* @param string $expected Expected Charset Query
*
@ -30,35 +29,11 @@ class PMA_MySQL_Charsets_Test extends PHPUnit_Framework_TestCase
* @test
* @dataProvider charsetQueryData
*/
public function testGenerateCharsetQueryPart(
$drizzle, $collation, $expected
) {
if (! PMA_HAS_RUNKIT) {
$this->markTestSkipped(
'Cannot redefine constant - missing runkit extension'
);
}
$restoreDrizzle = '';
if (defined('PMA_DRIZZLE')) {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', $drizzle);
} else {
$restoreDrizzle = 'PMA_TEST_CONSTANT_REMOVE';
define('PMA_DRIZZLE', $drizzle);
}
public function testGenerateCharsetQueryPart($collation, $expected) {
$this->assertEquals(
$expected,
PMA_generateCharsetQueryPart($collation)
);
if ($restoreDrizzle === 'PMA_TEST_CONSTANT_REMOVE') {
runkit_constant_remove('PMA_DRIZZLE');
} else {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
/**
@ -69,10 +44,9 @@ class PMA_MySQL_Charsets_Test extends PHPUnit_Framework_TestCase
public function charsetQueryData()
{
return array(
array(false, "a_b_c_d", " CHARACTER SET a COLLATE a_b_c_d"),
array(false, "a_", " CHARACTER SET a COLLATE a_"),
array(false, "a", " CHARACTER SET a"),
array(true, "a_b_c_d", " COLLATE a_b_c_d")
array("a_b_c_d", " CHARACTER SET a COLLATE a_b_c_d"),
array("a_", " CHARACTER SET a COLLATE a_"),
array("a", " CHARACTER SET a"),
);
}
@ -85,61 +59,20 @@ class PMA_MySQL_Charsets_Test extends PHPUnit_Framework_TestCase
*/
public function testGetDbCollation()
{
if (! PMA_HAS_RUNKIT) {
$this->markTestSkipped(
'Cannot redefine constant - missing runkit extension'
);
} else {
$GLOBALS['server'] = 1;
// test case for system schema
$this->assertEquals(
'utf8_general_ci',
PMA_getDbCollation("information_schema")
);
$GLOBALS['server'] = 1;
// test case for system schema
$this->assertEquals(
'utf8_general_ci',
PMA_getDbCollation("information_schema")
);
$restoreDrizzle = '';
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['cfg']['DBG']['sql'] = false;
// test case with no pma drizzle
if (defined('PMA_DRIZZLE')) {
$restoreDrizzle = PMA_DRIZZLE;
runkit_constant_redefine('PMA_DRIZZLE', false);
} else {
$restoreDrizzle = 'PMA_TEST_CONSTANT_REMOVE';
define('PMA_DRIZZLE', false);
}
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['cfg']['DBG']['sql'] = false;
$this->assertEquals(
'utf8_general_ci',
PMA_getDbCollation('pma_test')
);
// test case with pma drizzle as true
runkit_constant_redefine('PMA_DRIZZLE', true);
$this->assertEquals(
'utf8_general_ci_pma_drizzle',
PMA_getDbCollation('pma_test')
);
$GLOBALS['cfg']['Server']['DisableIS'] = true;
$GLOBALS['db'] = 'pma_test2';
$this->assertEquals(
'bar',
PMA_getDbCollation('pma_test')
);
$this->assertNotEquals(
'pma_test',
$GLOBALS['dummy_db']
);
if ($restoreDrizzle === 'PMA_TEST_CONSTANT_REMOVE') {
runkit_constant_remove('PMA_DRIZZLE');
} else {
runkit_constant_redefine('PMA_DRIZZLE', $restoreDrizzle);
}
}
$this->assertEquals(
'utf8_general_ci',
PMA_getDbCollation('pma_test')
);
}
/**

View File

@ -1,148 +0,0 @@
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for server_plugins.lib.php
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/Util.class.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/url_generating.lib.php';
require_once 'libraries/server_plugins.lib.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/database_interface.inc.php';
require_once 'libraries/Message.class.php';
require_once 'libraries/sanitizing.lib.php';
require_once 'libraries/js_escape.lib.php';
/**
* PMA_ServerPlugins_Test class
*
* this class is for testing server_plugins.lib.php functions
*
* @package PhpMyAdmin-test
*/
class PMA_ServerPlugins_Test extends PHPUnit_Framework_TestCase
{
/**
* Prepares environment for the test.
*
* @return void
*/
public function setUp()
{
//$_REQUEST
$_REQUEST['log'] = "index1";
$_REQUEST['pos'] = 3;
//$GLOBALS
$GLOBALS['cfg']['MaxRows'] = 10;
$GLOBALS['cfg']['ServerDefault'] = "server";
$GLOBALS['cfg']['RememberSorting'] = true;
$GLOBALS['cfg']['SQP'] = array();
$GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
$GLOBALS['cfg']['ShowSQL'] = true;
$GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
$GLOBALS['cfg']['LimitChars'] = 100;
$GLOBALS['cfg']['DBG']['sql'] = false;
$GLOBALS['table'] = "table";
$GLOBALS['pmaThemeImage'] = 'image';
//$_SESSION
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
$_SESSION['PMA_Theme'] = new PMA_Theme();
}
/**
* Test for PMA_getPluginAndModuleInfo
*
* @return void
*/
public function testPMAGetPluginAndModuleInfo()
{
//Mock DBI
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();
$GLOBALS['dbi'] = $dbi;
//Call the test function
/**
* Prepare plugin list
*/
$plugins = array();
$row = array();
$row["plugin_name"] = "plugin_name1";
$row["plugin_type"] = "plugin_type1";
$row["module_name"] = "module_name1";
$row["module_library"] = "module_library1";
$row["module_version"] = "module_version1";
$row["module_author"] = "module_author1";
$row["module_license"] = "module_license1";
$row["module_description"] = "module_description1";
$row["is_active"] = true;
$plugins[$row['plugin_type']][] = $row;
$html = PMA_getPluginTab($plugins);
//validate 1:Items
$this->assertContains(
'<th>Plugin</th>',
$html
);
$this->assertContains(
'<th>Module</th>',
$html
);
$this->assertContains(
'<th>Library</th>',
$html
);
$this->assertContains(
'<th>Version</th>',
$html
);
$this->assertContains(
'<th>Author</th>',
$html
);
$this->assertContains(
'<th>License</th>',
$html
);
//validate 2: one Item HTML
$this->assertContains(
'<th>plugin_name1</th>',
$html
);
$this->assertContains(
'<td>module_name1</td>',
$html
);
$this->assertContains(
'<td>module_library1</td>',
$html
);
$this->assertContains(
'<td>module_version1</td>',
$html
);
$this->assertContains(
'<td>module_author1</td>',
$html
);
$this->assertContains(
'<td>module_license1</td>',
$html
);
}
}