SpatiaLiteDriver
A TypeORM driver for working with SpatiaLite databases.
Extends
SqliteDriver
Constructors
new SpatiaLiteDriver()
new SpatiaLiteDriver(dataSource): SpatiaLiteDriver
Parameters
Parameter | Type |
---|---|
dataSource | DataSource |
Returns
Overrides
SqliteDriver.constructor
Properties
attachedDatabases
attachedDatabases: DatabasesMap;
Any attached databases (excepting default 'main')
Inherited from
SqliteDriver.attachedDatabases
connection
connection: DataSource;
Connection used by driver.
Inherited from
SqliteDriver.connection
cteCapabilities
cteCapabilities: CteCapabilities;
Inherited from
SqliteDriver.cteCapabilities
database?
optional database: string;
Master database used to perform all write queries.
Inherited from
SqliteDriver.database
databaseConnection
databaseConnection: Database;
Real database connection with sqlite database.
Overrides
SqliteDriver.databaseConnection
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.
Inherited from
SqliteDriver.dataTypeDefaults
isReplicated
isReplicated: boolean;
Indicates if replication is enabled.
Inherited from
SqliteDriver.isReplicated
mappedDataTypes
mappedDataTypes: MappedColumnTypes;
Orm has special columns and we need to know what database column types should be for those types. Column types are driver dependant.
Inherited from
SqliteDriver.mappedDataTypes
maxAliasLength?
optional maxAliasLength: number;
No documentation specifying a maximum length for identifiers could be found for SQLite.
Inherited from
SqliteDriver.maxAliasLength
options
options: SqliteConnectionOptions;
Connection options.
Inherited from
SqliteDriver.options
queryRunner
queryRunner: SpatiaLiteQueryRunner;
Sqlite has a single QueryRunner because it works on a single database connection.
Overrides
SqliteDriver.queryRunner
spatialTypes
spatialTypes: ColumnType[];
Gets list of spatial column data types.
Inherited from
SqliteDriver.spatialTypes
sqlite
sqlite: any;
SQLite underlying library.
Inherited from
SqliteDriver.sqlite
supportedDataTypes
supportedDataTypes: ColumnType[];
Gets list of supported column data types by a driver.
See
Inherited from
SqliteDriver.supportedDataTypes
supportedUpsertTypes
supportedUpsertTypes: UpsertType[];
Returns type of upsert supported by driver if any
Inherited from
SqliteDriver.supportedUpsertTypes
transactionSupport
transactionSupport: "simple" | "nested" | "none";
Represent transaction support by this driver
Inherited from
SqliteDriver.transactionSupport
treeSupport
treeSupport: boolean;
Indicates if tree tables are supported by this driver.
Inherited from
SqliteDriver.treeSupport
withLengthColumnTypes
withLengthColumnTypes: ColumnType[];
Gets list of column data types that support length by a driver.
Inherited from
SqliteDriver.withLengthColumnTypes
withPrecisionColumnTypes
withPrecisionColumnTypes: ColumnType[];
Gets list of column data types that support precision by a driver.
Inherited from
SqliteDriver.withPrecisionColumnTypes
withScaleColumnTypes
withScaleColumnTypes: ColumnType[];
Gets list of column data types that support scale by a driver.
Inherited from
SqliteDriver.withScaleColumnTypes
Methods
afterConnect()
afterConnect(): Promise<void>
Makes any action after connection (e.g. create extensions in Postgres driver).
Returns
Promise
<void
>
Inherited from
SqliteDriver.afterConnect
attachDatabases()
protected attachDatabases(): Promise<void>
Performs the attaching of the database files. The attachedDatabase should have been populated during calls to #buildTableName during EntityMetadata production (see EntityMetadata#buildTablePath)
https://sqlite.org/lang_attach.html
Returns
Promise
<void
>
Inherited from
SqliteDriver.attachDatabases
buildTableName()
buildTableName(
tableName,
_schema?,
database?): string
For SQLite, the database may be added in the decorator metadata. It will be a filepath to a database file.
Parameters
Parameter | Type |
---|---|
tableName | string |
_schema ? | string |
database ? | string |
Returns
string
Inherited from
SqliteDriver.buildTableName
connect()
connect(): Promise<void>
Performs connection to the database.
Returns
Promise
<void
>
Inherited from
SqliteDriver.connect
createDatabaseConnection()
protected createDatabaseConnection(): Promise<any>
Creates connection with the database.
Returns
Promise
<any
>
Inherited from
SqliteDriver.createDatabaseConnection
createDatabaseDirectory()
protected createDatabaseDirectory(fullPath): Promise<void>
Auto creates database directory if it does not exist.
Parameters
Parameter | Type |
---|---|
fullPath | string |
Returns
Promise
<void
>
Inherited from
SqliteDriver.createDatabaseDirectory
createFullType()
createFullType(column): string
Normalizes "default" value of the column.
Parameters
Parameter | Type |
---|---|
column | TableColumn |
Returns
string
Inherited from
SqliteDriver.createFullType
createGeneratedMap()
createGeneratedMap(
metadata,
insertResult,
entityIndex,
entityNum): any
Creates generated map of values generated or returned by database after INSERT query.
Parameters
Parameter | Type |
---|---|
metadata | EntityMetadata |
insertResult | any |
entityIndex | number |
entityNum | number |
Returns
any
Inherited from
SqliteDriver.createGeneratedMap
createParameter()
createParameter(parameterName, index): string
Creates an escaped parameter.
Parameters
Parameter | Type |
---|---|
parameterName | string |
index | number |
Returns
string
Inherited from
SqliteDriver.createParameter
createQueryRunner()
createQueryRunner(): QueryRunner
Creates a query runner used to execute database queries.
Returns
QueryRunner
Overrides
SqliteDriver.createQueryRunner
createSchemaBuilder()
createSchemaBuilder(): RdbmsSchemaBuilder
Creates a schema builder used to build and sync a schema.
Returns
RdbmsSchemaBuilder
Inherited from
SqliteDriver.createSchemaBuilder
disconnect()
disconnect(): Promise<void>
Closes connection with database.
Returns
Promise
<void
>
Inherited from
SqliteDriver.disconnect
escape()
escape(columnName): string
Escapes a column name.
Parameters
Parameter | Type |
---|---|
columnName | string |
Returns
string
Inherited from
SqliteDriver.escape
escapeQueryWithParameters()
escapeQueryWithParameters(
sql,
parameters,
nativeParameters): [string, any[]]
Replaces parameters in the given sql with special escaping character and an array of parameter names to be passed to a query.
Parameters
Parameter | Type |
---|---|
sql | string |
parameters | ObjectLiteral |
nativeParameters | ObjectLiteral |
Returns
[string
, any
[]]
Inherited from
SqliteDriver.escapeQueryWithParameters
findChangedColumns()
findChangedColumns(tableColumns, columnMetadatas): ColumnMetadata[]
Differentiate columns of this table and columns from the given column metadatas columns and returns only changed.
Parameters
Parameter | Type |
---|---|
tableColumns | TableColumn [] |
columnMetadatas | ColumnMetadata [] |
Returns
ColumnMetadata
[]
Inherited from
SqliteDriver.findChangedColumns
getAttachedDatabaseHandleByRelativePath()
getAttachedDatabaseHandleByRelativePath(path): undefined | string
Parameters
Parameter | Type |
---|---|
path | string |
Returns
undefined
| string
Inherited from
SqliteDriver.getAttachedDatabaseHandleByRelativePath
getAttachedDatabasePathRelativeByHandle()
getAttachedDatabasePathRelativeByHandle(handle): undefined | string
Parameters
Parameter | Type |
---|---|
handle | string |
Returns
undefined
| string
Inherited from
SqliteDriver.getAttachedDatabasePathRelativeByHandle
getColumnLength()
getColumnLength(column): string
Calculates column length taking into account the default length values.
Parameters
Parameter | Type |
---|---|
column | ColumnMetadata |
Returns
string
Inherited from
SqliteDriver.getColumnLength
getMainDatabasePath()
protected getMainDatabasePath(): string
Returns
string
Inherited from
SqliteDriver.getMainDatabasePath
hasAttachedDatabases()
hasAttachedDatabases(): boolean
Returns
boolean
Inherited from
SqliteDriver.hasAttachedDatabases
isFullTextColumnTypeSupported()
isFullTextColumnTypeSupported(): boolean
Returns true if driver supports fulltext indices.
Returns
boolean
Inherited from
SqliteDriver.isFullTextColumnTypeSupported
isReturningSqlSupported()
isReturningSqlSupported(): boolean
Returns true if driver supports RETURNING / OUTPUT statement.
Returns
boolean
Inherited from
SqliteDriver.isReturningSqlSupported
isUUIDGenerationSupported()
isUUIDGenerationSupported(): boolean
Returns true if driver supports uuid values generation on its own.
Returns
boolean
Inherited from
SqliteDriver.isUUIDGenerationSupported
loadDependencies()
protected loadDependencies(): void
If driver dependency is not given explicitly, then try to load it via "require".
Returns
void
Inherited from
SqliteDriver.loadDependencies
loadExtension()
protected loadExtension(extensionPath): Promise<void>
Load a SQLite extension.
Parameters
Parameter | Type |
---|---|
extensionPath | string |
Returns
Promise
<void
>
loadSpatialiteExtension()
loadSpatialiteExtension(): Promise<void>
Returns
Promise
<void
>
normalizeDefault()
normalizeDefault(columnMetadata): undefined | string
Normalizes "default" value of the column.
Parameters
Parameter | Type |
---|---|
columnMetadata | ColumnMetadata |
Returns
undefined
| string
Inherited from
SqliteDriver.normalizeDefault
normalizeIsUnique()
normalizeIsUnique(column): boolean
Normalizes "isUnique" value of the column.
Parameters
Parameter | Type |
---|---|
column | ColumnMetadata |
Returns
boolean
Inherited from
SqliteDriver.normalizeIsUnique
normalizeType()
normalizeType(column): string
Creates a database type from a given column metadata.
Parameters
Parameter | Type |
---|---|
column | object |
column.length ? | string | number |
column.precision ? | null | number |
column.scale ? | number |
column.type ? | ColumnType |
Returns
string
Inherited from
SqliteDriver.normalizeType
obtainMasterConnection()
obtainMasterConnection(): Promise<any>
Obtains a new database connection to a master server. Used for replication. If replication is not setup then returns default connection's database connection.
Returns
Promise
<any
>
Inherited from
SqliteDriver.obtainMasterConnection
obtainSlaveConnection()
obtainSlaveConnection(): Promise<any>
Obtains a new database connection to a slave server. Used for replication. If replication is not setup then returns master (default) connection's database connection.
Returns
Promise
<any
>
Inherited from
SqliteDriver.obtainSlaveConnection
parseTableName()
parseTableName(target): object
Parse a target table name or other types and return a normalized table definition.
Parameters
Parameter | Type |
---|---|
target | | string | Table | View | TableForeignKey | EntityMetadata |
Returns
object
database?
optional database: string;
schema?
optional schema: string;