@gibme/sql
    Preparing search index...

    Class SQLite

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    config: Partial<SQLite.Config> = {}
    tableOptions: string = ''

    Accessors

    • get typeName(): string

      Returns string

    Methods

    • Protected

      Prepares the columns for a CREATE statement

      Parameters

      Returns [string[], any[]]

    • Protected

      Prepares any foreign key constraints based upon the field supplied

      Parameters

      Returns string[]

    • Prepares the creation of a table including the relevant indexes and constraints

      Parameters

      • databaseType: Database.Type
      • table: string
      • columns: Column[]
      • primaryKey: string[] = []
      • tableOptions: string = ''

      Returns Database.Query[]

    • Prepares a query to perform a multi-insert statement which is far faster than a bunch of individual insert statements

      Parameters

      • databaseType: Database.Type
      • table: string
      • columns: string[] = []
      • values: any[][]

      Returns Database.Query[]

    • Prepares a query to perform a multi-update statement which is based upon a multi-insert statement that performs an UPSERT and this is a lot faster than a bunch of individual update statements

      Parameters

      • databaseType: Database.Type
      • table: string
      • primaryKey: string[]
      • columns: string[]
      • values: any[][]

      Returns Database.Query[]

    • Protected

      This does nothing as the underlying instance handles this internally

      Parameters

      • _connection: any

      Returns Promise<void>

    • Closes the database instance

      Note: closing the db using this method will kill the instance for all references to the instance

      Returns Promise<void>

    • Protected

      This does nothing as the underlying instance handles this internally

      Parameters

      • _connection: any

      Returns Promise<void>

    • Protected

      This is not required for this database type

      Returns Promise<void>

    • Prepares and executes the creation of an index on the table specified

      Parameters

      • table: string
      • fields: string[]
      • type: IndexType = Database.Table.IndexType.NONE
      • useTransaction: boolean = true

      Returns Promise<void>

    • Prepares and executes the creation of a table including the relevant indexes and constraints

      Parameters

      • name: string
      • fields: Column[]
      • primaryKey: string[] = []
      • tableOptions: string = ...
      • useTransaction: boolean = true

      Returns Promise<void>

    • Escapes the value for SQL

      Parameters

      • value: string

      Returns string

    • Escapes the ID for sql

      Parameters

      • id: string

      Returns string

    • Retrieves the current PRAGMA setting

      Parameters

      • option: string

      Returns Promise<unknown>

    • Lists the tables in the specified database

      Parameters

      • Optionalfilename: string

      Returns Promise<string[]>

    • Prepares and performs a query that performs a multi-insert statement which is far faster than a bunch of individual insert statements

      Parameters

      • table: string
      • columns: string[] = []
      • values: any[][]
      • useTransaction: boolean = true

      Returns Promise<Database.Query.Result<any>>

    • Prepares and executes a query to that performs a multi-update statement which is based upon a multi-insert statement that performs an UPSERT which is a lot faster than a bunch of update statements

      Parameters

      • table: string
      • primaryKey: string[]
      • columns: string[]
      • values: any[][]
      • useTransaction: boolean = true

      Returns Promise<Database.Query.Result<any>>

    • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      By default, event listeners are invoked in the order they are added. The emitter.prependListener() method can be used as an alternative to add the event listener to the beginning of the listeners array.

      import { EventEmitter } from 'node:events';
      const myEE = new EventEmitter();
      myEE.on('foo', () => console.log('a'));
      myEE.prependListener('foo', () => console.log('b'));
      myEE.emit('foo');
      // Prints:
      // b
      // a

      Parameters

      • event: "error"
      • listener: (error: Error) => void

        The callback function

      Returns this

      v0.1.101

    • Parameters

      • event: "trace"
      • listener: (sql: string) => void

      Returns this

    • Parameters

      • event: "profile"
      • listener: (sql: string, time: number) => void

      Returns this

    • Parameters

      • event: "change"
      • listener: (type: string, database: string, table: string, rowid: number) => void

      Returns this

    • Parameters

      • event: "open"
      • listener: () => void

      Returns this

    • Parameters

      • event: "close"
      • listener: () => void

      Returns this

    • Prepares the creation of a table including the relevant indexes and constraints

      Parameters

      • name: string
      • fields: Column[]
      • primaryKey: string[] = []
      • tableOptions: string = ...

      Returns Database.Query[]

    • Prepares a query to perform a multi-insert statement which is far faster than a bunch of individual insert statements

      Parameters

      • table: string
      • columns: string[] = []
      • values: any[][]

      Returns Database.Query[]

    • Prepares a query to perform a multi-update statement which is based upon a multi-insert statement that performs an UPSERT and this is a lot faster than a bunch of individual update statements

      Parameters

      • table: string
      • primaryKey: string[]
      • columns: string[]
      • values: any[][]

      Returns Database.Query[]

    • Protected

      This does nothing as the underlying instance handles this internally

      Parameters

      • _connection: any

      Returns Promise<void>

    • Sets the given PRAGMA setting

      Parameters

      • option: string
      • value: string | number | boolean

      Returns Promise<void>

    • Truncates the specified table(s)

      Parameters

      • table: string | string[]
      • useTransaction: boolean = true

      Returns Promise<boolean>

    • Creates a new instance connected to the specified database using the same configuration options

      Parameters

      • filename: string

      Returns Promise<SQLite>

    • Sets the execution mode to verbose and produces long stack traces. There is no way to reset this. See the wiki page on debugging SQLite for more information.

      Returns sqlite3