2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Set of functions used to build YAML dumps of tables
12 if (isset($plugin_list)) {
13 $plugin_list['yaml'] = array(
16 'mime_type' => 'text/yaml',
19 array('type' => 'hidden', 'name' => 'data'),
21 'options_text' => 'strOptions',
26 * Set of functions used to build exports of tables
32 * @param string Text of comment
34 * @return bool Whether it suceeded
36 function PMA_exportComment($text)
42 * Outputs export footer
44 * @return bool Whether it suceeded
48 function PMA_exportFooter()
54 * Outputs export header
56 * @return bool Whether it suceeded
60 function PMA_exportHeader()
66 * Outputs database header
68 * @param string Database name
70 * @return bool Whether it suceeded
74 function PMA_exportDBHeader($db)
80 * Outputs database footer
82 * @param string Database name
84 * @return bool Whether it suceeded
88 function PMA_exportDBFooter($db)
94 * Outputs create database database
96 * @param string Database name
98 * @return bool Whether it suceeded
102 function PMA_exportDBCreate($db)
108 * Outputs the content of a table in YAML format
110 * @param string the database name
111 * @param string the table name
112 * @param string the end of line sequence
113 * @param string the url to go back in case of error
114 * @param string SQL query for obtaining data
116 * @return bool Whether it suceeded
120 function PMA_exportData($db, $table, $crlf, $error_url, $sql_query)
122 $result = PMA_DBI_query($sql_query, null, PMA_DBI_QUERY_UNBUFFERED
);
124 $columns_cnt = PMA_DBI_num_fields($result);
125 for ($i = 0; $i < $columns_cnt; $i++
) {
126 $columns[$i] = stripslashes(PMA_DBI_field_name($result, $i));
132 while ($record = PMA_DBI_fetch_row($result)) {
134 $buffer = $cnt . ":$crlf";
135 for ($i = 0; $i < $columns_cnt; $i++
) {
136 if (isset($record[$i]) && !is_null($record[$i])) {
137 $buffer .= ' ' . $columns[$i] . ': ' . htmlspecialchars($record[$i]) . $crlf;
141 if (!PMA_exportOutputHandler($buffer)) {
145 PMA_DBI_free_result($result);