# PgsqlPDOQuerySplitter

Extends \PDOQuerySplitter

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 avb@php.net
package | phing.tasks.ext.pdo
version | $Id: 2e4cf5659024930ba454c239c5e288e2fd7dab37 $
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

### Arguments

#### $parent

`\PDOSQLExecTask`

#### $reader

`\Reader`

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

    checkDollarQuote() : string|boolean

### Response

`string|boolean`

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

## Gets next symbol from the input, false if at end

    getc() : string|boolean

### Response

`string|boolean`

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

    nextQuery() : string|null

inherited abstract

### Response

`string|null`

## 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.

### Constants

## STATE_NORMAL

    STATE_NORMAL

## STATE_SINGLE_QUOTED

    STATE_SINGLE_QUOTED

## STATE_DOUBLE_QUOTED

    STATE_DOUBLE_QUOTED

## STATE_DOLLAR_QUOTED

    STATE_DOLLAR_QUOTED

## STATE_COMMENT_LINEEND

    STATE_COMMENT_LINEEND

## STATE_COMMENT_MULTILINE

    STATE_COMMENT_MULTILINE

## STATE_BACKSLASH

    STATE_BACKSLASH

### Properties

## Nesting depth of current multiline comment

    commentDepth : integer

var |

### Type(s)

`integer`

## Current dollar-quoting "tag"

    quotingTag : string

var |

### Type(s)

`string`

## Current lexer state, one of STATE_* constants

    state : integer

var |

### Type(s)

`integer`

## Whether a backslash was just encountered in quoted string

    escape : boolean

var |

### Type(s)

`boolean`

## Current source line being examined

    line : string

var |

### Type(s)

`string`

## Position in current source line

    inputIndex : integer

var |

### Type(s)

`integer`

## Task that uses the splitter

    parent : \PDOSQLExecTask

inherited

var |

### Type(s)

`\PDOSQLExecTask`

## Reader with SQL source

    sqlReader : \BufferedReader

inherited

var |

### Type(s)

`\BufferedReader`