Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
cfe9c2ed24
@ -2,6 +2,7 @@ phpMyAdmin - ChangeLog
|
||||
======================
|
||||
|
||||
4.2.0.0 (not yet released)
|
||||
+ rfe #1403 Export only triggers
|
||||
+ rfe #1483 Export Server/Database/Table without triggers
|
||||
+ rfe #1662 Add table comment tool tip in database structure page
|
||||
+ rfe #1447 Single table for display Character Sets and Collations
|
||||
|
||||
@ -109,6 +109,8 @@ if (!defined('TESTSUITE')) {
|
||||
'sql_drop_table',
|
||||
'sql_procedure_function',
|
||||
'sql_create_table_statements',
|
||||
'sql_create_table',
|
||||
'sql_create_view',
|
||||
'sql_create_trigger',
|
||||
'sql_if_not_exists',
|
||||
'sql_auto_increment',
|
||||
|
||||
@ -1820,6 +1820,20 @@ $cfg['Export']['sql_if_not_exists'] = true;
|
||||
*/
|
||||
$cfg['Export']['sql_procedure_function'] = true;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @global boolean $cfg['Export']['sql_create_table']
|
||||
*/
|
||||
$cfg['Export']['sql_create_table'] = true;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @global boolean $cfg['Export']['sql_create_view']
|
||||
*/
|
||||
$cfg['Export']['sql_create_view'] = true;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
|
||||
@ -171,6 +171,8 @@ $strConfigExport_sql_views_as_tables_name = __('Export views as tables');
|
||||
$strConfigExport_sql_drop_database_name = sprintf(__('Add %s'), 'DROP DATABASE');
|
||||
$strConfigExport_sql_drop_table_name
|
||||
= sprintf(__('Add %s'), 'DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT / TRIGGER');
|
||||
$strConfigExport_sql_create_table_name = sprintf(__('Add %s'), 'CREATE TABLE');
|
||||
$strConfigExport_sql_create_view_name = sprintf(__('Add %s'), 'CREATE VIEW');
|
||||
$strConfigExport_sql_create_trigger_name
|
||||
= sprintf(__('Add %s'), 'CREATE TRIGGER');
|
||||
$strConfigExport_sql_hex_for_blob_name = __('Use hexadecimal for BLOB');
|
||||
|
||||
@ -301,6 +301,8 @@ $forms['Export']['Sql'] = array('Export' => array(
|
||||
':group:' . __('Structure'),
|
||||
'sql_drop_table',
|
||||
'sql_procedure_function',
|
||||
'sql_create_table',
|
||||
'sql_create_view',
|
||||
'sql_create_trigger',
|
||||
'sql_create_table_statements' => ':group',
|
||||
'sql_if_not_exists',
|
||||
|
||||
@ -200,6 +200,8 @@ $forms['Export']['Sql'] = array(
|
||||
':group:' . __('Structure'),
|
||||
'Export/sql_drop_table',
|
||||
'Export/sql_procedure_function',
|
||||
'Export/sql_create_table',
|
||||
'Export/sql_create_view',
|
||||
'Export/sql_create_trigger',
|
||||
'Export/sql_create_table_statements' => ':group',
|
||||
'Export/sql_if_not_exists',
|
||||
|
||||
@ -532,13 +532,31 @@ function PMA_exportDatabase(
|
||||
) {
|
||||
// for a view, export a stand-in definition of the table
|
||||
// to resolve view dependencies
|
||||
if (! $export_plugin->exportStructure(
|
||||
$db, $table, $crlf, $err_url,
|
||||
$is_view ? 'stand_in' : 'create_table', $export_type,
|
||||
$do_relation, $do_comments, $do_mime, $do_dates
|
||||
)) {
|
||||
break 1;
|
||||
|
||||
if ($is_view) {
|
||||
|
||||
if (isset($GLOBALS['sql_create_view'])) {
|
||||
if (! $export_plugin->exportStructure(
|
||||
$db, $table, $crlf, $err_url,
|
||||
'stand_in', $export_type,
|
||||
$do_relation, $do_comments, $do_mime, $do_dates
|
||||
)) {
|
||||
break 1;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (isset($GLOBALS['sql_create_table'])) {
|
||||
|
||||
if (! $export_plugin->exportStructure(
|
||||
$db, $table, $crlf, $err_url,
|
||||
'create_table', $export_type,
|
||||
$do_relation, $do_comments, $do_mime, $do_dates
|
||||
)) {
|
||||
break 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// if this is a view or a merge table, don't export data
|
||||
if (($whatStrucOrData == 'data'
|
||||
@ -567,19 +585,24 @@ function PMA_exportDatabase(
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($views as $view) {
|
||||
// no data export for a view
|
||||
if ($whatStrucOrData == 'structure'
|
||||
|| $whatStrucOrData == 'structure_and_data'
|
||||
) {
|
||||
if (! $export_plugin->exportStructure(
|
||||
$db, $view, $crlf, $err_url,
|
||||
'create_view', $export_type,
|
||||
$do_relation, $do_comments, $do_mime, $do_dates
|
||||
)) {
|
||||
break 1;
|
||||
|
||||
if (isset($GLOBALS['sql_create_view'])) {
|
||||
|
||||
foreach ($views as $view) {
|
||||
// no data export for a view
|
||||
if ($whatStrucOrData == 'structure'
|
||||
|| $whatStrucOrData == 'structure_and_data'
|
||||
) {
|
||||
if (! $export_plugin->exportStructure(
|
||||
$db, $view, $crlf, $err_url,
|
||||
'create_view', $export_type,
|
||||
$do_relation, $do_comments, $do_mime, $do_dates
|
||||
)) {
|
||||
break 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (! $export_plugin->exportDBFooter($db)) {
|
||||
@ -632,13 +655,31 @@ function PMA_exportTable(
|
||||
if ($whatStrucOrData == 'structure'
|
||||
|| $whatStrucOrData == 'structure_and_data'
|
||||
) {
|
||||
if (! $export_plugin->exportStructure(
|
||||
$db, $table, $crlf, $err_url,
|
||||
$is_view ? 'create_view' : 'create_table', $export_type,
|
||||
$do_relation, $do_comments, $do_mime, $do_dates
|
||||
)) {
|
||||
return;
|
||||
|
||||
if ($is_view) {
|
||||
|
||||
if (isset($GLOBALS['sql_create_view'])) {
|
||||
if (! $export_plugin->exportStructure(
|
||||
$db, $table, $crlf, $err_url,
|
||||
'create_view', $export_type,
|
||||
$do_relation, $do_comments, $do_mime, $do_dates
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (isset($GLOBALS['sql_create_table'])) {
|
||||
|
||||
if (! $export_plugin->exportStructure(
|
||||
$db, $table, $crlf, $err_url,
|
||||
'create_table', $export_type,
|
||||
$do_relation, $do_comments, $do_mime, $do_dates
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// If this is an export of a single view, we have to export data;
|
||||
// for example, a PDF report
|
||||
|
||||
@ -259,6 +259,23 @@ class ExportSql extends ExportPlugin
|
||||
$leaf->setName('drop_table');
|
||||
$leaf->setText(sprintf(__('Add %s statement'), $drop_clause));
|
||||
$subgroup->addProperty($leaf);
|
||||
|
||||
// Add table structure option
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('create_table');
|
||||
$leaf->setText(
|
||||
sprintf(__('Add %s statement'), '<code>CREATE TABLE</code>')
|
||||
);
|
||||
$subgroup->addProperty($leaf);
|
||||
|
||||
// Add view option
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('create_view');
|
||||
$leaf->setText(
|
||||
sprintf(__('Add %s statement'), '<code>CREATE VIEW</code>')
|
||||
);
|
||||
$subgroup->addProperty($leaf);
|
||||
|
||||
// Drizzle doesn't support procedures and functions
|
||||
if (! PMA_DRIZZLE) {
|
||||
$leaf = new BoolPropertyItem();
|
||||
|
||||
@ -265,6 +265,18 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
|
||||
'<code> / EVENT</code><code> / TRIGGER</code> statement',
|
||||
$leaf->getText()
|
||||
);
|
||||
|
||||
$leaf = array_shift($leaves);
|
||||
$this->assertInstanceOf(
|
||||
'BoolPropertyItem',
|
||||
$leaf
|
||||
);
|
||||
|
||||
$leaf = array_shift($leaves);
|
||||
$this->assertInstanceOf(
|
||||
'BoolPropertyItem',
|
||||
$leaf
|
||||
);
|
||||
|
||||
$leaf = array_shift($leaves);
|
||||
$this->assertInstanceOf(
|
||||
@ -405,7 +417,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
|
||||
$properties = $properties[0]->getProperties();
|
||||
|
||||
$this->assertCount(
|
||||
4,
|
||||
6,
|
||||
$properties
|
||||
);
|
||||
|
||||
@ -747,6 +759,8 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['sql_drop_database'] = true;
|
||||
$GLOBALS['sql_backquotes'] = true;
|
||||
$GLOBALS['sql_create_database'] = true;
|
||||
$GLOBALS['sql_create_table'] = true;
|
||||
$GLOBALS['sql_create_view'] = true;
|
||||
$GLOBALS['crlf'] = "\n";
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user