Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The DisableIS directive is being deprecated
  • Loading branch information
lem9 committed Nov 5, 2013
1 parent 2ac444a commit 57ef25e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 41 deletions.
28 changes: 8 additions & 20 deletions libraries/mysql_charsets.lib.php
Expand Up @@ -95,26 +95,14 @@ function PMA_getDbCollation($db)
return 'utf8_general_ci';
}

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'
. ' WHERE SCHEMA_NAME = \'' . PMA_Util::sqlAddSlashes($db)
. '\' LIMIT 1';
return $GLOBALS['dbi']->fetchValue($sql);
} else {
$GLOBALS['dbi']->selectDb($db);
$return = $GLOBALS['dbi']->fetchValue(
'SHOW VARIABLES LIKE \'collation_database\'', 0, 1
);
if ($db !== $GLOBALS['db']) {
$GLOBALS['dbi']->selectDb($GLOBALS['db']);
}
return $return;
}
$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'
. ' WHERE SCHEMA_NAME = \'' . PMA_Util::sqlAddSlashes($db)
. '\' LIMIT 1';
return $GLOBALS['dbi']->fetchValue($sql);
}

/**
Expand Down
15 changes: 1 addition & 14 deletions test/classes/plugin/export/PMA_ExportSql_test.php
Expand Up @@ -778,18 +778,12 @@ public function testExportDBCreate()

// case2: no backquotes
unset($GLOBALS['sql_compatibility']);
$GLOBALS['cfg']['Server']['DisableIS'] = true;
unset($GLOBALS['sql_backquotes']);

$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
->disableOriginalConstructor()
->getMock();

$dbi->expects($this->once())
->method('fetchValue')
->with('SHOW VARIABLES LIKE \'collation_database\'', 0, 1)
->will($this->returnValue('testcollation'));

$GLOBALS['dbi'] = $dbi;

ob_start();
Expand All @@ -804,7 +798,7 @@ public function testExportDBCreate()
);

$this->assertContains(
'CREATE DATABASE IF NOT EXISTS db DEFAULT CHARACTER SET testcollation;',
'CREATE DATABASE IF NOT EXISTS db',
$result
);

Expand Down Expand Up @@ -1196,7 +1190,6 @@ public function testGetTableDefWithoutDrizzle()
->will($this->returnValue($row));

$GLOBALS['dbi'] = $dbi;
$GLOBALS['cfg']['Server']['DisableIS'] = false;

$result = $this->object->getTableDef(
'db', 'table', "\n", "example.com/err", true, true, true
Expand Down Expand Up @@ -1373,7 +1366,6 @@ public function testGetTableDefWithDrizzle()
->will($this->returnValue($row));

$GLOBALS['dbi'] = $dbi;
$GLOBALS['cfg']['Server']['DisableIS'] = false;

$result = $this->object->getTableDef(
'db', 'table', "\n", "example.com/err", true, true, true
Expand Down Expand Up @@ -1496,7 +1488,6 @@ public function testGetTableDefWithError()
->will($this->returnValue('error occurred'));

$GLOBALS['dbi'] = $dbi;
$GLOBALS['cfg']['Server']['DisableIS'] = false;

$result = $this->object->getTableDef(
'db', 'table', "\n", "example.com/err", true, true, true
Expand Down Expand Up @@ -1839,7 +1830,6 @@ public function testExportData()
$GLOBALS['sql_truncate'] = true;
$GLOBALS['sql_insert_syntax'] = 'both';
$GLOBALS['sql_hex_for_blob'] = true;
$GLOBALS['cfg']['Server']['DisableIS'] = false;

ob_start();
$this->object->exportData(
Expand Down Expand Up @@ -1954,7 +1944,6 @@ public function testExportDataWithUpdate()
$GLOBALS['sql_truncate'] = true;
$GLOBALS['sql_insert_syntax'] = 'both';
$GLOBALS['sql_hex_for_blob'] = true;
$GLOBALS['cfg']['Server']['DisableIS'] = false;

ob_start();
$this->object->exportData(
Expand Down Expand Up @@ -1987,7 +1976,6 @@ public function testExportDataWithIsView()
->will($this->returnValue(true));

$GLOBALS['dbi'] = $dbi;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['sql_views_as_tables'] = false;
$GLOBALS['sql_include_comments'] = true;
$GLOBALS['crlf'] = "\n";
Expand Down Expand Up @@ -2025,7 +2013,6 @@ public function testExportDataWithError()
->will($this->returnValue('err'));

$GLOBALS['dbi'] = $dbi;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['sql_views_as_tables'] = true;
$GLOBALS['sql_include_comments'] = true;
$GLOBALS['crlf'] = "\n";
Expand Down
7 changes: 0 additions & 7 deletions test/libraries/PMA_mysql_charsets_test.php
Expand Up @@ -108,7 +108,6 @@ public function testGetDbCollation()
define('PMA_DRIZZLE', false);
}

$GLOBALS['cfg']['Server']['DisableIS'] = false;
$GLOBALS['cfg']['DBG']['sql'] = false;

$this->assertEquals(
Expand All @@ -123,12 +122,6 @@ public function testGetDbCollation()
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']
Expand Down

0 comments on commit 57ef25e

Please sign in to comment.