MCPcopy Create free account
hub / github.com/bytebase/bytebase / createMSSQLDriver

Function createMSSQLDriver

backend/plugin/schema/mssql/testutil_test.go:15–31  ·  view source on GitHub ↗

createMSSQLDriver creates and opens a MSSQL driver connection

(ctx context.Context, host, port, database string)

Source from the content-addressed store, hash-verified

13
14// createMSSQLDriver creates and opens a MSSQL driver connection
15func createMSSQLDriver(ctx context.Context, host, port, database string) (db.Driver, error) {
16 driver := &mssqldb.Driver{}
17 config := db.ConnectionConfig{
18 DataSource: &storepb.DataSource{
19 Type: storepb.DataSourceType_ADMIN,
20 Username: "sa",
21 Host: host,
22 Port: port,
23 Database: database,
24 },
25 Password: "Test123!",
26 ConnectionContext: db.ConnectionContext{
27 DatabaseName: database,
28 },
29 }
30 return driver.Open(ctx, storepb.Engine_MSSQL, config)
31}
32
33// executeSQL executes SQL statements, handling GO separators
34func executeSQL(ctx context.Context, driver db.Driver, sql string) error {

Calls 1

OpenMethod · 0.95

Tested by

no test coverage detected