Skip to content

connExt.Catalog.Class.CatalogConnExt

Christian d'Heureuse edited this page Nov 27, 2026 · 1 revision

tedious-plus / connExt/Catalog / CatalogConnExt

Class: CatalogConnExt

Defined in: connExt/Catalog.ts:81

Catalog functions for a database connection.

This class is accessed via Connection.catalog.

Usage:

const pkColumns = await conn.catalog.getPrimaryKeyColumns("dbo.t1");
await conn.catalog.dropTable("#tmp", true);

Constructors

Constructor

new CatalogConnExt(connection): CatalogConnExt;

Defined in: connExt/Catalog.ts:88

Creates a CatalogConnExt object. Applications use Connection.catalog instead.

Parameters

connection

Connection

Returns

CatalogConnExt

Methods

dropTable()

dropTable(tableName, mayNotExist?): Promise<void>;

Defined in: connExt/Catalog.ts:217

Drops a table.

Parameters

tableName

string

The name of the table. It is inserted unchanged into the drop table statement.

mayNotExist?

boolean = false

true to ignore that the table does not exist.

Returns

Promise<void>


getPrimaryKeyColumns()

getPrimaryKeyColumns(table): Promise<IndexColumn[]>;

Defined in: connExt/Catalog.ts:170

Returns the primary key columns of a table, in the order of the key.

Parameters

table

TableRef

The table name or a resolved table.

Returns

Promise<IndexColumn[]>

A promise for the primary key columns, or an empty array if the table has no primary key.


getPrimaryKeyColumnsSql()

getPrimaryKeyColumnsSql(table): Promise<string>;

Defined in: connExt/Catalog.ts:198

Returns the primary key columns of a table as an SQL column list, e.g. [c], [a] desc. The column list can be used in an order by clause.

Parameters

table

TableRef

The table name or a resolved table.

Returns

Promise<string>

A promise for the column list, or an empty string if the table has no primary key.


resolveTable()

resolveTable(tableName): Promise<ResolvedTable>;

Defined in: connExt/Catalog.ts:130

Resolves a table name.

Supported are user-defined tables of the current database, tables of another database on the same server, and temporary tables. The table name is written as in SQL, e.g. t1, dbo.t1, [otherDb].[dbo].[t1] or #t1.

Parameters

tableName

string

The name of the table.

Returns

Promise<ResolvedTable>

A promise for the resolved table. The promise is rejected when the table does not exist or is not accessible.

Clone this wiki locally