lubejs-mssql
Version:
The lubejs driver for mssql.
537 lines (536 loc) • 25.6 kB
TypeScript
import { Binary, BuiltIn, XExpression, DbType, Expression, Scalar, ScalarFromDbType, Star, Numeric, Execute } from 'lubejs/core';
declare type InvokeHandler0<TResult extends Scalar> = () => Expression<TResult>;
declare type InvokeHandler1<TResult extends Scalar, TArg1 extends Scalar> = (expr: XExpression<TArg1>) => Expression<TResult>;
declare type InvokeHandler2<TResult extends Scalar, TArg1 extends Scalar, TArg2 extends Scalar> = (expr1: XExpression<TArg1>, expr2: XExpression<TArg2>) => Expression<TResult>;
export declare type DatePart = BuiltIn<keyof typeof DATE_PART>;
export declare const count: (expr: XExpression<Scalar> | Star) => Expression<number>;
export declare const avg: <T extends Numeric>(expr: XExpression<T>) => Expression<T>;
export declare const sum: <T extends Numeric>(expr: XExpression<T>) => Expression<T>;
export declare const max: <T extends Exclude<Scalar, Binary>>(expr: Expression<T>) => Expression<T>;
export declare const min: <T extends Exclude<Scalar, Binary>>(expr: Expression<T>) => Expression<T>;
export declare const exp: InvokeHandler1<Numeric, Numeric>;
export declare const round: (expr: XExpression<Numeric>, precision: XExpression<Numeric>) => Expression<Numeric>;
export declare const nvl: <T1 extends Scalar, T2 extends Scalar>(expr: XExpression<T1>, default_value: XExpression<T2>) => Expression<T1 | T2>;
export declare const stdev: InvokeHandler1<number, number>;
export declare const dateName: (part: DatePart, date: XExpression<Date>) => Expression<string>;
export declare const datePart: (part: DatePart, date: XExpression<Date>) => Expression<number>;
export declare const isNull: <T1 extends Scalar, T2 extends Scalar>(expr: XExpression<T1>, default_value: XExpression<T2>) => Expression<T1 | T2>;
export declare const len: InvokeHandler1<number, string>;
export declare const getDate: InvokeHandler0<Date>;
export declare const getUtcDate: InvokeHandler0<Date>;
export declare const month: InvokeHandler1<number, Date>;
export declare const year: InvokeHandler1<number, Date>;
export declare const day: InvokeHandler1<number, Date>;
export declare const dateAdd: (part: DatePart, increment: XExpression<number>, date: XExpression<Date>) => Expression<Date>;
export declare const dateDiff: (part: DatePart, startDate: XExpression<Date>, endDate: XExpression<Date>) => Expression<number>;
export declare const sysDateTime: InvokeHandler0<Date>;
export declare const sysUtcDateTime: InvokeHandler0<Date>;
export declare const sysDateTimeOffset: InvokeHandler0<Date>;
export declare const switchOffset: (date: XExpression<Date>, time_zone: XExpression<string>) => Expression<Date>;
export declare const charIndex: (pattern: XExpression<string>, str: XExpression<string>, startIndex?: XExpression<number>) => Expression<number>;
export declare const left: (str: XExpression<string>, length: XExpression<number>) => Expression<number>;
export declare const right: (str: XExpression<string>, length: XExpression<number>) => Expression<number>;
export declare const str: InvokeHandler1<string, Scalar>;
export declare const substring: (expr: XExpression<string>, start: XExpression<number>, length: XExpression<number>) => Expression<string>;
export declare const ascii: InvokeHandler1<number, string>;
export declare const unicode: InvokeHandler1<number, string>;
export declare const char: InvokeHandler1<string, number>;
export declare const nchar: InvokeHandler1<string, number>;
export declare const patIndex: (pattern: XExpression<string>, str: XExpression<string>) => Expression<number>;
export declare const ltrim: InvokeHandler1<string, string>;
export declare const rtrim: InvokeHandler1<string, string>;
export declare const space: InvokeHandler1<string, number>;
export declare const reverse: InvokeHandler1<string, string>;
export declare const stuff: (expression_to_be_searched: XExpression<string>, starting_position: XExpression<number>, number_of_chars: XExpression<number>, replacement_expression: XExpression<string>) => Expression<string>;
export declare const quotedName: InvokeHandler1<string, string>;
export declare const lower: InvokeHandler1<string, string>;
export declare const upper: InvokeHandler1<string, string>;
export declare const replace: (expression_to_be_searched: XExpression<string>, search_expression: XExpression<string>, replacement_expression: XExpression<string>) => Expression<string>;
export declare const abs: InvokeHandler1<Numeric, Numeric>;
export declare const acos: InvokeHandler1<Numeric, Numeric>;
export declare const asin: InvokeHandler1<Numeric, Numeric>;
export declare const atan: InvokeHandler1<Numeric, Numeric>;
export declare const atan2: InvokeHandler1<Numeric, Numeric>;
export declare const ceiling: InvokeHandler1<Numeric, Numeric>;
export declare const cos: InvokeHandler1<Numeric, Numeric>;
export declare const cot: InvokeHandler1<Numeric, Numeric>;
export declare const degrees: InvokeHandler1<Numeric, Numeric>;
export declare const floor: InvokeHandler1<Numeric, Numeric>;
export declare const log: InvokeHandler1<Numeric, Numeric>;
export declare const log10: InvokeHandler1<Numeric, Numeric>;
export declare const pi: InvokeHandler0<number>;
export declare const power: InvokeHandler2<Numeric, Numeric, Numeric>;
export declare const radians: InvokeHandler1<Numeric, Numeric>;
export declare const rand: InvokeHandler0<number>;
export declare const sign: InvokeHandler1<Numeric, Numeric>;
export declare const sin: InvokeHandler1<Numeric, Numeric>;
export declare const sqrt: InvokeHandler1<Numeric, Numeric>;
export declare const square: InvokeHandler1<Numeric, Numeric>;
export declare const tan: InvokeHandler1<Numeric, Numeric>;
/**
* 系统函数声明
*/
export declare const FUNCTION: {
count: (expr: XExpression<Scalar> | Star) => Expression<number>;
avg: <T extends Numeric>(expr: XExpression<T>) => Expression<T>;
sum: <T_1 extends Numeric>(expr: XExpression<T_1>) => Expression<T_1>;
max: <T_2 extends string | number | bigint | boolean | Date | import("lubejs/core").JsonObject | import("decimal.js-light").default | import("lubejs/core").Time | import("lubejs/core").Uuid | import("lubejs/core").List<string | number | bigint | boolean | Date | import("decimal.js-light").default | import("lubejs/core").Time | import("lubejs/core").Uuid | null> | null>(expr: Expression<T_2>) => Expression<T_2>;
min: <T_3 extends string | number | bigint | boolean | Date | import("lubejs/core").JsonObject | import("decimal.js-light").default | import("lubejs/core").Time | import("lubejs/core").Uuid | import("lubejs/core").List<string | number | bigint | boolean | Date | import("decimal.js-light").default | import("lubejs/core").Time | import("lubejs/core").Uuid | null> | null>(expr: Expression<T_3>) => Expression<T_3>;
abs: InvokeHandler1<Numeric, Numeric>;
exp: InvokeHandler1<Numeric, Numeric>;
round: (expr: XExpression<Numeric>, precision: XExpression<Numeric>) => Expression<Numeric>;
floor: InvokeHandler1<Numeric, Numeric>;
sqrt: InvokeHandler1<Numeric, Numeric>;
power: InvokeHandler2<Numeric, Numeric, Numeric>;
nvl: <T1 extends Scalar, T2 extends Scalar>(expr: XExpression<T1>, default_value: XExpression<T2>) => Expression<T1 | T2>;
stdev: InvokeHandler1<number, number>;
square: InvokeHandler1<Numeric, Numeric>;
dateName: (part: DatePart, date: XExpression<Date>) => Expression<string>;
datePart: (part: DatePart, date: XExpression<Date>) => Expression<number>;
isNull: <T1_1 extends Scalar, T2_1 extends Scalar>(expr: XExpression<T1_1>, default_value: XExpression<T2_1>) => Expression<T1_1 | T2_1>;
len: InvokeHandler1<number, string>;
getDate: InvokeHandler0<Date>;
getUtcDate: InvokeHandler0<Date>;
month: InvokeHandler1<number, Date>;
year: InvokeHandler1<number, Date>;
dateAdd: (part: DatePart, increment: XExpression<number>, date: XExpression<Date>) => Expression<Date>;
dateDiff: (part: DatePart, startDate: XExpression<Date>, endDate: XExpression<Date>) => Expression<number>;
sysDateTime: InvokeHandler0<Date>;
sysUtcDateTime: InvokeHandler0<Date>;
charIndex: (pattern: XExpression<string>, str: XExpression<string>, startIndex?: XExpression<number> | undefined) => Expression<number>;
left: (str: XExpression<string>, length: XExpression<number>) => Expression<number>;
right: (str: XExpression<string>, length: XExpression<number>) => Expression<number>;
str: InvokeHandler1<string, Scalar>;
substring: (expr: XExpression<string>, start: XExpression<number>, length: XExpression<number>) => Expression<string>;
ascii: InvokeHandler1<number, string>;
char: InvokeHandler1<string, number>;
unicode: InvokeHandler1<number, string>;
nchar: InvokeHandler1<string, number>;
patIndex: (pattern: XExpression<string>, str: XExpression<string>) => Expression<number>;
ltrim: InvokeHandler1<string, string>;
rtrim: InvokeHandler1<string, string>;
space: InvokeHandler1<string, number>;
reverse: InvokeHandler1<string, string>;
stuff: (expression_to_be_searched: XExpression<string>, starting_position: XExpression<number>, number_of_chars: XExpression<number>, replacement_expression: XExpression<string>) => Expression<string>;
quotedName: InvokeHandler1<string, string>;
lower: InvokeHandler1<string, string>;
upper: InvokeHandler1<string, string>;
replace: (expression_to_be_searched: XExpression<string>, search_expression: XExpression<string>, replacement_expression: XExpression<string>) => Expression<string>;
rand: InvokeHandler0<number>;
acos: InvokeHandler1<Numeric, Numeric>;
asin: InvokeHandler1<Numeric, Numeric>;
atan: InvokeHandler1<Numeric, Numeric>;
atan2: InvokeHandler1<Numeric, Numeric>;
ceiling: InvokeHandler1<Numeric, Numeric>;
cos: InvokeHandler1<Numeric, Numeric>;
cot: InvokeHandler1<Numeric, Numeric>;
degrees: InvokeHandler1<Numeric, Numeric>;
log: InvokeHandler1<Numeric, Numeric>;
log10: InvokeHandler1<Numeric, Numeric>;
pi: InvokeHandler0<number>;
radians: InvokeHandler1<Numeric, Numeric>;
sign: InvokeHandler1<Numeric, Numeric>;
sin: InvokeHandler1<Numeric, Numeric>;
tan: InvokeHandler1<Numeric, Numeric>;
};
export declare const YEAR: BuiltIn<"YEAR">;
export declare const YY: BuiltIn<"YY">;
export declare const YYYY: BuiltIn<"YYYY">;
export declare const QUARTER: BuiltIn<"QUARTER">;
export declare const QQ: BuiltIn<"QQ">;
export declare const Q: BuiltIn<"Q">;
export declare const MONTH: BuiltIn<"MONTH">;
export declare const MM: BuiltIn<"MM">;
export declare const M: BuiltIn<"M">;
export declare const DAYOFYEAR: BuiltIn<"DAYOFYEAR">;
export declare const DY: BuiltIn<"DY">;
export declare const Y: BuiltIn<"Y">;
export declare const DAY: BuiltIn<"DAY">;
export declare const DD: BuiltIn<"DD">;
export declare const D: BuiltIn<"D">;
export declare const WEEK: BuiltIn<"WEEK">;
export declare const WK: BuiltIn<"WK">;
export declare const WW: BuiltIn<"WW">;
export declare const WEEKDAY: BuiltIn<"WEEKDAY">;
export declare const DW: BuiltIn<"DW">;
export declare const HOUR: BuiltIn<"HOUR">;
export declare const HH: BuiltIn<"HH">;
export declare const MINUTE: BuiltIn<"MINUTE">;
export declare const MI: BuiltIn<"MI">;
export declare const N: BuiltIn<"N">;
export declare const SECOND: BuiltIn<"SECOND">;
export declare const SS: BuiltIn<"SS">;
export declare const S: BuiltIn<"S">;
export declare const MILLISECOND: BuiltIn<"MILLISECOND">;
export declare const MS: BuiltIn<"MS">;
/**
* 日期格式部分
*/
export declare const DATE_PART: {
YEAR: BuiltIn<"YEAR">;
YY: BuiltIn<"YY">;
YYYY: BuiltIn<"YYYY">;
QUARTER: BuiltIn<"QUARTER">;
QQ: BuiltIn<"QQ">;
Q: BuiltIn<"Q">;
MONTH: BuiltIn<"MONTH">;
MM: BuiltIn<"MM">;
M: BuiltIn<"M">;
DAYOFYEAR: BuiltIn<"DAYOFYEAR">;
DY: BuiltIn<"DY">;
Y: BuiltIn<"Y">;
DAY: BuiltIn<"DAY">;
DD: BuiltIn<"DD">;
D: BuiltIn<"D">;
WEEK: BuiltIn<"WEEK">;
WK: BuiltIn<"WK">;
WW: BuiltIn<"WW">;
WEEKDAY: BuiltIn<"WEEKDAY">;
DW: BuiltIn<"DW">;
HOUR: BuiltIn<"HOUR">;
HH: BuiltIn<"HH">;
MINUTE: BuiltIn<"MINUTE">;
MI: BuiltIn<"MI">;
N: BuiltIn<"N">;
SECOND: BuiltIn<"SECOND">;
SS: BuiltIn<"SS">;
S: BuiltIn<"S">;
MILLISECOND: BuiltIn<"MILLISECOND">;
MS: BuiltIn<"MS">;
};
/**
* 最后一次插入数据的标识列值
*/
export declare const IDENTITY: import("lubejs/core").Variant<number, "@IDENTITY">;
/**
* 最后一次执行受影响函数
*/
export declare const ROWCOUNT: import("lubejs/core").Variant<number, "@ROWCOUNT">;
/**
* 返回自上次启动 Microsoft SQL Server以来连接或试图连接的次数。
*/
export declare const CONNECTIONS: import("lubejs/core").Variant<number, "@CONNECTIONS">;
/**
* 返回自上次启动 Microsoft SQL Server以来 CPU 的工作时间,单位为毫秒(基于系统计时器的分辨率)。
*/
export declare const CPU_BUSY: import("lubejs/core").Variant<number, "@CPU_BUSY">;
/**
* 返回 SET DATEFIRST 参数的当前值,SET DATEFIRST 参数指明所规定的每周第一天:1 对应星期一,2 对应星期二,依次类推,用 7 对应星期日。
*/
export declare const DATEFIRST: import("lubejs/core").Variant<number, "@DATEFIRST">;
/**
* 返回 Microsoft SQL Server自上次启动后用于执行输入和输出操作的时间,单位为毫秒(基于系统计时器的分辨率)。
*/
export declare const IO_BUSY: import("lubejs/core").Variant<number, "@IO_BUSY">;
/**
* 返回当前所使用语言的本地语言标识符(ID)。
*/
export declare const LANGID: import("lubejs/core").Variant<number, "@LANGID">;
/**
* 返回当前使用的语言名。
*/
export declare const LANGUAGE: import("lubejs/core").Variant<string, "@LANGUAGE">;
/**
* 返回 Microsoft SQL Server上允许的同时用户连接的最大数。返回的数不必为当前配置的数值。
*/
export declare const MAX_CONNECTIONS: import("lubejs/core").Variant<number, "@MAX_CONNECTIONS">;
/**
* 返回 Microsoft SQL Server自上次启动后从网络上读取的输入数据包数目。
*/
export declare const PACK_RECEIVED: import("lubejs/core").Variant<number, "@PACK_RECEIVED">;
/**
* 返回 Microsoft SQL Server自上次启动后写到网络上的输出数据包数目。
*/
export declare const PACK_SENT: import("lubejs/core").Variant<number, "@PACK_SENT">;
/**
* 返回自 SQL Server 上次启动后,在 Microsoft SQL Server连接上发生的网络数据包错误数。
*/
export declare const PACKET_ERRORS: import("lubejs/core").Variant<number, "@PACKET_ERRORS">;
/**
* 返回运行 Microsoft SQL Server的本地服务器名称。
*/
export declare const SERVERNAME: import("lubejs/core").Variant<string, "@SERVERNAME">;
/**
* 返回 Microsoft SQL Server正在其下运行的注册表键名。若当前实例为默认实例,则 @SERVICENAME 返回 MSSQLServer;若当前实例是命名实例,则该函数返回实例名。
*/
export declare const SERVICENAME: import("lubejs/core").Variant<string, "@SERVICENAME">;
/**
* 返回当前用户进程的服务器进程标识符 (ID)。
*/
export declare const SPID: import("lubejs/core").Variant<number, "@SPID">;
/**
* 返回一刻度的微秒数。
*/
export declare const TIMETICKS: import("lubejs/core").Variant<number, "@TIMETICKS">;
/**
* 返回 Microsoft SQL Server自上次启动后,所遇到的磁盘读/写错误数。
*/
export declare const TOTAL_ERRORS: import("lubejs/core").Variant<number, "@TOTAL_ERRORS">;
/**
* 返回 Microsoft SQL Server自上次启动后写入磁盘的次数。
*/
export declare const TOTAL_WRITE: import("lubejs/core").Variant<number, "@TOTAL_WRITE">;
/**
* 返回 Microsoft SQL Server当前安装的日期、版本和处理器类型。
*/
export declare const VERSION: import("lubejs/core").Variant<string, "@VERSION">;
/**
* 返回 Microsoft SQL Server自上次启动后读取磁盘(不是读取高速缓存)的次数。
*/
export declare const TOTAL_READ: import("lubejs/core").Variant<number, "@TOTAL_READ">;
/**
* 系统变量
*/
export declare const VARIANTS: {
/**
* 最后一次插入数据的标识列值
*/
IDENTITY: import("lubejs/core").Variant<number, "@IDENTITY">;
/**
* 最后一次执行受影响函数
*/
ROWCOUNT: import("lubejs/core").Variant<number, "@ROWCOUNT">;
/**
* 返回自上次启动 Microsoft SQL Server以来连接或试图连接的次数。
*/
CONNECTIONS: import("lubejs/core").Variant<number, "@CONNECTIONS">;
/**
* 返回自上次启动 Microsoft SQL Server以来 CPU 的工作时间,单位为毫秒(基于系统计时器的分辨率)。
*/
CPU_BUSY: import("lubejs/core").Variant<number, "@CPU_BUSY">;
/**
* 返回 SET DATEFIRST 参数的当前值,SET DATEFIRST 参数指明所规定的每周第一天:1 对应星期一,2 对应星期二,依次类推,用 7 对应星期日。
*/
DATEFIRST: import("lubejs/core").Variant<number, "@DATEFIRST">;
/**
* 返回 Microsoft SQL Server自上次启动后用于执行输入和输出操作的时间,单位为毫秒(基于系统计时器的分辨率)。
*/
IO_BUSY: import("lubejs/core").Variant<number, "@IO_BUSY">;
/**
* 返回当前所使用语言的本地语言标识符(ID)。
*/
LANGID: import("lubejs/core").Variant<number, "@LANGID">;
/**
* 返回当前使用的语言名。
*/
LANGUAGE: import("lubejs/core").Variant<string, "@LANGUAGE">;
/**
* 返回 Microsoft SQL Server上允许的同时用户连接的最大数。返回的数不必为当前配置的数值。
*/
MAX_CONNECTIONS: import("lubejs/core").Variant<number, "@MAX_CONNECTIONS">;
/**
* 返回 Microsoft SQL Server自上次启动后从网络上读取的输入数据包数目。
*/
PACK_RECEIVED: import("lubejs/core").Variant<number, "@PACK_RECEIVED">;
/**
* 返回 Microsoft SQL Server自上次启动后写到网络上的输出数据包数目。
*/
PACK_SENT: import("lubejs/core").Variant<number, "@PACK_SENT">;
/**
* 返回自 SQL Server 上次启动后,在 Microsoft SQL Server连接上发生的网络数据包错误数。
*/
PACKET_ERRORS: import("lubejs/core").Variant<number, "@PACKET_ERRORS">;
/**
* 返回运行 Microsoft SQL Server的本地服务器名称。
*/
SERVERNAME: import("lubejs/core").Variant<string, "@SERVERNAME">;
/**
* 返回 Microsoft SQL Server正在其下运行的注册表键名。若当前实例为默认实例,则 @SERVICENAME 返回 MSSQLServer;若当前实例是命名实例,则该函数返回实例名。
*/
SERVICENAME: import("lubejs/core").Variant<string, "@SERVICENAME">;
/**
* 返回当前用户进程的服务器进程标识符 (ID)。
*/
SPID: import("lubejs/core").Variant<number, "@SPID">;
/**
* 返回一刻度的微秒数。
*/
TIMETICKS: import("lubejs/core").Variant<number, "@TIMETICKS">;
/**
* 返回 Microsoft SQL Server自上次启动后,所遇到的磁盘读/写错误数。
*/
TOTAL_ERRORS: import("lubejs/core").Variant<number, "@TOTAL_ERRORS">;
/**
* 返回 Microsoft SQL Server自上次启动后写入磁盘的次数。
*/
TOTAL_WRITE: import("lubejs/core").Variant<number, "@TOTAL_WRITE">;
/**
* 返回 Microsoft SQL Server当前安装的日期、版本和处理器类型。
*/
VERSION: import("lubejs/core").Variant<string, "@VERSION">;
/**
* 返回 Microsoft SQL Server自上次启动后读取磁盘(不是读取高速缓存)的次数。
*/
TOTAL_READ: import("lubejs/core").Variant<number, "@TOTAL_READ">;
};
export declare const MssqlDbType: {
bit: any;
decimal(p: number, s?: number | undefined): DbType;
numeric(p: number, s?: number | undefined): DbType;
money: any;
smallmoney: any;
tinyint: any;
smallint: any;
int: any;
bigint: any;
float: ((n: number) => DbType) & DbType;
real: any;
date: any;
time: ((s: number) => DbType) & DbType;
datetime: any;
smalldatetime: any;
datetime2: ((p: number) => DbType) & DbType;
datetimeoffset: ((p?: number | undefined) => DbType) & DbType;
char: ((l: number) => DbType) & DbType;
nchar: ((l: number) => DbType) & DbType;
varchar: ((l: number) => DbType) & DbType;
nvarchar: ((l: number) => DbType) & DbType;
/**
* @deprecated 该类型在未来版本将被删除
*/
text: any;
/**
* @deprecated 该类型在未来版本将被删除
*/
ntext: any;
/**
* @deprecated 该类型在未来版本将被删除
*/
image: any;
binary: ((l: number) => DbType) & DbType;
varbinary: ((l?: number | "max" | "MAX" | undefined) => DbType) & DbType;
};
export declare type SQL_VARIANT = {
name: 'sql_variant' | 'sv';
};
export declare type SV = SQL_VARIANT;
export declare type INTEGER = {
name: 'int' | 'integer';
};
export declare type INT = INTEGER;
export declare type BIGINT = {
name: 'bint' | 'bigint';
};
export declare type BINT = BIGINT;
export declare type SMALLINT = {
name: 'smallint' | 'sint';
};
export declare type SINT = SMALLINT;
export declare type TINYINT = {
name: 'tinyint' | 'tint';
};
export declare type TINT = TINYINT;
export declare type DECIMAL = {
name: 'decimal' | 'dec';
precision: number;
digit?: number;
};
export declare type DEC = DECIMAL;
export declare type NUMERIC = {
name: 'numeric' | 'num';
precision: number;
digit?: number;
};
export declare type NUM = NUMERIC;
export declare type REAL = {
name: 'real' | 'r';
};
export declare type R = REAL;
export declare type FLOAT = {
name: 'FLOAT32';
precision?: number;
};
export declare type MONEY = {
type: 'money' | 'mn';
};
export declare type MN = MONEY;
export declare type SMALLMONEY = {
name: 'smallmoney' | 'smn';
};
export declare type SMN = SMALLMONEY;
export declare type CHAR = {
name: 'char';
length: number;
};
export declare type NCHAR = {
name: 'nchar';
length: number;
};
export declare type VARCHAR = {
name: 'varchar';
length: number | 'MAX';
};
export declare type NVARCHAR = {
name: 'nvarchar';
length: number | 'MAX';
};
export declare type SYSNAME = {
name: 'sysname';
};
export declare type TEXT = {
name: 'text';
length: number;
};
export declare type NTEXT = {
name: 'ntext';
length: number;
};
export declare type DATATIME = {
name: 'datatime';
};
export declare type SMALLDATATIME = {
name: 'smalldatatime';
};
export declare type BINARY = {
name: 'binary';
length: number;
};
export declare type VARBINARY = {
name: 'varbinary';
length: number;
};
export declare type IMAGE = {
name: 'image';
};
export declare type BIT = {
name: 'bit';
};
export declare type MssqlDbType = SQL_VARIANT | INTEGER | INT | CHAR | VARCHAR | FLOAT | DECIMAL | BINARY | VARBINARY;
export declare function convert<T extends DbType>(type: T, expr: XExpression, styleId?: XExpression<number>): Expression<ScalarFromDbType<T>>;
export declare const format: (date: XExpression<Date>, format: XExpression<string>) => Expression<string>;
/**
* 获取当前数据库名称
*/
export declare const db_name: () => Expression<string>;
/**
* 获取当前架构名称
*/
export declare const schema_name: () => Expression<string>;
/**
* 获取对象ID
*/
export declare const object_id: (name: XExpression<string>) => Expression<number>;
/**
* 通过对象ID获取对象名称
*/
export declare const object_name: (objectId: XExpression<number>) => Expression<string>;
/**
* 获取对象定义代码
*/
export declare const object_definition: (objectId: XExpression<number>) => Expression<string>;
/**
* 获取数据库的上级ID
*/
export declare const database_principal_id: (dbName: XExpression<string>) => Expression<string>;
/**
* 获取数据库的上级ID
*/
export declare const db_id: (dbName: XExpression<string>) => Expression<number>;
/**
* 系统重命名函数
*/
export declare const sp_rename: (name: string, newName: string, kind?: 'USERDATATYPE' | 'OBJECT' | 'COLUMN' | 'INDEX' | 'DATABASE') => Execute;
export declare const sp_addextendedproperty: (name: string, value: string, level0Type: 'SCHEMA' | 'DATABASE', level0: string, level1Type?: 'TABLE' | 'PROCEDURE' | 'FUNCTION', level1?: string, level2Type?: 'CONSTRAINT' | 'COLUMN', level2?: string) => Execute;
export declare const sp_dropextendedproperty: (name: string, level0Type: 'SCHEMA' | 'DATABASE', level0: string, level1Type?: 'TABLE' | 'PROCEDURE' | 'FUNCTION', level1?: string, level2Type?: 'CONSTRAINT' | 'COLUMN', level2?: string) => Execute;
export declare const sp_updateextendedproperty: (name: string, value: string, level0Type: 'SCHEMA' | 'DATABASE', level0: string, level1Type?: 'TABLE' | 'PROCEDURE' | 'FUNCTION', level1?: string, level2Type?: 'CONSTRAINT' | 'COLUMN', level2?: string) => Execute;
export {};