OINO TS
    Preparing search index...

    Class OINODbAbstract

    Base class for database abstraction, implementing methods for connecting, making queries and parsing/formatting data between SQL and serialization formats.

    Hierarchy

    • unknown
      • OINODb
    Index

    Constructors

    Properties

    isConnected: boolean = false
    isValidated: boolean = false
    name: string

    Name of the database

    Methods

    • Handle a column schema request. Supports GET (fetch column schema), POST (add column) and DELETE (drop column). PUT is not supported and throws.

      Parameters

      • method: string

        HTTP method of the request (GET, POST, DELETE)

      • tableName: string

        name of the table

      • columnName: string

        name of the column (for GET/DELETE)

      • Optionalbody: string

        request body as JSON string (for POST)

      Returns Promise<OINODbSchemaResult>

    • Handle a table schema request. Supports GET (fetch schema), POST (create table) and DELETE (drop table). PUT is not supported and throws.

      Parameters

      • method: string

        HTTP method of the request (GET, POST, DELETE)

      • tableName: string

        name of the table

      • Optionalbody: string

        request body as JSON string (for POST)

      Returns Promise<OINODbSchemaResult>

    • Resolve the optimal native (SQL) type for a serialized field schema. Must throw if the requested internal type / parameter combination is not supported by the database.

      Parameters

      • schema: OINODataFieldSchema

        serialized field schema

      Returns string

    • Get the schema fields of a table as OINODataFields (without any API-level field filtering).

      Parameters

      • tableName: string

        name of the table

      Returns Promise<OINODataField[]>

    • Get the names of all user (base) tables in the database schema, excluding system tables and views.

      Returns Promise<string[]>

    • Initialize a data model for an API by fetching the schema fields (via getSchemaFields) and applying API-level field filtering and date-handling parameters.

      Parameters

      • api: OINODbApi

        api which data model to initialize.

      Returns Promise<void>

    • Print a column name using database specific SQL escaping.

      Parameters

      • sqlColumn: string

        name of the column

      Returns string

    • Print a database-specific bind-parameter placeholder for the given zero-based parameter index (e.g. Postgres $1, MySQL/SQLite ?, MSSQL @p0).

      Parameters

      • index: number

        zero-based index of the parameter in the statement's ordered value list

      Returns string

    • Print SQL ADD COLUMN statement.

      Parameters

      • tableName: string

        name of the table

      • field: OINODataField

        field to add

      Returns string

    • Print SQL CREATE TABLE statement.

      Parameters

      • tableName: string

        name of the table

      • fields: OINODataField[]

        fields of the table

      Returns string

    • Print SQL DROP COLUMN statement.

      Parameters

      • tableName: string

        name of the table

      • columnName: string

        name of the column

      Returns string

    • Print SQL DROP TABLE statement.

      Parameters

      • tableName: string

        name of the table

      Returns string

    • Print SQL select statement with DB specific formatting.

      Parameters

      • tableName: string

        The name of the table to select from.

      • columns: string

        The columns to be selected.

      • values: string

        The values to be inserted.

      • OptionalreturnIdFields: string[]

        the id fields to return if returnIds is true (if supported by the database)

      Returns string

    • Print SQL select statement with DB specific formatting.

      Parameters

      • tableName: string

        The name of the table to select from.

      • columnNames: string

        The columns to be selected.

      • whereCondition: string

        The WHERE clause to filter the results.

      • orderCondition: string

        The ORDER BY clause to sort the results.

      • limitCondition: string

        The LIMIT clause to limit the number of results.

      • groupByCondition: string

        The GROUP BY clause to group the results.

      Returns string

    • Print a table name using database specific SQL escaping.

      Parameters

      • sqlTable: string

        name of the table

      Returns string

    • Execute a parameterized statement produced by one of the OINODbDataModel.build*Statement methods, binding statement.values as database parameters. This is the safe execution path for statements that contain user-supplied values.

      Parameters

      Returns Promise<OINODataSet>

    • Execute other sql operations from a raw SQL string.

      NOTE: prefer runStatement (see sqlSelect).

      Parameters

      • sql: string

        SQL statement.

      Returns Promise<OINODataSet>

    • Execute a select operation from a raw SQL string.

      NOTE: prefer runStatement with a build*Statement-produced OINODbSqlStatement so that user values are bound as parameters. This raw-string form is kept for schema/DDL and other internally-constructed SQL.

      Parameters

      • sql: string

        SQL statement.

      Returns Promise<OINODataSet>