feat(db): add Microsoft SQL Server driver support (#276)

The database tool window can connect to Microsoft SQL Server (tiberius over rustls with a bb8 pool): browse schema objects, edit table data, run queries and view plans; SQL Server dialect, object dialogs and icons in the UI.

Values are rendered by column type: exact decimal/numeric, money with four decimals, tinyint, uniqueidentifier, date/time/datetime/datetime2/smalldatetime/datetimeoffset in ISO form, xml and binary. Multi-statement edits roll back on any failure and discard the connection rather than returning it to the pool mid-transaction; connect-time errors (login, database) are reported; result pagination reports more rows; cancelling a query stops reading and drops the stream. The sqlx drivers keep the shared with_pool! path.

Co-authored-by: dimassfeb-09 <[email protected]>
Цей коміт міститься в:
DIMAS FEBRIYANTO authored and GitHub committed 2026-10-29 23:50:19 +08:00
1 джерело d1f84ef364
коміт 3a1e47d872
20 files changed
+974 -43

No files matched your search

+37
Переглянути файл
@@ -154,6 +154,29 @@ export const DATA_TYPES: Record<DbDriver, string[]> = {
"BOOLEAN",
"ENUM",
],
sqlServer: [
"INT",
"BIGINT",
"SMALLINT",
"TINYINT",
"VARCHAR",
"NVARCHAR",
"CHAR",
"NCHAR",
"TEXT",
"NTEXT",
"DECIMAL",
"FLOAT",
"REAL",
"DATE",
"DATETIME",
"DATETIME2",
"TIME",
"UNIQUEIDENTIFIER",
"BIT",
"VARBINARY",
"XML",
],
};
const f = (name: string, params: string, returns?: string, aggregate?: boolean): SqlFunction => ({
@@ -260,6 +283,20 @@ const FUNCTIONS: Record<DbDriver, SqlFunction[]> = {
f("row_number", "", "bigint"),
f("rank", "", "bigint"),
],
sqlServer: [
...COMMON,
f("getdate", "", "datetime"),
f("getutcdate", "", "datetime"),
f("dateadd", "part, n, date", "datetime"),
f("datediff", "part, a, b", "int"),
f("isnull", "a, b"),
f("iif", "cond, then, else"),
f("concat", "value, ...", "text"),
f("format", "value, format", "text"),
f("newid", "", "uniqueidentifier"),
f("row_number", "", "bigint"),
f("rank", "", "bigint"),
],
};
export function functions(driver: DbDriver): SqlFunction[] {