/** * format sql strings * * @param mixed pre-parsed SQL structure * * @return string the formatted sql * * @global array the configuration array * @global boolean whether the current statement is a multiple one or not * * @access public * * @author Robin Johnson <*****@*****.**> */ function PMA_formatSql($parsed_sql, $unparsed_sql = '') { global $cfg; // Check that we actually have a valid set of parsed data // well, not quite // first check for the SQL parser having hit an error if (PMA_SQP_isError()) { return $parsed_sql; } // then check for an array if (!is_array($parsed_sql)) { // We don't so just return the input directly // This is intended to be used for when the SQL Parser is turned off $formatted_sql = '<pre>' . "\n" . ($cfg['SQP']['fmtType'] == 'none' && $unparsed_sql != '' ? $unparsed_sql : $parsed_sql) . "\n" . '</pre>'; return $formatted_sql; } $formatted_sql = ''; switch ($cfg['SQP']['fmtType']) { case 'none': if ($unparsed_sql != '') { $formatted_sql = "<pre>\n" . PMA_SQP_formatNone(array('raw' => $unparsed_sql)) . "\n</pre>"; } else { $formatted_sql = PMA_SQP_formatNone($parsed_sql); } break; case 'html': $formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'color'); break; case 'text': //$formatted_sql = PMA_SQP_formatText($parsed_sql); $formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'text'); break; default: break; } // end switch return $formatted_sql; }
/** * Gets SQL queries in text format * * @param array The SQL queries list * * @return string The SQL queries in text format * * @access public */ function PMA_SQP_formatText($arr) { /** * TODO WRITE THIS! */ return PMA_SQP_formatNone($arr); }
/** * Gets SQL queries in text format * * @todo WRITE THIS! * @param array The SQL queries list * * @return string The SQL queries in text format * * @access public */ function PMA_SQP_formatText($arr) { return PMA_SQP_formatNone($arr); }
/** * Gets SQL queries in text format * * @todo WRITE THIS! * @param array The SQL queries list * * @return string The SQL queries in text format * * @access public */ function PMA_SQP_formatText($arr) { return PMA_SQP_formatNone($arr); } // end of the "PMA_SQP_formatText()" function
/** * format sql strings * * @param mixed $parsed_sql pre-parsed SQL structure * @param string $unparsed_sql raw SQL string * * @return string the formatted sql * * @global array the configuration array * @global boolean whether the current statement is a multiple one or not * * @access public * @todo move into PMA_Sql */ public static function formatSql($parsed_sql, $unparsed_sql = '') { global $cfg; // Check that we actually have a valid set of parsed data // well, not quite // first check for the SQL parser having hit an error if (PMA_SQP_isError()) { return htmlspecialchars($parsed_sql['raw']); } // then check for an array if (! is_array($parsed_sql)) { // We don't so just return the input directly // This is intended to be used for when the SQL Parser is turned off $formatted_sql = "<pre>\n"; if (($cfg['SQP']['fmtType'] == 'none') && ($unparsed_sql != '')) { $formatted_sql .= $unparsed_sql; } else { $formatted_sql .= $parsed_sql; } $formatted_sql .= "\n</pre>"; return $formatted_sql; } $formatted_sql = ''; switch ($cfg['SQP']['fmtType']) { case 'none': if ($unparsed_sql != '') { $formatted_sql = '<span class="inner_sql"><pre>' . "\n" . PMA_SQP_formatNone(array('raw' => $unparsed_sql)) . "\n" . '</pre></span>'; } else { $formatted_sql = PMA_SQP_formatNone($parsed_sql); } break; case 'html': $formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'color'); break; case 'text': $formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'text'); break; default: break; } // end switch return $formatted_sql; } // end of the "formatSql()" function