Base class for SQL Utility functions, you can sub-class this class to create your own SQL Utility functions/override existing functionality.

Constructors

Properties

_batchScriptCounter: number = 0

Methods

  • This method will build a two dimensional array of EntityInfo objects. The first dimension of the array is the level of the entity in the dependency tree. The second dimension of the array is the entities at that level. The entities at each level are NOT dependent on any other entity in that level or any level below it. This method uses the foreign key information witin the Entity Fields array to find these dependencies. self-referencing foreign keys are ignored.

    Parameters

    Returns EntityInfo[][]

  • Returns a file name for a given DB Object given a type, schema and object name. The basic format is to have a directory for each schema, and within each directory the file name for each object has this format: ....sql Where in the above format the is only included if the isPermissions flag is true. For example: getDBObjectFileName('view', 'dbo', 'MyView', false, true) => 'dbo/MyView.view.generated.sql' getDBObjectFileName('view', 'dbo', 'MyView', true, true) => 'dbo/MyView.view.permissions.generated.sql' getDBObjectFileName('full_text_search_function', 'dbo', 'tableName', false, true) => 'dbo/tableName.fulltext.generated.sql'

    Parameters

    • type: "function" | "index" | "view" | "sp" | "full_text_search_function"
    • schema: string
    • objectName: string
    • isPermissions: boolean
    • isGenerated: boolean

    Returns string

  • Identifies which entities had views that failed to refresh by checking if their base views are still valid

    Parameters

    • ds: ConnectionPool

      DataSource for database queries

    • entities: EntityInfo[]

      List of entities to check

    Returns Promise<EntityInfo[]>

    Array of entities whose views failed to refresh

  • Parameters

    • ds: ConnectionPool
    • excludeSchemas: string[]
    • applyPermissions: boolean
    • Optional excludeEntities: string[]

    Returns Promise<boolean>

  • Regenerates base views for entities that failed the refresh process using the full CodeGen approach

    Parameters

    • ds: ConnectionPool

      DataSource for database operations

    • entities: EntityInfo[]

      List of entities whose views need to be regenerated

    Returns Promise<boolean>

    True if all regenerations succeeded, false otherwise