phpcr-utils/src/PHPCR/Util/QOM/Sql2Scanner.php

Show: PublicProtectedPrivateinherited
Table of Contents
This file is part of the PHPCR Utils

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

License
Apache Software License 2.0  
Link
http://phpcr.github.com/  

\PHPCR\Util\QOM\Sql2Scanner

Package: Default
Split an SQL2 statement into string tokens.

Allows lookup and fetching of tokens.

Properties

>VPropertyprotectedint $curpos = 0
Parsing position in the SQL string
Default value0Details
Type
int
>VPropertyprotectedstring $sql2
The SQL2 query currently being parsed
Details
Type
string
>VPropertyprotectedarray $tokens
Token scanning result of the SQL2 string
Details
Type
array

Methods

methodpublic__construct(string $sql2) : void

Construct a scanner with the given SQL2 statement

Parameters
NameTypeDescription
$sql2string
methodpublicexpectToken(string $token, boolean $case_insensitive = true) : void

Expect the next token to be the given one and throw an exception if it's not the case.

The equality test is done case sensitively/insensitively depending on the second parameter.

Parameters
NameTypeDescription
$tokenstring

The expected token

$case_insensitiveboolean
methodpublicexpectTokens(array $tokens, boolean $case_insensitive = true) : void

Expect the next tokens to be the one given in the array of tokens and throws an exception if it's not the case.

Parameters
NameTypeDescription
$tokensarray
$case_insensitiveboolean
Details
See
\PHPCR\Util\QOM\expectToken  
methodpublicfetchNextToken() : string

Get the next token and remove it from the queue.

Return an empty string when there are no more tokens.

Returns
TypeDescription
string
methodpubliclookupNextToken(int $offset = 0) : string

Get the next token without removing it from the queue.

Return an empty string when there are no more tokens.

Parameters
NameTypeDescription
$offsetint

number of tokens to look ahead - defaults to 0, the current token

Returns
TypeDescription
string
methodprotectedscan(string $sql2) : array

Scan a SQL2 string a extract the tokens

Parameters
NameTypeDescription
$sql2string
Returns
TypeDescription
array
methodpublictokenIs(string $token, string $value, boolean $case_insensitive = true) : boolean

Test the equality of two tokens

Parameters
NameTypeDescription
$tokenstring
$valuestring
$case_insensitiveboolean
Returns
TypeDescription
boolean
methodprotectedtokenize(array $tokens, string $token) : void

Tokenize a string returned by strtok to split the string at '.', ',', '(', '=' and ')' characters.

Parameters
NameTypeDescription
$tokensarray
$tokenstring
Documentation was generated by phpDocumentor 2.0.0a12.