PHP Class VersionPress\Database\SqlQueryParser

Datei anzeigen Open project: versionpress/versionpress Class Usage Examples

Public Methods

Method Description
__construct ( DbSchemaInfo $schema, Database $database ) SqlQueryParser constructor.
parseQuery ( string $query ) : ParsedQueryData Parses Sql query called. If not parseable, returns null

Private Methods

Method Description
getColumnDataToSet ( Statement $sqlStatement ) : array Gets data which needs to be set by UPDATE statement
getParser ( $query ) : Parser If query contains some suspicious patten, we need to transform it and than create Parser for further use.
getParserFromQueryWithUsingClause ( $query, $parser, $matches, $containsUsingPattern ) : Parser
getSelectQuery ( Parser $parser, string[] $idColumns ) : string Creates Select SQL query from query in Parser
getWhereFragments ( Parser $parser, string $sqlQuery, DeleteStatement | UpdateStatement $primarySqlStatement ) : array Returns representation of WHERE SQL clauses found in whole query
parseDeleteQuery ( Parser $parser, string $query, DbSchemaInfo $schema, $database ) : ParsedQueryData Parses DELETE query
parseInsertQuery ( Parser $parser, string $query, DbSchemaInfo $schema ) : ParsedQueryData Parses INSERT query
parseUpdateQuery ( Parser $parser, string $query, DbSchemaInfo $schema, Database $database ) : ParsedQueryData Parses UPDATE query
resolveEntityName ( DbSchemaInfo $schema, string $table ) : mixed Returns entity name for a table
resolveIdColumns ( DbSchemaInfo $schema, string $table ) : string[] | null Returns ID column for a table

Method Details

__construct() public method

SqlQueryParser constructor.
public __construct ( DbSchemaInfo $schema, Database $database )
$schema DbSchemaInfo
$database Database

parseQuery() public method

Parses Sql query called. If not parseable, returns null
public parseQuery ( string $query ) : ParsedQueryData
$query string
return ParsedQueryData