tasks/ext/pdo/PgsqlPDOQuerySplitter.php

Show: inherited
Table of Contents

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This software consists of voluntary contributions made by many individuals and is licensed under the LGPL. For more information please see http://phing.info.

Package
phing.tasks.ext.pdo  
Version
SVN: $Id: 0e3570c0e594f4396d833d77e841294855b297d9 $  

\PgsqlPDOQuerySplitter

Package: phing\tasks\ext\pdo

Splits PostgreSQL's dialect of SQL into separate queries

Unlike DefaultPDOQuerySplitter this uses a lexer instead of regular expressions. This allows handling complex constructs like C-style comments (including nested ones) and dollar-quoted strings.

Parent(s)
\PDOQuerySplitter
Author
Alexey Borzov  
Link
http://www.phing.info/trac/ticket/499  
Link
http://www.postgresql.org/docs/current/interactive/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING  
Version
$Id: 0e3570c0e594f4396d833d77e841294855b297d9 $  

Constants

Constant  STATE_NORMAL = 0
Constant  STATE_SINGLE_QUOTED = 1
Constant  STATE_DOUBLE_QUOTED = 2
Constant  STATE_DOLLAR_QUOTED = 3
Constant  STATE_COMMENT_LINEEND = 4
Constant  STATE_COMMENT_MULTILINE = 5
Constant  STATE_BACKSLASH = 6

Properties

Propertyprotectedint  $commentDepth= '0'

Nesting depth of current multiline comment

Default value0Details
Type
int
Propertyprotectedbool  $escape= 'false'

Whether a backslash was just encountered in quoted string

Default valuefalseDetails
Type
bool
Propertyprotectedint  $inputIndex= ''

Position in current source line

Details
Type
int
Propertyprotectedstring  $line= ''''

Current source line being examined

Default value''Details
Type
string
Propertyprotected\PDOSQLExecTask  $parent= ''
inherited

Task that uses the splitter

Inherited from: \PDOQuerySplitter::$$parent
Details
Type
\PDOSQLExecTask
Inherited_from
\PDOQuerySplitter::$$parent  
Propertyprotectedstring  $quotingTag= ''''

Current dollar-quoting "tag"

Default value''Details
Type
string
Propertyprotected\BufferedReader  $sqlReader= ''
inherited

Reader with SQL source

Inherited from: \PDOQuerySplitter::$$sqlReader
Details
Type
\BufferedReader
Inherited_from
\PDOQuerySplitter::$$sqlReader  
Propertyprotectedint  $state= 'self::STATE_NORMAL'

Current lexer state, one of STATE_* constants

Default valueself::STATE_NORMALDetails
Type
int

Methods

methodpublic__construct( \PDOSQLExecTask $parent, \Reader $reader ) : void
inherited

Constructor, sets the parent task and reader with SQL source

Inherited from: \PDOQuerySplitter::__construct()
Parameters
Name Type Description
$parent \PDOSQLExecTask
$reader \Reader
methodprotectedcheckDollarQuote( ) : string | bool

Checks whether symbols after $ are a valid dollar-quoting tag

Returns
Type Description
string | bool Dollar-quoting "tag" if it is present, false otherwise
methodpublicgetc( ) : string | bool

Gets next symbol from the input, false if at end

Returns
Type Description
string | bool
methodpublicnextQuery( ) : string | null

Returns next query from SQL source, null if no more queries left

Returns
Type Description
string | null
methodpublicungetc( ) : void

Bactracks one symbol on the input

NB: we don't need ungetc() at the start of the line, so this case is not handled.

Documentation was generated by DocBlox 0.18.1.