public function exportData($db, $table, $crlf, $error_url, $sql_query, $aliases = array())
{
// Do not export data for merge tables
if ($GLOBALS['dbi']->getTable($db, $table)->isMerge()) {
return true;
}
$db_alias = $db;
$table_alias = $table;
$this->initAlias($aliases, $db_alias, $table_alias);
if (isset($GLOBALS['xml_export_contents']) && $GLOBALS['xml_export_contents']) {
$result = $GLOBALS['dbi']->query($sql_query, null, DatabaseInterface::QUERY_UNBUFFERED);
$columns_cnt = $GLOBALS['dbi']->numFields($result);
$columns = array();
for ($i = 0; $i < $columns_cnt; $i++) {
$columns[$i] = stripslashes($GLOBALS['dbi']->fieldName($result, $i));
}
unset($i);
$buffer = ' <!-- ' . __('Table') . ' ' . htmlspecialchars($table_alias) . ' -->' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
while ($record = $GLOBALS['dbi']->fetchRow($result)) {
$buffer = ' <table name="' . htmlspecialchars($table_alias) . '">' . $crlf;
for ($i = 0; $i < $columns_cnt; $i++) {
$col_as = $columns[$i];
if (!empty($aliases[$db]['tables'][$table]['columns'][$col_as])) {
$col_as = $aliases[$db]['tables'][$table]['columns'][$col_as];
}
// If a cell is NULL, still export it to preserve
// the XML structure
if (!isset($record[$i]) || is_null($record[$i])) {
$record[$i] = 'NULL';
}
$buffer .= ' <column name="' . htmlspecialchars($col_as) . '">' . htmlspecialchars((string) $record[$i]) . '</column>' . $crlf;
}
$buffer .= ' </table>' . $crlf;
if (!PMA_exportOutputHandler($buffer)) {
return false;
}
}
$GLOBALS['dbi']->freeResult($result);
}
return true;
}