Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebSqlStore

stores LiveData into the WebSQL database.

example

// The default configuration will save the complete model data as json // into a database column with the name "data" class MyCollection extends Relution.livedata.Collection {}; MyCollection.prototype.model = MyModel; MyCollection.prototype.entity = 'MyTableName'; MyCollection.prototype.store = new Relution.livedata.WebSqlStore();

// If you want to use specific columns you can specify the fields // in the entity of your model like this: class MyModel extends Relution.livedata.Model {}; MyModel.prototype.idAttribute = 'id';

Hierarchy

Hierarchy-Diagram

Index

Constructors

constructor

Properties

_type

_type: string

Protected db

db: Database

endpoints

endpoints: any

Protected entities

entities: object

Type declaration

  • [entity: string]: object

isCollection

isCollection: boolean

isModel

isModel: boolean

isStore

isStore: boolean

Protected name

name: string

Protected size

size: number

Private transactionPromise

transactionPromise: Promise<Object>

Protected trigger

trigger: trigger

Protected version

version: string

Methods

Protected _checkData

  • _checkData(options: any, data: Model[]): boolean
  • Parameters

    • options: any
    • data: Model[]

    Returns boolean

Protected _checkDb

  • _checkDb(options: any): boolean
  • Parameters

    • options: any

    Returns boolean

Protected _checkTable

  • _checkTable(options: any, callback: Function): void
  • Parameters

    • options: any
    • callback: Function

    Returns void

Protected _createTable

  • _createTable(options: any): void
  • Parameters

    • options: any

    Returns void

Protected _delete

  • Parameters

    Returns void

Protected _dropTable

  • _dropTable(options: any): void
  • Parameters

    • options: any

    Returns void

Protected _executeSql

  • _executeSql(options: any): void
  • Parameters

    • options: any

    Returns void

Protected _executeTransaction

  • _executeTransaction(options: any, statements: Statement | string, result?: any): void
  • Parameters

    • options: any
    • statements: Statement | string
    • Optional result: any

    Returns void

Protected _insertOrReplace

  • Parameters

    Returns void

Private _openDb

  • _openDb(options: any): void
  • Parameters

    • options: any

    Returns void

Protected _select

  • Parameters

    Returns void

Protected _sqlCreateTable

  • _sqlCreateTable(entity: string): string
  • Parameters

    • entity: string

    Returns string

Protected _sqlDelete

  • _sqlDelete(options: any, entity: string): string
  • Parameters

    • options: any
    • entity: string

    Returns string

Protected _sqlDropTable

  • _sqlDropTable(entity: string): string
  • Parameters

    • entity: string

    Returns string

Protected _sqlSelect

  • _sqlSelect(options: any, entity: string): string
  • Parameters

    • options: any
    • entity: string

    Returns string

Protected _sqlUpdateDatabase

  • _sqlUpdateDatabase(oldVersion: string | DOMString, newVersion: string): Array<string>
  • Parameters

    • oldVersion: string | DOMString
    • newVersion: string

    Returns Array<string>

Protected _sqlValue

  • _sqlValue(value: any): string
  • Parameters

    • value: any

    Returns string

Protected _sqlWhereFromData

  • _sqlWhereFromData(options: any, entity: string): string
  • Parameters

    • options: any
    • entity: string

    Returns string

Private _updateDb

  • Parameters

    Returns void

close

  • close(): void
  • closes the database.

    Returns void

create

Protected createTable

  • createTable(options: any): void
  • Parameters

    • options: any

    Returns void

destroy

  • destroy(model: Model, options?: ModelDestroyOptions): void
  • Parameters

    • model: Model
    • Optional options: ModelDestroyOptions

    Returns void

Protected drop

  • drop(options: any): void
  • Parameters

    • options: any

    Returns void

Protected execute

  • execute(options: any): void
  • Parameters

    • options: any

    Returns void

fetch

  • fetch(collection: Model, options: ModelFetchOptions): Promise<any>
  • fetch(collection: Collection, options: CollectionFetchOptions): Promise<any>
  • Parameters

    • collection: Model

      usually a collection, but can also be a model

    • options: ModelFetchOptions

    Returns Promise<any>

  • Parameters

    • collection: Collection

      usually a collection, but can also be a model

    • options: CollectionFetchOptions

    Returns Promise<any>

Protected handleError

  • handleError(options: object, error: Error): any
  • Parameters

    • options: object
    • error: Error

    Returns any

Protected handleSuccess

  • handleSuccess(options: object, result: any): any
  • Parameters

    • options: object
    • result: any

    Returns any

initCollection

  • initCollection(collection: Collection, options?: any): void

initModel

  • initModel(model: Model, options?: any): void
  • Parameters

    • model: Model
    • Optional options: any

    Returns void

save

  • save(model: Model, attributes?: any, options?: ModelSaveOptions): any
  • Parameters

    • model: Model
    • Optional attributes: any
    • Optional options: ModelSaveOptions

    Returns any

Protected select

  • select(options: any): void
  • Parameters

    • options: any

    Returns void

sync

  • sync(method: string, model: Model | Collection, options?: any): Promise<any>
  • Parameters

    Returns Promise<any>

Generated using TypeDoc