Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IConnection

This represents a connection to an akera.io application server and provides both direct data access (CRUD) as well as an API interface that allows calling any 4GL business logic provided the server have the API module(s) enabled.

Hierarchy

  • IConnection

Index

Properties

address

address: string

The address of the remote end of this connection.

autoReconnect

autoReconnect: boolean

If set to true the connection is automatically re-established as needed if disconnected.

available

available: boolean

Depending on the connection state this can be used to check if the connection can accept new requests.

catalog

An alias to the meta-data information.

closed

closed: boolean

Flag set to true if the connection was already closed.

logger

logger: AkeraLogger

Optional logger instance to record details about API message exchange.

meta

Handle to the meta-data information of the connection.

query

Handle to the query builder interface that can be used to create various queries and run them on current connection.

state

The current 'state' of the connection.

Methods

call

  • Alias for run method.

    Parameters

    • ablCall: IABLCall

      The information about business logic call, including parameters.

    • Optional timeout: number

    Returns Promise<IABLResult>

connect

  • connect(timeout?: number): Promise<void>
  • Establish the connection to the akera.io application server.

    Parameters

    • Optional timeout: number

      The timeout value to use for establishing the connection (milliseconds).

    Returns Promise<void>

create

  • Asynchronously executes the create query on a given connection and, when fulfilled, returns the newly created row.

    since

    1.1.0

    Parameters

    • query: IQueryInsert

      The create query to execute.

    • Optional upsert: boolean
    • Optional timeout: number

      The query execution timeout (milliseconds).

    Returns Promise<Record>

delete

  • delete(query: IQueryDelete, timeout?: number): Promise<number>
  • Asynchronously executes the delete query on a given connection and, when fulfilled, returns the number of affected (deleted) rows.

    since

    1.1.0

    Parameters

    • query: IQueryDelete

      The delete query to execute.

    • Optional timeout: number

      The query execution timeout (milliseconds).

    Returns Promise<number>

disconnect

  • disconnect(): Promise<void>
  • Close the connection to the akera.io application server.

    Returns Promise<void>

execute

  • Alias for run method.

    Parameters

    • ablCall: IABLCall

      The information about business logic call, including parameters.

    • Optional timeout: number

    Returns Promise<IABLResult>

getEncoding

  • getEncoding(): Promise<string>
  • Returns the encoding used as internal code-page by the akera.io server.

    Returns Promise<string>

getSelectedDatabase

  • getSelectedDatabase(): Promise<string>
  • Returns the logical name of the default database for this connection, if any set.

    Returns Promise<string>

run

  • Executes a business logic call (procedure, function, class method) by passing input/input-output parameters and returns the result:

    • the function/method return
    • all output/input-output parameters

    Parameters

    • ablCall: IABLCall

      The information about business logic call, including parameters.

    • Optional timeout: number

    Returns Promise<IABLResult>

select

  • Asynchronously executes a select query and, when fulfilled, returns all the rows that satisfy the filter condition.

    since

    1.1.0

    Parameters

    • query: IQuerySelect

      The select query to execute.

    • Optional timeout: number

      The query execution timeout (milliseconds).

    Returns Promise<Record[]>

selectDatabase

  • selectDatabase(dbName: string): Promise<void>
  • Set the default database of the connection, when table names are not fully qualified this database is used by default.

    Parameters

    • dbName: string

      The logical name of the database to be set as default.

    Returns Promise<void>

update

  • Asynchronously executes the update query on the connection and, when fulfilled, returns the updated row(s).

    since

    1.1.0

    Parameters

    • query: IQueryUpdate

      The update query to execute.

    • Optional timeout: number

      The query execution timeout (milliseconds).

    Returns Promise<Record | Record[]>

webRequest

  • Asynchronously executes the web request on a web handler and stream the response back to the web response.

    since

    1.1.1

    Parameters

    • request: IWebRequest

      The web request to execute.

    • response: IWebResponse

      The web response object to write the response into.

    • Optional timeout: number

    Returns Promise<void>