SqlStatement

data class SqlStatement(val sql: String, val offset: Int, val keyword: String?)

One statement out of a script, and where it stood in the text it was cut from.

Constructors

Link copied to clipboard
constructor(sql: String, offset: Int, keyword: String?)

Properties

Link copied to clipboard

The statement's first word, upper-cased, with whatever comments stand in front of it stepped over - COMMIT for -- why we do this COMMIT. null where the statement opens with something that is not a word: a quote, a dollar-quoted body, a parenthesis. Upper-cased because SQL keywords are case-insensitive and comparing them as written is a bug waiting to happen.

Link copied to clipboard
val offset: Int

Index in the original script of this statement's first character. The server reports an error position against what it was sent, so a statement sent on its own has its errors numbered from its own beginning; adding this puts that number back where the author can find it.

Link copied to clipboard
val sql: String

The statement itself, without the ; that ended it and without the whitespace around it. Comments that fell inside it are kept - they cost nothing to send and removing them would move every position after them.