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.

author Alexey Borzov
package phing.tasks.ext.pdo
version $Id: 0e3570c0e594f4396d833d77e841294855b297d9 $
link http://www.phing.info/trac/ticket/499
link http://www.postgresql.org/docs/current/interactive/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING

 Methods

Constructor, sets the parent task and reader with SQL source

__construct(\PDOSQLExecTask $parent, \Reader $reader) 
Inherited
inherited_from \PDOQuerySplitter::__construct()

Parameters

$parent

\PDOSQLExecTask

$reader

\Reader

Gets next symbol from the input, false if at end

getc() : string | bool

Returns

stringbool

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

nextQuery() : string | null

Returns

stringnull

Bactracks one symbol on the input

ungetc() 

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

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

checkDollarQuote() : string | bool

Returns

stringboolDollar-quoting "tag" if it is present, false otherwise

 Properties

 

$commentDepth : int
 

$escape : bool
 

$inputIndex : int
 

$line : string
 

$parent : \PDOSQLExecTask
Inherited
inherited_from \PDOQuerySplitter::$$parent
 

$quotingTag : string
 

$sqlReader : \BufferedReader
Inherited
inherited_from \PDOQuerySplitter::$$sqlReader
 

$state : int

 Constants

 

STATE_BACKSLASH

STATE_BACKSLASH 
 

STATE_COMMENT_LINEEND

STATE_COMMENT_LINEEND 
 

STATE_COMMENT_MULTILINE

STATE_COMMENT_MULTILINE 
 

STATE_DOLLAR_QUOTED

STATE_DOLLAR_QUOTED 
 

STATE_DOUBLE_QUOTED

STATE_DOUBLE_QUOTED 
 

STATE_NORMAL

STATE_NORMAL 
 

STATE_SINGLE_QUOTED

STATE_SINGLE_QUOTED