UNPKG

@abaplint/runtime

Version:
61 lines (60 loc) 1.8 kB
export interface DeleteDatabaseOptions { table: string; where: string; } export interface UpdateDatabaseOptions { table: string; where: string; set: string[]; } export interface InsertDatabaseOptions { table: string; columns: string[]; values: string[]; } export interface SelectDatabaseOptions { /** select statement, in ABAP SQL syntax */ select: string; /** list of primary key fields, in lower case, if known */ primaryKey?: string[]; } export interface SelectRuntimeOptions { appending?: boolean; } export type DatabaseValue = number | string | Uint8Array | null; export type DatabaseRow = { [name: string]: DatabaseValue; }; export type DatabaseRows = DatabaseRow[]; export interface SelectDatabaseResult { rows: DatabaseRows; } export type DatabaseCursorCallbacks = { fetchNextCursor: (packageSize: number) => Promise<SelectDatabaseResult>; closeCursor: () => Promise<void>; }; export interface DatabaseClient { /*** the type/name/identifier of the database */ name: string; connect(): Promise<void>; disconnect(): Promise<void>; /*** execute any native SQL command */ execute(sql: string | string[]): Promise<void>; beginTransaction(): Promise<void>; commit(): Promise<void>; rollback(): Promise<void>; delete(options: DeleteDatabaseOptions): Promise<{ subrc: number; dbcnt: number; }>; update(options: UpdateDatabaseOptions): Promise<{ subrc: number; dbcnt: number; }>; insert(options: InsertDatabaseOptions): Promise<{ subrc: number; dbcnt: number; }>; select(options: SelectDatabaseOptions): Promise<SelectDatabaseResult>; openCursor(options: SelectDatabaseOptions): Promise<DatabaseCursorCallbacks>; }