Options
All
  • Public
  • Public/Protected
  • All
Menu
type

{SQL} Global variable created by 'sql.js'

Hierarchy

  • db

Index

Methods

close

  • close(): void

constructor

  • constructor(data: number[]): void
  • Open a new database either by creating a new one or opening an existing one, stored in the byte array passed in first argument

    Parameters

    • data: number[]

    Returns void

create_function

  • create_function(name: string, fn: Function): void

each

  • each(sqlQuery: string, callback: Function, done: Function, params?: any | any[]): db
  • Parameters

    • sqlQuery: string
    • callback: Function
    • done: Function
    • Optional params: any | any[]

    Returns db

exec

  • exec(sqlQuery: string): Array<object>

execQuery

  • execQuery(query: QueryBuilder | string): Object[]
  • Execute a query against database and returns an array of objects It wraps db.exec()

    Parameters

    • query: QueryBuilder | string

      object

    Returns Object[]

    List of models

export

  • export(): Uint8Array

getIdLastRecordInserted

  • getIdLastRecordInserted(): number

getResults

  • getResults(statement: any): Object[]
  • Get the results from a query and transform them into a list of POJOs

    Parameters

    • statement: any

      Prepared SQL statement

    Returns Object[]

getRowsModified

  • getRowsModified(): number

getSchema

  • getSchema(): Object[]
  • Get DDL (Data Definition Language) queries Useful for debugging purposes

    Returns Object[]

hasTable

  • hasTable(tableName: string): boolean
  • Check whether a table exists in the database

    Parameters

    • tableName: string

    Returns boolean

integrityCheck

  • integrityCheck(): Object[]
  • Check databse integrity (for posible errors and corruption)

    Returns Object[]

    with integrity info

prepare

  • prepare(sqlQuery: string, params?: any | any[]): Object
  • Parameters

    • sqlQuery: string
    • Optional params: any | any[]

    Returns Object

run

  • run(sqlQuery: string, params?: any | any[]): db

runQuery

  • runQuery(query: QueryBuilder | string): any
  • Runs a database query that can be created by the query builder or by a sql query string. It does not return a list of results. It returns a "db" database object for fn chaining It wraps db.run()

    Parameters

    • query: QueryBuilder | string

    Returns any

setDatabase

  • setDatabase(database: db): void
  • Set DB created from external file

    Parameters

    • database: db

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc