tedious
Version:
A TDS driver, for connecting to MS SQLServer databases.
19 lines (18 loc) • 1.01 kB
TypeScript
import type WritableTrackingBuffer from '../tracking-buffer/writable-tracking-buffer';
/**
* The number of bytes the magnitude of a `decimal` or `numeric` value takes
* at `precision`.
*/
export declare function decimalLength(precision: number | undefined): 4 | 8 | 12 | 16;
/**
* Writes the TYPE_INFO of a `decimal` or `numeric` column: the nullable type
* id, the length of a value, and the precision and scale.
*/
export declare function writeDecimalTypeInfo(buffer: WritableTrackingBuffer, id: number, precision: number | undefined, scale: number | undefined): void;
/**
* Writes a validated `decimal` or `numeric` value: the length, the sign,
* and the scaled magnitude as a little-endian unsigned integer spanning the
* full width for the precision. `name` names the type in the error for a
* value that does not fit.
*/
export declare function writeDecimal(buffer: WritableTrackingBuffer, value: number | null, precision: number | undefined, scale: number | undefined, name: string): void;