Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MaxScannerCapacity = 256 * 1024
Default max capacity is 64 * 1024 which is not enough for certain lines containing e.g. geographical data. 256K ought to be enough for anybody...
Functions ¶
func Split ¶
Use bufio.Scanner to split a PostgreSQL string into multiple statements.
The core problem is to figure out whether the current ; separator is inside an escaped string literal. PostgreSQL has multiple ways of opening a string literal, $$, ', --, /*, etc. We use a FSM to guarantee these states are entered exclusively. If not in one of the above escape states, the next ; token can be parsed as statement separator.
Each statement is split as it is, without removing comments or white spaces.
Types ¶
type BlockState ¶
type BlockState struct {
// contains filtered or unexported fields
}
Opened a block comment
type DollarState ¶
type DollarState struct {
// contains filtered or unexported fields
}
Opened a dollar quote, no characters are ever esacped.
type QuoteState ¶
type QuoteState struct {
// contains filtered or unexported fields
}
Opened a single quote ' or double quote "