Utility Class to parse sql clauses for properly escaping identifiers

package Query
subpackage Query

 Methods

Constructor/entry point into parser

__construct(string $sql = ''

Parameters

$sql

string

Public parser method for seting the parse string

parse_join(string $sql) 

Parameters

$sql

string

Returns a more useful match array

filter_array(array $array) : array

Parameters

$array

array

Returns

array

 Properties

 

Regex matches

$matches : array

Default

array('functions' => array(), 'identifiers' => array(), 'operators' => array(), 'combined' => array())
 

Regex patterns for various syntax components

$match_patterns : array

Default

array('function' => '([a-zA-Z0-9_]+\((.*?)\))', 'identifier' => '([a-zA-Z0-9_-]+\.?)+', 'operator' => '=|AND|&&?|~|\|\|?|\^|/|>=?|<=?|-|%|OR|\+|NOT|\!=?|<>|XOR')