bug #1826205 [export] Problems with yaml text export
This commit is contained in:
@@ -27,6 +27,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
|
|||||||
- bug #1724217 [Create PHP Code] doesn't include newlines for text fields
|
- bug #1724217 [Create PHP Code] doesn't include newlines for text fields
|
||||||
- bug #1845605 [i18n] translators.html still uses iso-8859-1
|
- bug #1845605 [i18n] translators.html still uses iso-8859-1
|
||||||
- bug #1823018 [charset] Edit(Delete) img-links pointing to wrong row
|
- bug #1823018 [charset] Edit(Delete) img-links pointing to wrong row
|
||||||
|
- bug #1826205 [export] Problems with yaml text export
|
||||||
|
|
||||||
2.11.4.0 (not yet released)
|
2.11.4.0 (not yet released)
|
||||||
- bug #1843428 [GUI] Space issue with DROP/DELETE/ALTER TABLE
|
- bug #1843428 [GUI] Space issue with DROP/DELETE/ALTER TABLE
|
||||||
|
@@ -16,7 +16,10 @@ if (isset($plugin_list)) {
|
|||||||
'mime_type' => 'text/yaml',
|
'mime_type' => 'text/yaml',
|
||||||
'force_file' => true,
|
'force_file' => true,
|
||||||
'options' => array(
|
'options' => array(
|
||||||
array('type' => 'hidden', 'name' => 'data'),
|
array(
|
||||||
|
'type' => 'hidden',
|
||||||
|
'name' => 'data',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'options_text' => 'strOptions',
|
'options_text' => 'strOptions',
|
||||||
);
|
);
|
||||||
@@ -35,7 +38,8 @@ if (isset($plugin_list)) {
|
|||||||
*/
|
*/
|
||||||
function PMA_exportComment($text)
|
function PMA_exportComment($text)
|
||||||
{
|
{
|
||||||
return TRUE;
|
PMA_exportOutputHandler('# ' . $text . $GLOBALS['crlf']);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +51,8 @@ function PMA_exportComment($text)
|
|||||||
*/
|
*/
|
||||||
function PMA_exportFooter()
|
function PMA_exportFooter()
|
||||||
{
|
{
|
||||||
return TRUE;
|
PMA_exportOutputHandler('...' . $GLOBALS['crlf']);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,7 +64,8 @@ function PMA_exportFooter()
|
|||||||
*/
|
*/
|
||||||
function PMA_exportHeader()
|
function PMA_exportHeader()
|
||||||
{
|
{
|
||||||
return TRUE;
|
PMA_exportOutputHandler('%YAML 1.1' . $GLOBALS['crlf'] . '---' . $GLOBALS['crlf']);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,7 +79,7 @@ function PMA_exportHeader()
|
|||||||
*/
|
*/
|
||||||
function PMA_exportDBHeader($db)
|
function PMA_exportDBHeader($db)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,7 +93,7 @@ function PMA_exportDBHeader($db)
|
|||||||
*/
|
*/
|
||||||
function PMA_exportDBFooter($db)
|
function PMA_exportDBFooter($db)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,7 +107,7 @@ function PMA_exportDBFooter($db)
|
|||||||
*/
|
*/
|
||||||
function PMA_exportDBCreate($db)
|
function PMA_exportDBCreate($db)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,11 +137,27 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
|||||||
$buffer = '';
|
$buffer = '';
|
||||||
while ($record = PMA_DBI_fetch_row($result)) {
|
while ($record = PMA_DBI_fetch_row($result)) {
|
||||||
$cnt++;
|
$cnt++;
|
||||||
$buffer = $cnt . ":$crlf";
|
$buffer = '-' . $crlf;
|
||||||
for ($i = 0; $i < $columns_cnt; $i++) {
|
for ($i = 0; $i < $columns_cnt; $i++) {
|
||||||
if (isset($record[$i]) && !is_null($record[$i])) {
|
if (! isset($record[$i])) {
|
||||||
$buffer .= ' ' . $columns[$i] . ': ' . htmlspecialchars($record[$i]) . $crlf;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$column = "'" . str_replace("'", "''", $columns[$i]) . "'";
|
||||||
|
|
||||||
|
if (is_null($record[$i])) {
|
||||||
|
$buffer .= ' ' . $column . ': null' . $crlf;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_numeric($record[$i])) {
|
||||||
|
$buffer .= ' ' . $column . ': ' . $record[$i] . $crlf;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$record[$i] = "'" . str_replace("'", "''", $record[$i]) . "'";
|
||||||
|
//$record[$i] = ' ' . preg_replace('/\r\n|\r|\n/', '$0 ', $record[$i]);
|
||||||
|
$buffer .= ' ' . $column . ': ' . $record[$i] . $crlf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PMA_exportOutputHandler($buffer)) {
|
if (!PMA_exportOutputHandler($buffer)) {
|
||||||
@@ -144,7 +166,7 @@ function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
|
|||||||
}
|
}
|
||||||
PMA_DBI_free_result($result);
|
PMA_DBI_free_result($result);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user