Internal implementation of SqlLoggingSession that handles SQL statement logging to files. This class manages file I/O, SQL formatting, and filtering based on session options.

Implements

Constructors

Properties

_compiledPatterns: RegExp[]
_disposed: boolean = false
_emittedStatementCount: number = 0
_fileHandle: FileHandle = null
_statementCount: number = 0
filePath: string

File path where SQL is being logged

id: string

Unique session ID

Configuration options for this session

startTime: Date

Session start time

Accessors

Methods

  • Escapes ${...} patterns within SQL string literals to prevent Flyway from interpreting them as placeholders. Converts ${templateVariable} to $' + '{templateVariable} within string literals.

    Parameters

    • sql: string

      The SQL statement to process

    Returns string

    The SQL with escaped template syntax within strings

  • Initializes the logging session by creating the log file and writing the header

    Returns Promise<void>

    Throws

    Error if file creation fails

  • Logs a SQL statement to the file, applying filtering and formatting based on session options

    Parameters

    • query: string

      The SQL query to log

    • Optional parameters: any

      Optional parameters for the query

    • Optional description: string

      Optional description for this operation

    • isMutation: boolean = false

      Whether this is a data mutation operation

    • Optional simpleSQLFallback: string

      Optional simple SQL to use if logRecordChangeMetadata=false

    Returns Promise<void>