本文整理汇总了PHP中PMA_SQP_arrayAdd函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_SQP_arrayAdd函数的具体用法?PHP PMA_SQP_arrayAdd怎么用?PHP PMA_SQP_arrayAdd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_SQP_arrayAdd函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_SQP_parse
/**
* Parses the SQL queries
*
* @param string The SQL query list
*
* @return mixed Most of times, nothing...
*
* @global array The current PMA configuration
* @global array MySQL column attributes
* @global array MySQL reserved words
* @global array MySQL column types
* @global array MySQL function names
* @global integer MySQL column attributes count
* @global integer MySQL reserved words count
* @global integer MySQL column types count
* @global integer MySQL function names count
* @global array List of available character sets
* @global array List of available collations
* @global integer Character sets count
* @global integer Collations count
*
* @access public
*/
function PMA_SQP_parse($sql)
{
global $cfg;
global $PMA_SQPdata_column_attrib, $PMA_SQPdata_reserved_word, $PMA_SQPdata_column_type, $PMA_SQPdata_function_name, $PMA_SQPdata_column_attrib_cnt, $PMA_SQPdata_reserved_word_cnt, $PMA_SQPdata_column_type_cnt, $PMA_SQPdata_function_name_cnt;
global $mysql_charsets, $mysql_collations_flat, $mysql_charsets_count, $mysql_collations_count;
global $PMA_SQPdata_forbidden_word, $PMA_SQPdata_forbidden_word_cnt;
// rabus: Convert all line feeds to Unix style
$sql = str_replace("\r\n", "\n", $sql);
$sql = str_replace("\r", "\n", $sql);
$len = PMA_strlen($sql);
if ($len == 0) {
return array();
}
$sql_array = array();
$sql_array['raw'] = $sql;
$count1 = 0;
$count2 = 0;
$punct_queryend = ';';
$punct_qualifier = '.';
$punct_listsep = ',';
$punct_level_plus = '(';
$punct_level_minus = ')';
$digit_floatdecimal = '.';
$digit_hexset = 'x';
$bracket_list = '()[]{}';
$allpunct_list = '-,;:!?/.^~\\*&%+<=>|';
$allpunct_list_pair = array(0 => '!=', 1 => '&&', 2 => ':=', 3 => '<<', 4 => '<=', 5 => '<=>', 6 => '<>', 7 => '>=', 8 => '>>', 9 => '||');
$allpunct_list_pair_size = 10;
//count($allpunct_list_pair);
$quote_list = '\'"`';
$arraysize = 0;
while ($count2 < $len) {
$c = PMA_substr($sql, $count2, 1);
$count1 = $count2;
if ($c == "\n") {
$count2++;
PMA_SQP_arrayAdd($sql_array, 'white_newline', '', $arraysize);
continue;
}
// Checks for white space
if (PMA_STR_isSpace($c)) {
$count2++;
continue;
}
// Checks for comment lines.
// MySQL style #
// C style /* */
// ANSI style --
if ($c == '#' || $count2 + 1 < $len && $c == '/' && PMA_substr($sql, $count2 + 1, 1) == '*' || $count2 + 2 == $len && $c == '-' && PMA_substr($sql, $count2 + 1, 1) == '-' || $count2 + 2 < $len && $c == '-' && PMA_substr($sql, $count2 + 1, 1) == '-' && PMA_substr($sql, $count2 + 2, 1) <= ' ') {
$count2++;
$pos = 0;
$type = 'bad';
switch ($c) {
case '#':
$type = 'mysql';
case '-':
$type = 'ansi';
$pos = $GLOBALS['PMA_strpos']($sql, "\n", $count2);
break;
case '/':
$type = 'c';
$pos = $GLOBALS['PMA_strpos']($sql, '*/', $count2);
$pos += 2;
break;
default:
break;
}
// end switch
$count2 = $pos < $count2 ? $len : $pos;
$str = PMA_substr($sql, $count1, $count2 - $count1);
PMA_SQP_arrayAdd($sql_array, 'comment_' . $type, $str, $arraysize);
continue;
}
// end if
// Checks for something inside quotation marks
if (PMA_STR_strInStr($c, $quote_list)) {
$startquotepos = $count2;
//.........这里部分代码省略.........
示例2: PMA_SQP_parse
/**
* Parses the SQL queries
*
* @param string $sql The SQL query list
*
* @return mixed Most of times, nothing...
*
* @global array The current PMA configuration
* @global array MySQL column attributes
* @global array MySQL reserved words
* @global array MySQL column types
* @global array MySQL function names
* @global array List of available character sets
* @global array List of available collations
*
* @access public
*/
function PMA_SQP_parse($sql)
{
static $PMA_SQPdata_column_attrib, $PMA_SQPdata_reserved_word;
static $PMA_SQPdata_column_type;
static $PMA_SQPdata_function_name, $PMA_SQPdata_forbidden_word;
global $mysql_charsets, $mysql_collations_flat;
/* @var $pmaString PMA_String */
$pmaString = $GLOBALS['PMA_String'];
// Convert all line feeds to Unix style
$sql = str_replace("\r\n", "\n", $sql);
$sql = str_replace("\r", "\n", $sql);
$len = mb_strlen($sql);
if ($len == 0) {
return array();
}
// Create local hashtables
if (!isset($PMA_SQPdata_column_attrib)) {
$PMA_SQPdata_column_attrib = array_flip($GLOBALS['PMA_SQPdata_column_attrib']);
$PMA_SQPdata_function_name = array_flip($GLOBALS['PMA_SQPdata_function_name']);
$PMA_SQPdata_reserved_word = array_flip($GLOBALS['PMA_SQPdata_reserved_word']);
$PMA_SQPdata_forbidden_word = array_flip($GLOBALS['PMA_SQPdata_forbidden_word']);
$PMA_SQPdata_column_type = array_flip($GLOBALS['PMA_SQPdata_column_type']);
}
$sql_array = array();
$sql_array['raw'] = $sql;
$count2 = 0;
$punct_queryend = ';';
$punct_qualifier = '.';
$punct_listsep = ',';
$bracket_list = '()[]{}';
$allpunct_list = '-,;:!?/.^~\\*&%+<=>|';
$allpunct_list_pair = array('!=' => 1, '&&' => 1, ':=' => 1, '<<' => 1, '<=' => 1, '<=>' => 1, '<>' => 1, '>=' => 1, '>>' => 1, '||' => 1, '==' => 1);
$quote_list = '\'"`';
$arraysize = 0;
$this_was_space = false;
$this_was_bracket = false;
$this_was_punct = false;
$this_was_listsep = false;
$this_was_quote = false;
while ($count2 < $len) {
$c = mb_substr($sql, $count2, 1);
$count1 = $count2;
$previous_was_space = $this_was_space;
$this_was_space = false;
$previous_was_bracket = $this_was_bracket;
$this_was_bracket = false;
$previous_was_punct = $this_was_punct;
$this_was_punct = false;
$previous_was_listsep = $this_was_listsep;
$this_was_listsep = false;
$previous_was_quote = $this_was_quote;
$this_was_quote = false;
if ($c === "\n") {
$this_was_space = true;
$count2++;
PMA_SQP_arrayAdd($sql_array, 'white_newline', "\n", $arraysize, $count2);
continue;
}
// Checks for white space
if ($pmaString->isSpace($c)) {
$this_was_space = true;
$count2++;
continue;
}
// Checks for comment lines.
// MySQL style #
// C style /* */
// ANSI style --
$next_c = mb_substr($sql, $count2 + 1, 1);
if ($c == '#' || $count2 + 1 < $len && $c == '/' && $next_c == '*' || $count2 + 2 == $len && $c == '-' && $next_c == '-' || $count2 + 2 < $len && $c == '-' && $next_c == '-' && mb_substr($sql, $count2 + 2, 1) <= ' ') {
$count2++;
$pos = 0;
$type = 'bad';
switch ($c) {
case '#':
$type = 'mysql';
$pos = mb_strpos($sql, "\n", $count2);
break;
case '-':
$type = 'ansi';
$pos = mb_strpos($sql, "\n", $count2);
break;
case '/':
//.........这里部分代码省略.........