PHP Class PHPSQLParser\PHPSQLParser

Author: Justin Swanhart ([email protected])
Author: André Rothe ([email protected])
Afficher le fichier Open project: greenlion/php-sql-parser Class Usage Examples

Méthodes publiques

Свойство Type Description
$parsed

Méthodes publiques

Méthode Description
__construct ( String | boolean $sql = false, boolean $calcPositions = false, array $options = [] ) Constructor. It simply calls the parse() function.
addCustomFunction ( String $token ) : null Add a custom function to the parser. no return value
getCustomFunctions ( ) : array Returns the list of custom functions
parse ( String $sql, boolean $calcPositions = false ) : array It parses the given SQL statement and generates a detailled output array for every part of the statement. The method can also generate [position] fields within the output, which hold the character position for every statement part. The calculation of the positions needs some time, if you don't need positions in your application, set the parameter to false.
removeCustomFunction ( String $token ) : null Remove a custom function from the parser. no return value

Method Details

__construct() public méthode

Use the public variable $parsed to get the output.
public __construct ( String | boolean $sql = false, boolean $calcPositions = false, array $options = [] )
$sql String | boolean The SQL statement.
$calcPositions boolean True, if the output should contain [position], false otherwise.
$options array

addCustomFunction() public méthode

Add a custom function to the parser. no return value
public addCustomFunction ( String $token ) : null
$token String The name of the function to add
Résultat null

getCustomFunctions() public méthode

Returns the list of custom functions
public getCustomFunctions ( ) : array
Résultat array Returns an array of all custom functions

parse() public méthode

It parses the given SQL statement and generates a detailled output array for every part of the statement. The method can also generate [position] fields within the output, which hold the character position for every statement part. The calculation of the positions needs some time, if you don't need positions in your application, set the parameter to false.
public parse ( String $sql, boolean $calcPositions = false ) : array
$sql String The SQL statement.
$calcPositions boolean True, if the output should contain [position], false otherwise.
Résultat array An associative array with all meta information about the SQL statement.

removeCustomFunction() public méthode

Remove a custom function from the parser. no return value
public removeCustomFunction ( String $token ) : null
$token String The name of the function to remove
Résultat null

Property Details

$parsed public_oe property

public $parsed