Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Use `sqlcmd` to create SQL Server and Azure SQL Edge instances using a local con
To create a local SQL Server instance with the AdventureWorksLT database restored, query it, and connect to it using Azure Data Studio, run:

```
sqlcmd create mssql --accept-eula --using https://aka.ms/AdventureWorksLT.bak
sqlcmd create mssql --accept-eula --use https://aka.ms/AdventureWorksLT.bak
sqlcmd query "SELECT DB_NAME()"
sqlcmd open ads
```
Expand Down
7 changes: 5 additions & 2 deletions cmd/modern/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/microsoft/go-sqlcmd/internal/output"
"github.com/microsoft/go-sqlcmd/internal/output/verbosity"
"github.com/microsoft/go-sqlcmd/internal/pal"
"github.com/microsoft/go-sqlcmd/pkg/mssqlcontainer"
"github.com/microsoft/go-sqlcmd/pkg/sqlcmd"
"github.com/spf13/cobra"
"path"
Expand Down Expand Up @@ -95,9 +96,7 @@ func initializeEnvVars() {
os.Setenv("SQLCMDPASSWORD", password)
}
}

}

}

// isFirstArgModernCliSubCommand is TEMPORARY code, to be removed when
Expand Down Expand Up @@ -132,6 +131,10 @@ func initializeCallback() {
HintHandler: displayHints,
LineBreak: sqlcmd.SqlcmdEol,
})
mssqlcontainer.Initialize(mssqlcontainer.InitializeOptions{
ErrorHandler: checkErr,
TraceHandler: outputter.Tracef,
})
config.SetFileName(rootCmd.configFilename)
config.Load()
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/modern/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Root struct {
// It also provides usage examples for sqlcmd.
func (c *Root) DefineCommand(...cmdparser.CommandOptions) {
// Example usage steps
steps := []string{"sqlcmd create mssql --accept-eula --using https://aka.ms/AdventureWorksLT.bak"}
steps := []string{"sqlcmd create mssql --accept-eula --use https://aka.ms/AdventureWorksLT.bak"}

if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
steps = append(steps, "sqlcmd open ads")
Expand Down Expand Up @@ -69,6 +69,7 @@ func (c *Root) SubCommands() []cmdparser.Command {
cmdparser.New[*root.Query](dependencies),
cmdparser.New[*root.Start](dependencies),
cmdparser.New[*root.Stop](dependencies),
cmdparser.New[*root.Use](dependencies),
cmdparser.New[*root.Uninstall](dependencies),
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/modern/root/config/connection-strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (c *ConnectionStrings) run() {
if endpoint.AssetDetails != nil && endpoint.AssetDetails.ContainerDetails != nil {
controller := container.NewController()
if controller.ContainerRunning(endpoint.AssetDetails.ContainerDetails.Id) {
s := sql.New(sql.SqlOptions{})
s := sql.NewSql(sql.SqlOptions{})
s.Connect(endpoint, user, sql.ConnectOptions{Interactive: false})
c.database = s.ScalarString("PRINT DB_NAME()")
} else {
Expand Down
2 changes: 1 addition & 1 deletion cmd/modern/root/install/edge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestInstallEdge(t *testing.T) {
cmdparser.TestCmd[*edge.GetTags]()
cmdparser.TestCmd[*Edge](
fmt.Sprintf(
`--accept-eula --user-database foo --errorlog-wait-line "Hello from Docker!" --registry %v --repo %v`,
`--accept-eula --database foo --errorlog-wait-line "Hello from Docker!" --registry %v --repo %v`,
registry,
repo))

Expand Down
Loading