24
23
$plugin_list['sql'] = array(
26
25
'extension' => 'sql',
27
26
'mime_type' => 'text/x-sql',
29
array('type' => 'text', 'name' => 'header_comment', 'text' => 'strAddHeaderComment'),
30
array('type' => 'bool', 'name' => 'include_comments', 'text' => 'strComments'),
31
array('type' => 'bool', 'name' => 'use_transaction', 'text' => 'strEncloseInTransaction'),
32
array('type' => 'bool', 'name' => 'disable_fk', 'text' => 'strDisableForeignChecks'),
34
'options_text' => 'strOptions',
27
'options' => array());
29
$plugin_list['sql']['options'][] = array('type' => 'begin_group', 'name' => 'general_opts');
32
$plugin_list['sql']['options'][] =
33
array('type' => 'begin_subgroup', 'subgroup_header' => array('type' => 'bool', 'name' => 'include_comments', 'text' => __('Display comments <i>(includes info such as export timestamp, PHP version, and server version)</i>')));
34
$plugin_list['sql']['options'][] =
35
array('type' => 'text', 'name' => 'header_comment', 'text' => __('Additional custom header comment (\n splits lines):'));
36
$plugin_list['sql']['options'][] =
37
array('type' => 'bool', 'name' => 'dates', 'text' => __('Include a timestamp of when databases were created, last updated, and last checked'));
38
if (!empty($GLOBALS['cfgRelation']['relation'])) {
39
$plugin_list['sql']['options'][] =
40
array('type' => 'bool', 'name' => 'relation', 'text' => __('Display foreign key relationships'));
42
if (!empty($GLOBALS['cfgRelation']['mimework'])) {
43
$plugin_list['sql']['options'][] =
44
array('type' => 'bool', 'name' => 'mime', 'text' => __('Display MIME types'));
46
$plugin_list['sql']['options'][] = array('type' => 'end_subgroup');
49
/* enclose in a transaction */
50
$plugin_list['sql']['options'][] = array('type' => 'bool', 'name' => 'use_transaction', 'text' => __('Enclose export in a transaction'), 'doc' => array('programs', 'mysqldump', 'option_mysqldump_single-transaction'));
52
/* disable foreign key checks */
53
$plugin_list['sql']['options'][] = array('type' => 'bool', 'name' => 'disable_fk', 'text' => __('Disable foreign key checks'), 'doc' => array('manual_MySQL_Database_Administration', 'server-system-variables', 'sysvar_foreign_key_checks'));
55
$plugin_list['sql']['options_text'] = __('Options');
57
/* compatibility maximization */
36
58
$compats = PMA_DBI_getCompatibilities();
37
59
if (count($compats) > 0) {
40
62
$values[$val] = $val;
42
64
$plugin_list['sql']['options'][] =
43
array('type' => 'select', 'name' => 'compatibility', 'text' => 'strSQLCompatibility', 'values' => $values, 'doc' => array('manual_MySQL_Database_Administration', 'Server_SQL_mode'));
65
array('type' => 'select', 'name' => 'compatibility', 'text' => __('Database system or older MySQL server to maximize output compatibility with:'), 'values' => $values, 'doc' => array('manual_MySQL_Database_Administration', 'Server_SQL_mode'));
47
/* Server export options */
69
/* server export options */
48
70
if ($plugin_param['export_type'] == 'server') {
49
$plugin_list['sql']['options'][] =
50
array('type' => 'bgroup', 'text' => 'strDatabaseExportOptions');
51
$plugin_list['sql']['options'][] =
52
array('type' => 'bool', 'name' => 'drop_database', 'text' => sprintf($GLOBALS['strAddClause'], 'DROP DATABASE'));
53
$plugin_list['sql']['options'][] =
54
array('type' => 'egroup');
57
/* Structure options */
58
if (!$hide_structure) {
59
$plugin_list['sql']['options'][] =
60
array('type' => 'bgroup', 'name' => 'structure', 'text' => 'strStructure', 'force' => 'data');
61
if ($plugin_param['export_type'] == 'table') {
71
$plugin_list['sql']['options'][] =
72
array('type' => 'bool', 'name' => 'drop_database', 'text' => sprintf(__('Add %s statement'), '<code>DROP DATABASE</code>'));
75
/* what to dump (structure/data/both) */
76
$plugin_list['sql']['options'][] =
77
array('type' => 'begin_subgroup', 'subgroup_header' => array('type' => 'message_only', 'text' => __('Dump table')));
78
$plugin_list['sql']['options'][] =
79
array('type' => 'radio', 'name' => 'structure_or_data', 'values' => array('structure' => __('structure'), 'data' => __('data'), 'structure_and_data' => __('structure and data')));
80
$plugin_list['sql']['options'][] = array('type' => 'end_subgroup');
82
$plugin_list['sql']['options'][] = array('type' => 'end_group');
84
/* begin Structure options */
85
if (!$hide_structure) {
86
$plugin_list['sql']['options'][] =
87
array('type' => 'begin_group', 'name' => 'structure', 'text' => __('Object creation options'), 'force' => 'data');
89
/* begin SQL Statements */
90
$plugin_list['sql']['options'][] =
91
array('type' => 'begin_subgroup', 'subgroup_header' => array('type' => 'message_only', 'name' => 'add_statements', 'text' => __('Add statements:')));
92
if ($plugin_param['export_type'] == 'table') {
62
93
if (PMA_Table::isView($GLOBALS['db'], $GLOBALS['table'])) {
63
$drop_clause = 'DROP VIEW';
94
$drop_clause = '<code>DROP VIEW</code>';
65
$drop_clause = 'DROP TABLE';
96
$drop_clause = '<code>DROP TABLE</code>';
68
$drop_clause = 'DROP TABLE / VIEW / PROCEDURE / FUNCTION';
69
if (PMA_MYSQL_INT_VERSION > 50100) {
70
$drop_clause .= ' / EVENT';
99
$drop_clause = '<code>DROP TABLE / VIEW / PROCEDURE / FUNCTION</code>';
100
if (PMA_MYSQL_INT_VERSION > 50100) {
101
$drop_clause .= '<code> / EVENT</code>';
73
104
$plugin_list['sql']['options'][] =
74
array('type' => 'bool', 'name' => 'drop_table', 'text' => sprintf($GLOBALS['strAddClause'], $drop_clause));
75
$plugin_list['sql']['options'][] =
76
array('type' => 'bool', 'name' => 'if_not_exists', 'text' => sprintf($GLOBALS['strAddClause'], 'IF NOT EXISTS'));
77
$plugin_list['sql']['options'][] =
78
array('type' => 'bool', 'name' => 'auto_increment', 'text' => 'strAddAutoIncrement');
79
$plugin_list['sql']['options'][] =
80
array('type' => 'bool', 'name' => 'backquotes', 'text' => 'strUseBackquotes');
81
$plugin_list['sql']['options'][] =
82
array('type' => 'bool', 'name' => 'procedure_function', 'text' => sprintf($GLOBALS['strAddClause'], 'CREATE PROCEDURE / FUNCTION' . (PMA_MYSQL_INT_VERSION > 50100 ? ' / EVENT' : '')));
85
$plugin_list['sql']['options'][] =
86
array('type' => 'bgroup', 'text' => 'strAddIntoComments');
87
$plugin_list['sql']['options'][] =
88
array('type' => 'bool', 'name' => 'dates', 'text' => 'strCreationDates');
89
if (!empty($GLOBALS['cfgRelation']['relation'])) {
90
$plugin_list['sql']['options'][] =
91
array('type' => 'bool', 'name' => 'relation', 'text' => 'strRelations');
93
if (!empty($GLOBALS['cfgRelation']['mimework'])) {
94
$plugin_list['sql']['options'][] =
95
array('type' => 'bool', 'name' => 'mime', 'text' => 'strMIME_MIMEtype');
97
$plugin_list['sql']['options'][] =
98
array('type' => 'egroup');
100
$plugin_list['sql']['options'][] =
101
array('type' => 'egroup');
105
array('type' => 'bool', 'name' => 'drop_table', 'text' => sprintf(__('Add %s statement'), $drop_clause));
106
$plugin_list['sql']['options'][] =
107
array('type' => 'bool', 'name' => 'procedure_function', 'text' => sprintf(__('Add %s statement'), '<code>CREATE PROCEDURE / FUNCTION' . (PMA_MYSQL_INT_VERSION > 50100 ? ' / EVENT</code>' : '</code>')));
109
/* begin CREATE TABLE statements*/
110
$plugin_list['sql']['options'][] =
111
array('type' => 'begin_subgroup', 'subgroup_header' => array('type' => 'bool', 'name' => 'create_table_statements', 'text' => __('<code>CREATE TABLE</code> options:')));
112
$plugin_list['sql']['options'][] =
113
array('type' => 'bool', 'name' => 'if_not_exists', 'text' => '<code>IF NOT EXISTS</code>');
114
$plugin_list['sql']['options'][] =
115
array('type' => 'bool', 'name' => 'auto_increment', 'text' => '<code>AUTO_INCREMENT</code>');
116
$plugin_list['sql']['options'][] = array('type' => 'end_subgroup');
117
/* end CREATE TABLE statements */
119
$plugin_list['sql']['options'][] = array('type' => 'end_subgroup');
120
/* end SQL statements */
122
$plugin_list['sql']['options'][] =
123
array('type' => 'bool', 'name' => 'backquotes', 'text' => __('Enclose table and field names with backquotes <i>(Protects field and table names formed with special characters or keywords)</i>'));
125
$plugin_list['sql']['options'][] =
126
array('type' => 'end_group');
105
$plugin_list['sql']['options'][] =
106
array('type' => 'bgroup', 'name' => 'data', 'text' => 'strData', 'force' => 'structure');
107
$plugin_list['sql']['options'][] =
108
array('type' => 'bool', 'name' => 'columns', 'text' => 'strCompleteInserts', 'doc' => array('programs', 'mysqldump', 'option_mysqldump_complete-insert-option'));
109
$plugin_list['sql']['options'][] =
110
array('type' => 'bool', 'name' => 'extended', 'text' => 'strExtendedInserts', 'doc' => array('programs', 'mysqldump', 'option_mysqldump_extended-insert-option'));
111
$plugin_list['sql']['options'][] =
112
array('type' => 'text', 'name' => 'max_query_size', 'text' => 'strMaximalQueryLength');
113
$plugin_list['sql']['options'][] =
114
array('type' => 'bool', 'name' => 'delayed', 'text' => 'strDelayedInserts');
115
$plugin_list['sql']['options'][] =
116
array('type' => 'bool', 'name' => 'ignore', 'text' => 'strIgnoreInserts');
117
$plugin_list['sql']['options'][] =
118
array('type' => 'bool', 'name' => 'hex_for_blob', 'text' => 'strHexForBLOB');
119
$plugin_list['sql']['options'][] =
120
array('type' => 'select', 'name' => 'type', 'text' => 'strSQLExportType', 'values' => array('INSERT' => 'INSERT', 'UPDATE' => 'UPDATE', 'REPLACE' => 'REPLACE'));
121
$plugin_list['sql']['options'][] =
122
array('type' => 'egroup');
128
/* end Structure options */
130
/* begin Data options */
131
$plugin_list['sql']['options'][] =
132
array('type' => 'begin_group', 'name' => 'data', 'text' => __('Data dump options'), 'force' => 'structure');
134
/* begin SQL statements */
135
$plugin_list['sql']['options'][] =
136
array('type' => 'begin_subgroup', 'subgroup_header' => array('type' => 'message_only', 'text' => __('Instead of <code>INSERT</code> statements, use:')));
137
$plugin_list['sql']['options'][] =
138
array('type' => 'bool', 'name' => 'delayed', 'text' => __('<code>INSERT DELAYED</code> statements'), 'doc' => array('manual_MySQL_Database_Administration', 'insert_delayed'));
139
$plugin_list['sql']['options'][] =
140
array('type' => 'bool', 'name' => 'ignore', 'text' => __('<code>INSERT IGNORE</code> statements'), 'doc' => array('manual_MySQL_Database_Administration', 'insert'));
141
$plugin_list['sql']['options'][] =
142
array('type' => 'end_subgroup');
143
/* end SQL statements */
145
/* Function to use when dumping data */
146
$plugin_list['sql']['options'][] =
147
array('type' => 'select', 'name' => 'type', 'text' => __('Function to use when dumping data:'), 'values' => array('INSERT' => 'INSERT', 'UPDATE' => 'UPDATE', 'REPLACE' => 'REPLACE'));
149
/* Syntax to use when inserting data */
150
$plugin_list['sql']['options'][] =
151
array('type' => 'begin_subgroup', 'subgroup_header' => array('type' => 'message_only', 'text' => __('Syntax to use when inserting data:')));
152
$plugin_list['sql']['options'][] =
153
array('type' => 'radio', 'name' => 'insert_syntax', 'values' => array(
154
'complete' => __('include column names in every <code>INSERT</code> statement <br /> Example: <code>INSERT INTO tbl_name (col_A,col_B,col_C) VALUES (1,2,3)</code>'),
155
'extended' => __('insert multiple rows in every <code>INSERT</code> statement<br /> Example: <code>INSERT INTO tbl_name VALUES (1,2,3), (4,5,6), (7,8,9)</code>'),
156
'both' => __('both of the above<br /> Example: <code>INSERT INTO tbl_name (col_A,col_B) VALUES (1,2,3), (4,5,6), (7,8,9)</code>'),
157
'none' => __('neither of the above<br /> Example: <code>INSERT INTO tbl_name VALUES (1,2,3)</code>')));
158
$plugin_list['sql']['options'][] =
159
array('type' => 'end_subgroup');
161
/* Max length of query */
162
$plugin_list['sql']['options'][] =
163
array('type' => 'text', 'name' => 'max_query_size', 'text' => __('Maximal length of created query'));
165
/* Dump binary columns in hexadecimal */
166
$plugin_list['sql']['options'][] =
167
array('type' => 'bool', 'name' => 'hex_for_blob', 'text' => __('Dump binary columns in hexadecimal notation <i>(for example, "abc" becomes 0x616263)</i>'));
169
/* Dump time in UTC */
170
$plugin_list['sql']['options'][] =
171
array('type' => 'bool', 'name' => 'utc_time', 'text' => __('Dump TIMESTAMP columns in UTC <i>(enables TIMESTAMP columns to be dumped and reloaded between servers in different time zones)</i>'));
173
$plugin_list['sql']['options'][] = array('type' => 'end_group');
174
/* end Data options */