Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SqljsDriver

Hierarchy

Implements

Index

Constructors

constructor

Properties

connection

connection: Connection

Connection used by driver.

dataTypeDefaults

dataTypeDefaults: DataTypeDefaults

Default values of length, precision and scale depends on column data type. Used in the cases when length/precision/scale is not specified by user.

Optional database

database: string

Master database used to perform all write queries.

databaseConnection

databaseConnection: any

Real database connection with sqlite database.

isReplicated

isReplicated: boolean = false

Indicates if replication is enabled.

Optional maxAliasLength

maxAliasLength: number

No documentation specifying a maximum length for identifiers could be found for SQLite.

options

Optional queryRunner

queryRunner: QueryRunner

Sqlite has a single QueryRunner because it works on a single database connection.

spatialTypes

spatialTypes: ColumnType[] = []

Gets list of spatial column data types.

sqlite

sqlite: any

SQLite underlying library.

supportedDataTypes

supportedDataTypes: ColumnType[] = ["int","integer","tinyint","smallint","mediumint","bigint","unsigned big int","int2","int8","integer","character","varchar","varying character","nchar","native character","nvarchar","text","clob","text","blob","real","double","double precision","float","real","numeric","decimal","boolean","date","time","datetime"]

Gets list of supported column data types by a driver.

see

https://www.tutorialspoint.com/sqlite/sqlite_data_types.htm

see

https://sqlite.org/datatype3.html

treeSupport

treeSupport: boolean = true

Indicates if tree tables are supported by this driver.

withLengthColumnTypes

withLengthColumnTypes: ColumnType[] = ["character","varchar","varying character","nchar","native character","nvarchar","text","blob","clob"]

Gets list of column data types that support length by a driver.

withPrecisionColumnTypes

withPrecisionColumnTypes: ColumnType[] = []

Gets list of column data types that support precision by a driver.

withScaleColumnTypes

withScaleColumnTypes: ColumnType[] = []

Gets list of column data types that support scale by a driver.

Methods

afterConnect

  • afterConnect(): Promise<void>

autoSave

  • autoSave(): Promise<void>
  • This gets called by the QueryRunner when a change to the database is made. If a custom autoSaveCallback is specified, it get's called with the database as Uint8Array, otherwise the save method is called which saves it to file (Node.js), local storage (browser) or indexedDB (browser with enabled useLocalForage option).

    Returns Promise<void>

buildTableName

  • buildTableName(tableName: string, schema?: string, database?: string): string

connect

  • connect(): Promise<void>

Protected createDatabaseConnection

  • createDatabaseConnection(): Promise<any>

Protected createDatabaseConnectionWithImport

  • createDatabaseConnectionWithImport(database?: Uint8Array): Promise<any>
  • Creates connection with an optional database. If database is specified it is loaded, otherwise a new empty database is created.

    Parameters

    • Optional database: Uint8Array

    Returns Promise<any>

createFullType

createGeneratedMap

  • createGeneratedMap(metadata: EntityMetadata, insertResult: any): any

createParameter

  • createParameter(parameterName: string, index: number): string

createQueryRunner

  • createQueryRunner(mode?: "master" | "slave"): QueryRunner

createSchemaBuilder

disconnect

  • disconnect(): Promise<void>

escape

  • escape(columnName: string): string

escapeQueryWithParameters

export

  • export(): Uint8Array

findChangedColumns

getColumnLength

isReturningSqlSupported

  • isReturningSqlSupported(): boolean

isUUIDGenerationSupported

  • isUUIDGenerationSupported(): boolean

load

  • load(fileNameOrLocalStorageOrData: string | Uint8Array, checkIfFileOrLocalStorageExists?: boolean): Promise<any>
  • Loads a database from a given file (Node.js), local storage key (browser) or array. This will delete the current database!

    Parameters

    • fileNameOrLocalStorageOrData: string | Uint8Array
    • Default value checkIfFileOrLocalStorageExists: boolean = true

    Returns Promise<any>

Protected loadDependencies

  • loadDependencies(): void

normalizeDefault

normalizeIsUnique

normalizeType

  • normalizeType(column: object): string

obtainMasterConnection

  • obtainMasterConnection(): Promise<any>

obtainSlaveConnection

  • obtainSlaveConnection(): Promise<any>

prepareHydratedValue

  • prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any

preparePersistentValue

  • preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any

save

  • save(location?: string): Promise<void>
  • Saved the current database to the given file (Node.js), local storage key (browser) or indexedDB key (browser with enabled useLocalForage option). If no location path is given, the location path in the options (if specified) will be used.

    Parameters

    • Optional location: string

    Returns Promise<void>

Object literals

mappedDataTypes

mappedDataTypes: object

Orm has special columns and we need to know what database column types should be for those types. Column types are driver dependant.

cacheDuration

cacheDuration: "int" = "int"

cacheId

cacheId: "int" = "int"

cacheIdentifier

cacheIdentifier: "varchar" = "varchar"

cacheQuery

cacheQuery: "text" = "text"

cacheResult

cacheResult: "text" = "text"

cacheTime

cacheTime: "bigint" = "bigint"

createDate

createDate: "datetime" = "datetime"

createDateDefault

createDateDefault: string = "datetime('now')"

metadataDatabase

metadataDatabase: "varchar" = "varchar"

metadataName

metadataName: "varchar" = "varchar"

metadataSchema

metadataSchema: "varchar" = "varchar"

metadataTable

metadataTable: "varchar" = "varchar"

metadataType

metadataType: "varchar" = "varchar"

metadataValue

metadataValue: "text" = "text"

migrationId

migrationId: "integer" = "integer"

migrationName

migrationName: "varchar" = "varchar"

migrationTimestamp

migrationTimestamp: "bigint" = "bigint"

treeLevel

treeLevel: "integer" = "integer"

updateDate

updateDate: "datetime" = "datetime"

updateDateDefault

updateDateDefault: string = "datetime('now')"

version

version: "integer" = "integer"

Generated using TypeDoc