Class OINODbAbstract

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

Constructors

Properties

name: string

Name of the database

Methods

  • Connect to database.

    Returns Promise<OINOResult>

  • Initialize a data model by getting the SQL schema and populating OINODbDataFields of the model.

    Parameters

    • api: OINODbApi

      api which data model to initialize.

    Returns Promise<void>

  • Parse a single SQL result value for serialization using the context of the native data type.

    Parameters

    • sqlValue: OINODataCell

      data from serialization

    • sqlType: string

      native type name for table column

    Returns OINODataCell

  • Print a single data value from serialization using the context of the native data type with the correct SQL escaping.

    Parameters

    • cellValue: OINODataCell

      data from sql results

    • sqlType: string

      native type name for table column

    Returns string

  • Print a column name with correct SQL escaping.

    Parameters

    • sqlColumn: string

      name of the column

    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 single string value as valid sql literal

    Parameters

    • sqlString: string

      string value

    Returns string

  • Print a table name using database specific SQL escaping.

    Parameters

    • sqlTable: string

      name of the table

    Returns string

  • Validate connection to database is working.

    Returns Promise<OINOResult>