* libraries/sqlparser.lib.php3:
- Spacing around if statements - Added require statements for parser - Moved to global constants for size of keyword arrays
This commit is contained in:
@@ -11,6 +11,9 @@ $Source$
|
||||
2002-07-24 Robin Johnson <robbat2@users.sourceforge.net>
|
||||
* libraries/string.lib.php3: optimizations (thanks Lo<4C>c)
|
||||
* libraries/sqlparser.lib.php3: SQL Parser merging (in progress)
|
||||
- Spacing around if statements
|
||||
- Added require statements for parser
|
||||
- Moved to global constants for size of keyword arrays
|
||||
* libraries/sqlparser.data.php3: Merged
|
||||
|
||||
2002-07-24 Lo<4C>c Chapeaux <lolo@phpheaven.net>
|
||||
|
@@ -28,9 +28,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
||||
define('PMA_SQP_LIB_INCLUDED', 1);
|
||||
|
||||
require('./libraries/string.lib.php3');
|
||||
require('./libraries/sqlparser.data.php3');
|
||||
|
||||
if (!defined('DEBUGTIMING')) {
|
||||
function PMA_SQP_ArrayAdd(&$arr,$type,$data, &$arrsize)
|
||||
{
|
||||
@@ -262,7 +266,7 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
||||
continue;
|
||||
}
|
||||
//check for alpha
|
||||
if( FALSE && PMA_STR_IsSqlIdentifier($c,FALSE) || ($c == '@')) {
|
||||
if (PMA_STR_IsSqlIdentifier($c,FALSE) || ($c == '@')) {
|
||||
$count2 ++;
|
||||
$is_SQLvariable = ($c == '@');
|
||||
$is_Digit = (!$is_SQLvariable) && PMA_STR_IsDigit($c);
|
||||
@@ -359,11 +363,8 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
||||
|
||||
}
|
||||
|
||||
global $syntax_columnAttrib, $syntax_reservedWord, $syntax_columnType, $syntax_functionName;
|
||||
$len_columnAttrib = count($syntax_columnAttrib);
|
||||
$len_reservedWord = count($syntax_reservedWord);
|
||||
$len_columnType = count($syntax_columnType);
|
||||
$len_functionName = count($syntax_functionName);
|
||||
global $PMA_SQPdata_ColumnAttrib, $PMA_SQPdata_ReservedWord, $PMA_SQPdata_ColumnType, $PMA_SQPdata_FunctionName,
|
||||
$PMA_SQPdata_ColumnAttribLen, $PMA_SQPdata_ReservedWordLen, $PMA_SQPdata_ColumnTypeLen, $PMA_SQPdata_FunctionNameLen;
|
||||
|
||||
if ($arraysize > 0) {
|
||||
$t_next = $sql_array[0]['type'];
|
||||
@@ -383,13 +384,13 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
||||
$d_cur_upper = strtoupper($sql_array[$i]['data']);
|
||||
if ( ($t_next == 'punct_qualifier') || ($t_prev == 'punct_qualifier')) {
|
||||
$t_suffix = '_identifier';
|
||||
} elseif( ($t_next == 'punct_bracket_open_round') && PMA_STR_BinarySearchInArr($d_cur_upper,$syntax_functionName,$len_functionName)) {
|
||||
} elseif ( ($t_next == 'punct_bracket_open_round') && PMA_STR_BinarySearchInArr($d_cur_upper,$PMA_SQPdata_FunctionName,$PMA_SQPdata_FunctionNameLen)) {
|
||||
$t_suffix = '_functionName';
|
||||
} elseif(PMA_STR_BinarySearchInArr($d_cur_upper,$syntax_reservedWord,$len_reservedWord)) {
|
||||
} elseif (PMA_STR_BinarySearchInArr($d_cur_upper,$PMA_SQPdata_ReservedWord,$PMA_SQPdata_ReservedWordLen)) {
|
||||
$t_suffix = '_reservedWord';
|
||||
} elseif(PMA_STR_BinarySearchInArr($d_cur_upper,$syntax_columnType,$len_columnType)) {
|
||||
} elseif (PMA_STR_BinarySearchInArr($d_cur_upper,$PMA_SQPdata_ColumnType,$PMA_SQPdata_ColumnTypeLen)) {
|
||||
$t_suffix = '_columnType';
|
||||
} elseif(PMA_STR_BinarySearchInArr($d_cur_upper,$syntax_columnAttrib,$len_columnAttrib)) {
|
||||
} elseif (PMA_STR_BinarySearchInArr($d_cur_upper,$PMA_SQPdata_ColumnAttrib,$PMA_SQPdata_ColumnAttribLen)) {
|
||||
$t_suffix = '_columnAttrib';
|
||||
} else {
|
||||
// Do nothing
|
||||
@@ -407,7 +408,8 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
||||
}
|
||||
|
||||
|
||||
function PMA_SQP_Analyze($arr) {
|
||||
function PMA_SQP_Analyze($arr)
|
||||
{
|
||||
$result = array();
|
||||
$size = $arr['len'];
|
||||
$subresult = array(
|
||||
@@ -490,7 +492,8 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
function PMA_SQP_FormatHTML_colorize($arr) {
|
||||
function PMA_SQP_FormatHTML_colorize($arr)
|
||||
{
|
||||
$i = strpos($arr['type'],'_');
|
||||
$class = '';
|
||||
if ($i > 0) {
|
||||
@@ -501,7 +504,8 @@ if (!defined('PMA_SQP_LIB_INCLUDED')) {
|
||||
return '<span class="'.$class.'">'.htmlspecialchars($arr['data']).'</span>';
|
||||
}
|
||||
|
||||
function PMA_SQP_FormatHTML($arr) {
|
||||
function PMA_SQP_FormatHTML($arr)
|
||||
{
|
||||
$str = '';
|
||||
$indent = 0;
|
||||
$bracketlevel = 0;
|
||||
|
Reference in New Issue
Block a user