@@ -9,19 +9,19 @@ func (database *Database) remoteMysqldumpCmdBuilder(additionalArgs []string, use
9
9
var args []string
10
10
11
11
if database .User != "" {
12
- args = append (args , "-u" + database .User )
12
+ args = append (args , shell . Quote ( "-u" + database .User ) )
13
13
}
14
14
15
15
if database .Password != "" {
16
- args = append (args , "-p" + database .Password )
16
+ args = append (args , shell . Quote ( "-p" + database .Password ) )
17
17
}
18
18
19
19
if database .Hostname != "" {
20
- args = append (args , "-h" + database .Hostname )
20
+ args = append (args , shell . Quote ( "-h" + database .Hostname ) )
21
21
}
22
22
23
23
if database .Port != "" {
24
- args = append (args , "-P" + database .Port )
24
+ args = append (args , shell . Quote ( "-P" + database .Port ) )
25
25
}
26
26
27
27
if len (args ) > 0 {
@@ -35,15 +35,21 @@ func (database *Database) remoteMysqldumpCmdBuilder(additionalArgs []string, use
35
35
}
36
36
37
37
// schema
38
- args = append (args , database .Schema )
38
+ args = append (args , shell . Quote ( database .Schema ) )
39
39
40
40
// include
41
41
if useFilter && len (includeArgs ) > 0 {
42
42
args = append (args , includeArgs ... )
43
43
}
44
44
45
45
cmd := []string {"mysqldump" }
46
- cmd = append (cmd , shell .QuoteValues (args ... )... )
46
+
47
+ // add custom options (raw)
48
+ if database .Options .Mysqldump != "" {
49
+ cmd = append (cmd , database .Options .Mysqldump )
50
+ }
51
+
52
+ cmd = append (cmd , args ... )
47
53
cmd = append (cmd , "|" , "gzip" , "--stdout" )
48
54
49
55
return database .Connection .RawShellCommandBuilder (cmd ... )
@@ -53,53 +59,63 @@ func (database *Database) remoteMysqlCmdBuilder(args ...string) []interface{} {
53
59
args = append (args , "-BN" )
54
60
55
61
if database .User != "" {
56
- args = append (args , "-u" + database .User )
62
+ args = append (args , shell . Quote ( "-u" + database .User ) )
57
63
}
58
64
59
65
if database .Password != "" {
60
- args = append (args , "-p" + database .Password )
66
+ args = append (args , shell . Quote ( "-p" + database .Password ) )
61
67
}
62
68
63
69
if database .Hostname != "" {
64
- args = append (args , "-h" + database .Hostname )
70
+ args = append (args , shell . Quote ( "-h" + database .Hostname ) )
65
71
}
66
72
67
73
if database .Port != "" {
68
- args = append (args , "-P" + database .Port )
74
+ args = append (args , shell . Quote ( "-P" + database .Port ) )
69
75
}
70
76
71
77
if database .Schema != "" {
72
- args = append (args , database .Schema )
78
+ args = append (args , shell . Quote ( database .Schema ) )
73
79
}
74
80
75
- return database .Connection .CommandBuilder ("mysql" , args ... )
81
+ // append options in raw
82
+ if database .Options .Mysqldump != "" {
83
+ args = append (args , database .Options .Mysql )
84
+ }
85
+
86
+ return database .Connection .RawCommandBuilder ("mysql" , args ... )
76
87
}
77
88
78
89
79
90
func (database * Database ) remoteMysqlCmdBuilderUncompress (args ... string ) []interface {} {
80
91
args = append (args , "-BN" )
81
92
82
93
if database .User != "" {
83
- args = append (args , "-u" + database .User )
94
+ args = append (args , shell . Quote ( "-u" + database .User ) )
84
95
}
85
96
86
97
if database .Password != "" {
87
- args = append (args , "-p" + database .Password )
98
+ args = append (args , shell . Quote ( "-p" + database .Password ) )
88
99
}
89
100
90
101
if database .Hostname != "" {
91
- args = append (args , "-h" + database .Hostname )
102
+ args = append (args , shell . Quote ( "-h" + database .Hostname ) )
92
103
}
93
104
94
105
if database .Port != "" {
95
- args = append (args , "-P" + database .Port )
106
+ args = append (args , shell .Quote ("-P" + database .Port ))
107
+ }
108
+
109
+ // add custom options (raw)
110
+ if database .Options .Mysqldump != "" {
111
+ args = append (args , database .Options .Mysql )
96
112
}
97
113
98
114
if database .Schema != "" {
99
- args = append (args , database .Schema )
115
+ args = append (args , shell . Quote ( database .Schema ) )
100
116
}
101
117
102
- cmd := []string {"gunzip" , "--stdout" , "|" , "mysql" , strings .Join (shell . QuoteValues ( args ... ) , " " )}
118
+ cmd := []string {"gunzip" , "--stdout" , "|" , "mysql" , strings .Join (args , " " )}
103
119
104
120
return database .Connection .RawShellCommandBuilder (cmd ... )
105
121
}
0 commit comments