rfe #2420684 [export] Allow export of timestamps in UTC.

This commit is contained in:
Michal Čihař
2010-01-21 11:10:33 +00:00
parent ca83c56f5d
commit 1243d870e7
60 changed files with 80 additions and 0 deletions

View File

@@ -116,6 +116,8 @@ if (isset($plugin_list)) {
array('type' => 'bool', 'name' => 'ignore', 'text' => 'strIgnoreInserts');
$plugin_list['sql']['options'][] =
array('type' => 'bool', 'name' => 'hex_for_blob', 'text' => 'strHexForBLOB');
$plugin_list['sql']['options'][] =
array('type' => 'bool', 'name' => 'utc_time', 'text' => 'strSQLExportUTC');
$plugin_list['sql']['options'][] =
array('type' => 'select', 'name' => 'type', 'text' => 'strSQLExportType', 'values' => array('INSERT' => 'INSERT', 'UPDATE' => 'UPDATE', 'REPLACE' => 'REPLACE'));
$plugin_list['sql']['options'][] =
@@ -194,6 +196,11 @@ function PMA_exportFooter()
. '/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;' . $crlf;
}
/* Restore timezone */
if ($GLOBALS['sql_utc_time']) {
PMA_DBI_query('SET time_zone = "' . $GLOBALS['old_tz'] . '"');
}
return PMA_exportOutputHandler($foot);
}
@@ -254,6 +261,14 @@ function PMA_exportHeader()
. 'START TRANSACTION;' . $crlf;
}
/* Change timezone if we should export timestamps in UTC */
if ($GLOBALS['sql_utc_time']) {
$head .= 'SET time_zone = "+00:00";' . $crlf;
$GLOBALS['old_tz'] = PMA_DBI_fetch_value('SELECT @@session.time_zone');
PMA_DBI_query('SET time_zone = "+00:00"');
}
$head .= PMA_possibleCRLF();
if (! empty($GLOBALS['asfile'])) {