BaseConnection

Base class of a connection

A base class for the connection types of QDB, either Connection or PartialConnection. Both classes extend from this base and are both subject to a standard method and some properties which are listed below.

To create your own connection class, extend the base and add a constructor.

const {BaseConnection} = require("qdatabase");
class MyConnection extends BaseConnection {
	constructor (Path) {
		super();
		this.Path = Path;
	}
}

Or on the other hand, you could also extend from the Connection class and add your own data management functions to further interact with QDB.

Properties

.Path

Always a nill value when using this class, unless in a connection.
Type - Null

.State

The current state of this connection. When using this class, it will always be 'BASE' unless you're in a (partial) connection.
Type - String

.Cache

A Cache Collection which is free to use within this connection.
Type - Cache

Methods

.Reconnect(PathURL)

Reconnects to a different file and state under this class instance.

Parameter Type Description
PathURL String The URL to the new database file.

Returns - Connection | This
Returns the new connection or the same class if the path is invalid.