Skip to content
Oxford Harrison edited this page Nov 15, 2024 · 13 revisions

DOCSAPI


Client is the base object for the various top-level clients in Linked QL. Each instance implements the following methods:

API Description
client.query() Run an arbitrary query.
client.createDatabase() Programmatically perform a CREATE DATABASE operation.
client.renameDatabase() Programmatically perform a RENAME DATABASE operation.
client.alterDatabase() Programmatically perform an ALTER DATABASE operation.
client.dropDatabase() Programmatically perform a DROP DATABASE operation.
client.hasDatabase() Check if a database exists.
client.databases() Get the list of databases.
client.database() Obtain a Database instance.
client.schema() Obtain the root schema instance.
client.listen() Bind an event listener.
client.getPID() Get your client connection ID.

Instantiation

Instances of the Linked QL client are created as shown in the getting started guide. See ClientOptions below for the list of options shared by most or all clients.

ClientOptions

interface ClientOptions {
    // Language options
    dialect?: string;
    ansiQuotes?: boolean;
    // Language extensions
    mysqlReturningClause?: boolean;
    // Schema options
    schemaSelector?: object | object[];
    schemaCacheInvalidation?: number;
    // Savepoints options
    clientID?: string;
};
Param Interfaces Description
dialect? - An optional parameter that specifies the SQL dialect of your database: mysql | postgres. Defaults to postgres.
ansiQuotes? - An optional parameter that, when true, tells the parser to treat double quotes " as an identifier quote character rather than as a string quote character. Defaults to false for dialect === 'mysql'; true otherwise.
mysqlReturningClause? - An optional flag that controls Linked QL's experimental support for a RETURNING clause in MySQL. Defaults to true
schemaSelector? - An optional flag that controls the list of schemas included or excluded in Linked QL's Automatic Schema Inference mode. Defaults to ['!information_schema', '!linked_db%', '!pg_%'] for dialect === 'postgres'; ['!information_schema', '!linked_db%'] otherwise.
schemaCacheInvalidation? - An optional flag that controls how cache invalidation works in Linked QL's Automatic Schema Inference: 0 === "lookup once and never invalidate"; 1 === "lookup once and invalidate on relevant DDL operations"; 2 === "lookup on each query". Defaults to 1.
clientID? - An optional means of identification of the Linked QL instance. Client IDs are encoded into every DDL operation in Linked QL for audit purposes. Can be any agreed-upon identifier; e.g. application code name, etc. Required if the Linked DB's config.require_client_ids is active.
Clone this wiki locally