How to use node-firebird-driver - 10 common examples

To help you get started, we’ve selected a few node-firebird-driver 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 / fb-util.ts View on Github external
const outBuilder = metadata.getBuilderSync(status)!;
	try {
		for (let i = metadata.getCountSync(status) - 1; i >= 0; --i) {
			switch (metadata.getTypeSync(status, i)) {
				// Transforms CHAR descriptors to VARCHAR.
				case sqlTypes.SQL_TEXT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_VARYING);
					break;

				// Transforms numeric descriptors to DOUBLE PRECISION.
				case sqlTypes.SQL_SHORT:
				case sqlTypes.SQL_LONG:
				case sqlTypes.SQL_INT64:
				case sqlTypes.SQL_FLOAT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_DOUBLE);
					outBuilder.setLengthSync(status, i, 8);
					outBuilder.setScaleSync(status, i, 0);
					break;
			}
		}

		ret = outBuilder.getMetadataSync(status)!;
	}
	finally {
		outBuilder.releaseSync();
	}

	metadata.releaseSync();

	return ret;
}
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / fb-util.ts View on Github external
let ret: fb.MessageMetadata;

	const outBuilder = metadata.getBuilderSync(status)!;
	try {
		for (let i = metadata.getCountSync(status) - 1; i >= 0; --i) {
			switch (metadata.getTypeSync(status, i)) {
				// Transforms CHAR descriptors to VARCHAR.
				case sqlTypes.SQL_TEXT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_VARYING);
					break;

				// Transforms numeric descriptors to DOUBLE PRECISION.
				case sqlTypes.SQL_SHORT:
				case sqlTypes.SQL_LONG:
				case sqlTypes.SQL_INT64:
				case sqlTypes.SQL_FLOAT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_DOUBLE);
					outBuilder.setLengthSync(status, i, 8);
					outBuilder.setScaleSync(status, i, 0);
					break;
			}
		}

		ret = outBuilder.getMetadataSync(status)!;
	}
	finally {
		outBuilder.releaseSync();
	}

	metadata.releaseSync();

	return ret;
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / fb-util.ts View on Github external
let ret: fb.MessageMetadata;

	const outBuilder = metadata.getBuilderSync(status)!;
	try {
		for (let i = metadata.getCountSync(status) - 1; i >= 0; --i) {
			switch (metadata.getTypeSync(status, i)) {
				// Transforms CHAR descriptors to VARCHAR.
				case sqlTypes.SQL_TEXT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_VARYING);
					break;

				// Transforms numeric descriptors to DOUBLE PRECISION.
				case sqlTypes.SQL_SHORT:
				case sqlTypes.SQL_LONG:
				case sqlTypes.SQL_INT64:
				case sqlTypes.SQL_FLOAT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_DOUBLE);
					outBuilder.setLengthSync(status, i, 8);
					outBuilder.setScaleSync(status, i, 0);
					break;
			}
		}

		ret = outBuilder.getMetadataSync(status)!;
	}
	finally {
		outBuilder.releaseSync();
	}

	metadata.releaseSync();
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / fb-util.ts View on Github external
return undefined;

	let ret: fb.MessageMetadata;

	const outBuilder = metadata.getBuilderSync(status)!;
	try {
		for (let i = metadata.getCountSync(status) - 1; i >= 0; --i) {
			switch (metadata.getTypeSync(status, i)) {
				// Transforms CHAR descriptors to VARCHAR.
				case sqlTypes.SQL_TEXT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_VARYING);
					break;

				// Transforms numeric descriptors to DOUBLE PRECISION.
				case sqlTypes.SQL_SHORT:
				case sqlTypes.SQL_LONG:
				case sqlTypes.SQL_INT64:
				case sqlTypes.SQL_FLOAT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_DOUBLE);
					outBuilder.setLengthSync(status, i, 8);
					outBuilder.setScaleSync(status, i, 0);
					break;
			}
		}

		ret = outBuilder.getMetadataSync(status)!;
	}
	finally {
		outBuilder.releaseSync();
	}

	metadata.releaseSync();
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / fb-util.ts View on Github external
if (!metadata)
		return undefined;

	let ret: fb.MessageMetadata;

	const outBuilder = metadata.getBuilderSync(status)!;
	try {
		for (let i = metadata.getCountSync(status) - 1; i >= 0; --i) {
			switch (metadata.getTypeSync(status, i)) {
				// Transforms CHAR descriptors to VARCHAR.
				case sqlTypes.SQL_TEXT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_VARYING);
					break;

				// Transforms numeric descriptors to DOUBLE PRECISION.
				case sqlTypes.SQL_SHORT:
				case sqlTypes.SQL_LONG:
				case sqlTypes.SQL_INT64:
				case sqlTypes.SQL_FLOAT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_DOUBLE);
					outBuilder.setLengthSync(status, i, 8);
					outBuilder.setScaleSync(status, i, 0);
					break;
			}
		}

		ret = outBuilder.getMetadataSync(status)!;
	}
	finally {
		outBuilder.releaseSync();
	}
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / fb-util.ts View on Github external
export function fixMetadata(status: fb.Status, metadata?: fb.MessageMetadata): fb.MessageMetadata | undefined {
	if (!metadata)
		return undefined;

	let ret: fb.MessageMetadata;

	const outBuilder = metadata.getBuilderSync(status)!;
	try {
		for (let i = metadata.getCountSync(status) - 1; i >= 0; --i) {
			switch (metadata.getTypeSync(status, i)) {
				// Transforms CHAR descriptors to VARCHAR.
				case sqlTypes.SQL_TEXT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_VARYING);
					break;

				// Transforms numeric descriptors to DOUBLE PRECISION.
				case sqlTypes.SQL_SHORT:
				case sqlTypes.SQL_LONG:
				case sqlTypes.SQL_INT64:
				case sqlTypes.SQL_FLOAT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_DOUBLE);
					outBuilder.setLengthSync(status, i, 8);
					outBuilder.setScaleSync(status, i, 0);
					break;
			}
		}

		ret = outBuilder.getMetadataSync(status)!;
