File tree Expand file tree Collapse file tree 4 files changed +388
-23
lines changed Expand file tree Collapse file tree 4 files changed +388
-23
lines changed Original file line number Diff line number Diff line change 1010 "echarts" : " 5.4.1" ,
1111 "expr-eval" : " ^2.0.2" ,
1212 "lodash" : " ^4.17.21" ,
13+ "mssql" : " ^11.0.1" ,
1314 "mysql2" : " ^3.11.3" ,
1415 "json5" : " ^2.2.3" ,
1516 "pg" : " ^8.10.0" ,
Original file line number Diff line number Diff line change 11import { Client as PgClient } from 'pg' ; // PostgreSQL 客户端
22import mysql from 'mysql2/promise' ; // MySQL 客户端
3+ import mssql from 'mssql' ; // SQL Server 客户端
34
45type Props = {
56 databaseType : string ;
@@ -52,6 +53,20 @@ const main = async ({
5253 const [ rows ] = await connection . execute ( sql ) ;
5354 result = rows ;
5455 await connection . end ( ) ;
56+ } else if ( databaseType === 'Microsoft SQL Server' ) {
57+ const pool = await mssql . connect ( {
58+ server : host ,
59+ port : parseInt ( port , 10 ) ,
60+ database : databaseName ,
61+ user,
62+ password,
63+ options : {
64+ trustServerCertificate : true
65+ }
66+ } ) ;
67+
68+ result = await pool . query ( sql ) ;
69+ await pool . close ( ) ;
5570 }
5671 return {
5772 result
Original file line number Diff line number Diff line change 4242 {
4343 "label" : " PostgreSQL" ,
4444 "value" : " PostgreSQL"
45+ },
46+ {
47+ "label" : " Microsoft SQL Server" ,
48+ "value" : " Microsoft SQL Server"
4549 }
4650 ],
4751 "required" : true
You can’t perform that action at this time.
0 commit comments