UNPKG

node-firebird-driver

Version:
133 lines (130 loc) 4.17 kB
import { Attachment, ConnectOptions, CreateBlobOptions, CreateDatabaseOptions, Transaction, TransactionOptions } from '..'; /** SQL_* type constants */ export declare namespace sqlTypes { const SQL_TEXT = 452; const SQL_VARYING = 448; const SQL_SHORT = 500; const SQL_LONG = 496; const SQL_FLOAT = 482; const SQL_DOUBLE = 480; const SQL_TIMESTAMP = 510; const SQL_BLOB = 520; const SQL_TYPE_TIME = 560; const SQL_TYPE_DATE = 570; const SQL_INT64 = 580; const SQL_TIMESTAMP_TZ_EX = 32748; const SQL_TIME_TZ_EX = 32750; const SQL_TIMESTAMP_TZ = 32754; const SQL_TIME_TZ = 32756; const SQL_INT128 = 32752; const SQL_DEC16 = 32760; const SQL_DEC34 = 32762; const SQL_BOOLEAN = 32764; const SQL_NULL = 32766; } /** DPB constants. */ export declare namespace dpb { const version1 = 1; const lc_ctype = 48; const force_write = 24; const user_name = 28; const password = 29; const sql_role_name = 60; } /** TPB constants. */ export declare namespace tpb { const version1 = 1; const consistency = 1; const concurrency = 2; const wait = 6; const nowait = 7; const read = 8; const write = 9; const ignore_limbo = 14; const read_committed = 15; const autocommit = 16; const rec_version = 17; const no_rec_version = 18; const restart_requests = 19; const no_auto_undo = 20; } /** BPB constants. */ export declare namespace bpb { const version1 = 1; const source_type = 1; const target_type = 2; const type = 3; const source_interp = 4; const target_interp = 5; const filter_parameter = 6; const storage = 7; const type_segmented = 0; const type_stream = 1; const storage_main = 0; const storage_temp = 2; } /** EPB constants. */ export declare namespace epb { const version1 = 1; } /** Blob info. */ export declare namespace blobInfo { const totalLength = 6; } /** Statement info. */ export declare namespace statementInfo { const sqlExecPathBlrText = 32; } /** Common info. */ export declare namespace commonInfo { const end = 1; const truncated = 2; const error = 3; const dataNotReady = 4; const length = 126; const flagEnd = 127; } export declare namespace cancelType { const disable = 1; const enable = 2; const raise = 3; const abort = 4; } export declare namespace charSets { const ascii = 2; } export declare function createDpb(options?: ConnectOptions | CreateDatabaseOptions): Buffer; export declare function createTpb(options?: TransactionOptions): Buffer; export declare function createBpb(options?: CreateBlobOptions): Buffer; /** Changes a number from a scale to another. */ /*** export function changeScale(value: number, inputScale: number, outputScale: number): number { outputScale -= inputScale; Math.pow(10, outputScale); if (outputScale === 0) return value; else if (outputScale > 0) return value / Math.pow(10, outputScale); else // outputScale < 0 return value * Math.pow(10, -outputScale); } ***/ /** Emulate Firebird isc_portable_integer. */ export declare function getPortableInteger(buffer: Uint8Array, length: number): number; /** Descriptor for a field or parameter. */ export interface Descriptor { type: number; subType: number; length: number; scale: number; offset: number; nullOffset: number; } export type DataReader = (attachment: Attachment, transaction: Transaction, buffer: Uint8Array) => Promise<any[]>; export type ItemReader = (attachment: Attachment, transaction: Transaction, buffer: Uint8Array) => Promise<any>; /** Creates a data reader. */ export declare function createDataReader(descriptors: Descriptor[]): DataReader; export type DataWriter = (attachment: Attachment, transaction: Transaction, buffer: Uint8Array, values: Array<any> | undefined) => Promise<void>; export type ItemWriter = (attachment: Attachment, transaction: Transaction, buffer: Uint8Array, values: any) => Promise<void>; /** Creates a data writer. */ export declare function createDataWriter(descriptors: Descriptor[]): DataWriter;