Hierarchy

  • SQLUtils

Constructors

Properties

NUMBER_PATTERN: string = '\\d+'

Pattern for matching numbers

Methods

  • Create the column definition SQL in the format: column_type[(max)] [NOT NULL] [PRIMARY KEY AUTOINCREMENT]

    Returns

    column definition SQL

    Parameters

    Returns string

  • Create the column SQL in the format: "column_name" column_type[(max)] [NOT NULL] [PRIMARY KEY AUTOINCREMENT]

    Returns

    column SQL

    Parameters

    Returns string

  • Count for query

    Returns

    number the count of rows

    Parameters

    • connection: GeoPackageConnection

      connection

    • tableName: string

      table

    • where: string

      where clause

    • whereArgs: [] | Record<string, any>

      where arguments

    Returns number

  • Create a new name by replacing a case insensitive value with a new value. If no replacement is done, create a new name in the form name_#, where # is either 2 or one greater than an existing name number suffix. When a db connection is provided, check for conflicting SQLite Master names and increment # until an available name is found.

    Returns

    new name

    Parameters

    • db: GeoPackageConnection

      optional connection, used for SQLite Master name conflict detection

    • name: string

      current name

    • replace: string

      value to replace

    • replacement: string

      replacement value

    Returns string

  • Execute a deletion

    Returns

    deleted count

    Parameters

    • connection: GeoPackageConnection

      connection

    • table: string

      table name

    • where: string

      where clause

    • args: []

      where arguments

    Returns number

  • Create the drop table if exists SQL

    Returns

    drop table SQL

    Parameters

    • tableName: string

      table name

    Returns string

  • Create the drop view if exists SQL

    Returns

    drop view SQL

    Parameters

    • viewName: string

      view name

    Returns string

  • Perform a foreign key check

    Returns

    empty list if valid or violation errors, 4 column values for each violation. see SQLite PRAGMA foreign_key_check

    Parameters

    Returns any[]

  • Create the foreign key check SQL

    Returns

    foreign key check SQL

    Parameters

    • tableName: string

      table name

    Returns string

  • Create the foreign keys SQL

    Returns

    foreign keys SQL

    Parameters

    • on: boolean

      true to turn on, false to turn off

    Returns string

  • Create the integrity check SQL

    Returns

    integrity check SQL

    Returns string

  • Modify the SQL with a name change and the table mapping modifications

    Returns

    updated SQL, null if SQL contains a deleted column

    Parameters

    • db: GeoPackageConnection

      optional connection, used for SQLite Master name conflict detection

    • name: string

      statement name

    • sql: string

      SQL statement

    • tableMapping: TableMapping

      table mapping

    Returns string

  • Modify the SQL with table mapping modifications

    Returns

    updated SQL, null if SQL contains a deleted column

    Parameters

    • sql: string

      SQL statement

    • tableMapping: TableMapping

      table mapping

    Returns string

  • Query the SQL for a single result object with the expected data type

    Returns

    result, null if no result

    Parameters

    • connection: GeoPackageConnection

      connection

    • sql: string

      sql statement

    • args: [] | Record<string, any>

      arguments

    • columnName: string

      column name

    Returns any

  • Query the SQL for a single result object with the expected data type

    Returns

    result, null if no result

    Parameters

    • connection: DBAdapter | GeoPackageConnection

      connection

    • sql: string

      sql statement

    • args: [] | Record<string, any>

      arguments

    • columnIdx: number = 0

      column index

    Returns any

  • Create the quick check SQL

    Returns

    quick check SQL

    Returns string

  • Replace the name (table, column, etc) in the SQL with the replacement. The name must be surrounded by non word characters (i.e. not a subset of another name).

    Returns

    null if not modified, SQL value if replaced at least once

    Parameters

    • sql: string

      SQL statement

    • name: string

      name

    • replacement: string

      replacement value

    Returns string

  • Get an available temporary table name. Starts with prefix_baseName and then continues with prefix#_baseName starting at 1 and increasing.

    Returns

    unused table name

    Parameters

    Returns string

  • Transfer table content to itself with new rows containing a new column value. All rows containing the current column value are inserted as new rows with the new column value.

    Parameters

    • db: GeoPackageConnection

      connection

    • tableName: string

      table name

    • columnName: string

      column name

    • newColumnValue: any

      new column value for new rows

    • currentColumnValue: any

      column value for rows to insert as new rows

    • Optional idColumnName: string

      id column name

    Returns void

  • Create insert SQL to transfer table content from one table to another

    Returns

    transfer SQL

    Parameters

    Returns string

Generated using TypeDoc