github asfernandes / node-firebird-drivers / packages / node-firebird-driver-native / src / lib / fb-util.ts View on Github external
export function fixMetadata(status: fb.Status, metadata?: fb.MessageMetadata): fb.MessageMetadata | undefined {
	if (!metadata)
		return undefined;

	let ret: fb.MessageMetadata;

	const outBuilder = metadata.getBuilderSync(status)!;
	try {
		for (let i = metadata.getCountSync(status) - 1; i >= 0; --i) {
			switch (metadata.getTypeSync(status, i)) {
				// Transforms CHAR descriptors to VARCHAR.
				case sqlTypes.SQL_TEXT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_VARYING);
					break;

				// Transforms numeric descriptors to DOUBLE PRECISION.
				case sqlTypes.SQL_SHORT:
				case sqlTypes.SQL_LONG:
				case sqlTypes.SQL_INT64:
				case sqlTypes.SQL_FLOAT:
					outBuilder.setTypeSync(status, i, sqlTypes.SQL_DOUBLE);
					outBuilder.setLengthSync(status, i, 8);
					outBuilder.setScaleSync(status, i, 0);
					break;
			}
		}

		ret = outBuilder.getMetadataSync(status)!;
	}
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 infoReq = new Uint8Array([blobInfo.totalLength]);
			const infoRet = new Uint8Array(20);
			await this.blobHandle!.getInfoAsync(status, infoReq.byteLength, infoReq, infoRet.byteLength, infoRet);

			if (infoRet[0] != blobInfo.totalLength)
				throw new Error('Unrecognized response from Blob::getInfo.');

			const size = getPortableInteger(infoRet.subarray(1), 2);

			return getPortableInteger(infoRet.subarray(3), size);
		});
	}
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 infoReq = new Uint8Array([blobInfo.totalLength]);
			const infoRet = new Uint8Array(20);
			await this.blobHandle!.getInfoAsync(status, infoReq.byteLength, infoReq, infoRet.byteLength, infoRet);

			if (infoRet[0] != blobInfo.totalLength)
				throw new Error('Unrecognized response from Blob::getInfo.');

			const size = getPortableInteger(infoRet.subarray(1), 2);

			return getPortableInteger(infoRet.subarray(3), size);
		});
	}
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 infoReq = new Uint8Array([blobInfo.totalLength]);
			const infoRet = new Uint8Array(20);
			await this.blobHandle!.getInfoAsync(status, infoReq.byteLength, infoReq, infoRet.byteLength, infoRet);

			if (infoRet[0] != blobInfo.totalLength)
				throw new Error('Unrecognized response from Blob::getInfo.');

			const size = getPortableInteger(infoRet.subarray(1), 2);

			return getPortableInteger(infoRet.subarray(3), size);
		});
	}