PHP Класс PHPSQLParser\PHPSQLParser

Автор: Justin Swanhart ([email protected])
Автор: André Rothe ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$parsed

Открытые методы

Метод Описание
__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

Описание методов

__construct() публичный Метод

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() публичный Метод

Add a custom function to the parser. no return value
public addCustomFunction ( String $token ) : null
$token String The name of the function to add
Результат null

getCustomFunctions() публичный Метод

Returns the list of custom functions
public getCustomFunctions ( ) : array
Результат array Returns an array of all custom functions

parse() публичный Метод

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.
Результат array An associative array with all meta information about the SQL statement.

removeCustomFunction() публичный Метод

Remove a custom function from the parser. no return value
public removeCustomFunction ( String $token ) : null
$token String The name of the function to remove
Результат null

Описание свойств

$parsed публичное свойство

public $parsed