How to use node-firebird-native-api - 7 common examples

To help you get started, we’ve selected a few node-firebird-native-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / statement.ts View on Github external
return await attachment.client.statusAction(async status => {
			//// FIXME: options/flags, dialect
			statement.statementHandle = await attachment!.attachmentHandle!.prepareAsync(status, transaction.transactionHandle,
				0, sqlStmt, 3, fb.Statement.PREPARE_PREFETCH_ALL);

			statement.inMetadata = fixMetadata(status, await statement.statementHandle!.getInputMetadataAsync(status));
			statement.outMetadata = fixMetadata(status, await statement.statementHandle!.getOutputMetadataAsync(status));

			if (statement.inMetadata) {
				statement.inBuffer = new Uint8Array(statement.inMetadata.getMessageLengthSync(status));
				statement.dataWriter = createDataWriter(createDescriptors(status, statement.inMetadata));
			}

			if (statement.outMetadata) {
				statement.outBuffer = new Uint8Array(statement.outMetadata.getMessageLengthSync(status));
				statement.dataReader = createDataReader(createDescriptors(status, statement.outMetadata));
			}

			return statement;
		});
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / resultset.ts View on Github external
while (true) {
				let nextFetch: number;

				try {
					nextFetch = await nextFetchPromise;
				}
				catch (e) {
					if (rows.length == 0)
						throw e;
					else {
						this.delayedError = e;
						return { finished: false, rows };
					}
				}

				if (nextFetch == fb.Status.RESULT_OK) {
					const buffer1 = buffer;
					buffer = ++buffer % 2;

					const finish = options && options.fetchSize && rows.length + 1 >= options.fetchSize;

					if (!finish)
						nextFetchPromise = this.resultSetHandle!.fetchNextAsync(status, buffers[buffer]);

					rows.push(await this.statement.dataReader(this.statement.attachment, this.transaction, buffers[buffer1]));

					if (finish)
						return { finished: false, rows };
				}
				else {
					return { finished: true, rows };
				}
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / blob.ts View on Github external
return await this.attachment.client.statusAction(async status => {
			const readingBytes = Math.min(buffer.length, MAX_SEGMENT_SIZE);
			const segLength = new Uint32Array(1);
			const result = await this.blobHandle!.getSegmentAsync(status, readingBytes, buffer, segLength);

			if (result == fb.Status.RESULT_NO_DATA)
				return -1;

			return segLength[0];
		});
	}
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / events.ts View on Github external
protected async internalCancel(): Promise {
		if (this.eventCallback) {
			const { eventCallback } = this;
			this.eventCallback = undefined!;
			await fb.cancelEvent(eventCallback);
		}
	}
}
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / client.ts View on Github external
protected async internalDispose(): Promise {
		this.dispatcher!.releaseSync();
		fb.disposeMaster(this.master!);

		this.util = undefined;
		this.dispatcher = undefined;
		this.master = undefined;
	}
}
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / client.ts View on Github external
constructor(library: string) {
		super();
		this.master = fb.getMaster(library);
		this.dispatcher = this.master.getDispatcherSync();
		this.util = this.master.getUtilInterfaceSync();
	}
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / events.ts View on Github external
static async queue(attachment: AttachmentImpl, names: string[], callBack: (counters: [string, number][]) => Promise):
			Promise {
		const events = new EventsImpl(attachment);
		const { client } = attachment;

		events.eventCallback = await fb.queueEvent(client.master!, attachment.attachmentHandle!, names, callBack);

		return events;
	}