MCPcopy Index your code
hub / github.com/JKme/cube / StartSqlcmd

Function StartSqlcmd

core/sqlcmdmodule/sqlcmd_task.go:8–37  ·  view source on GitHub ↗
(opt *SqlcmdOption)

Source from the content-addressed store, hash-verified

6)
7
8func StartSqlcmd(opt *SqlcmdOption) {
9
10 ip := opt.Ip
11 var port string
12 if len(opt.Port) == 0 {
13 port = GetSqlcmdPort(opt.Name)
14 } else {
15 port = opt.Port
16 }
17 user := opt.User
18 pass := opt.Password
19 e := opt.Query
20 sc := Sqlcmd{
21 Ip: ip,
22 Port: port,
23 User: user,
24 Password: pass,
25 Query: e,
26 Name: opt.Name,
27 }
28 sp := sc.NewISqlcmd()
29 fn := sp.SqlcmdExec()
30 if len(fn.Result) > 0 {
31 s := fmt.Sprintf("[->>>>>]: %s\n[->>>>>]: %s:%s\n", fn.Sqlcmd.Name, fn.Sqlcmd.Ip, fn.Sqlcmd.Port)
32 s1 := fmt.Sprintf("[output]:\n%s", fn.Result)
33 gologger.Info(s + s1)
34 } else {
35 gologger.Info(fn.Err)
36 }
37}

Callers 1

runSqlcmdFunction · 0.92

Calls 4

NewISqlcmdMethod · 0.95
SqlcmdExecMethod · 0.95
InfoFunction · 0.92
GetSqlcmdPortFunction · 0.85

Tested by

no test coverage detected