2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Set of functions used to build YAML dumps of tables
8 if (! defined('PHPMYADMIN')) {
15 if (isset($plugin_list)) {
16 $plugin_list['yaml'] = array(
19 'mime_type' => 'text/yaml',
22 array('type' => 'hidden', 'name' => 'data'),
24 'options_text' => 'strOptions',
29 * Set of functions used to build exports of tables
35 * @param string Text of comment
37 * @return bool Whether it suceeded
39 function PMA_exportComment($text)
45 * Outputs export footer
47 * @return bool Whether it suceeded
51 function PMA_exportFooter()
57 * Outputs export header
59 * @return bool Whether it suceeded
63 function PMA_exportHeader()
69 * Outputs database header
71 * @param string Database name
73 * @return bool Whether it suceeded
77 function PMA_exportDBHeader($db)
83 * Outputs database footer
85 * @param string Database name
87 * @return bool Whether it suceeded
91 function PMA_exportDBFooter($db)
97 * Outputs create database database
99 * @param string Database name
101 * @return bool Whether it suceeded
105 function PMA_exportDBCreate($db)
111 * Outputs the content of a table in YAML format
113 * @param string the database name
114 * @param string the table name
115 * @param string the end of line sequence
116 * @param string the url to go back in case of error
117 * @param string SQL query for obtaining data
119 * @return bool Whether it suceeded
123 function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
125 $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED
);
127 $columns_cnt = PMA_DBI_num_fields($result);
128 for ($i = 0; $i < $columns_cnt; $i++
) {
129 $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
135 while ($record = PMA_DBI_fetch_row($result)) {
137 $buffer = $cnt . ":$crlf";
138 for ($i = 0; $i < $columns_cnt; $i++
) {
139 if (isset($record[$i]) && !is_null($record[$i])) {
140 $buffer .= ' ' . $columns[$i] . ': ' . htmlspecialchars($record[$i]) . $crlf;
144 if (!PMA_exportOutputHandler($buffer)) {
148 PMA_DBI_free_result($result);