@@ -109,22 +109,16 @@ func (c *Conn) handleShowProxyConfig() (*Resultset, error) {
109109 var names []string = []string {"Section" , "Key" , "Value" }
110110 var rows [][]string
111111 const (
112- Section = 0
113- Key = 1
114- Value = 2
115- Column = 3
112+ Column = 3
116113 )
117114
118115 rows = append (rows , []string {"Global_Config" , "Addr" , c .server .cfg .Addr })
119116 rows = append (rows , []string {"Global_Config" , "User" , c .server .cfg .User })
120117 rows = append (rows , []string {"Global_Config" , "Password" , c .server .cfg .Password })
121118 rows = append (rows , []string {"Global_Config" , "LogLevel" , c .server .cfg .LogLevel })
122-
123119 rows = append (rows , []string {"Global_Config" , "Schemas_Count" , fmt .Sprintf ("%d" , len (c .server .schemas ))})
124120 rows = append (rows , []string {"Global_Config" , "Nodes_Count" , fmt .Sprintf ("%d" , len (c .server .nodes ))})
125121
126- // var row []string = make([]string, Column)
127-
128122 for db , schema := range c .server .schemas {
129123 rows = append (rows , []string {"Schemas" , "DB" , db })
130124
@@ -135,14 +129,14 @@ func (c *Conn) handleShowProxyConfig() (*Resultset, error) {
135129 var nodeSection = fmt .Sprintf ("Schemas[%s]-Node[ %v ]" , db , name )
136130
137131 if node .master != nil {
138- nodeRows = append (nodeRows , []string {nodeSection , "Master" , node .master .String ()})
132+ nodeRows = append (nodeRows , []string {nodeSection , "Master" , node .master .ConfigString ()})
139133 }
140134 if node .masterBackup != nil {
141- nodeRows = append (nodeRows , []string {nodeSection , "Master_Backup" , node .masterBackup .String ()})
135+ nodeRows = append (nodeRows , []string {nodeSection , "Master_Backup" , node .masterBackup .ConfigString ()})
142136 }
143137
144138 if node .slave != nil {
145- nodeRows = append (nodeRows , []string {nodeSection , "Slave" , node .slave .String ()})
139+ nodeRows = append (nodeRows , []string {nodeSection , "Slave" , node .slave .ConfigString ()})
146140 }
147141 nodeRows = append (nodeRows , []string {nodeSection , "Last_Master_Ping" , fmt .Sprintf ("%v" , time .Unix (node .lastMasterPing , 0 ))})
148142
@@ -152,7 +146,20 @@ func (c *Conn) handleShowProxyConfig() (*Resultset, error) {
152146
153147 }
154148 rows = append (rows , []string {fmt .Sprintf ("Schemas[%s]" , db ), "Nodes_List" , strings .Join (nodeNames , "," )})
155- rows = append (rows , []string {fmt .Sprintf ("Schemas[%s]" , db ), "Rule" , schema .rule .String ()})
149+
150+ var defaultRule = schema .rule .DefaultRule
151+ if defaultRule .DB == db {
152+ if defaultRule .DB == db {
153+ rows = append (rows , []string {fmt .Sprintf ("Schemas[%s]_Rule_Default" , db ),
154+ "Default_Table" , defaultRule .ConfigString ()})
155+ }
156+ }
157+ for tb , r := range schema .rule .Rules {
158+ if r .DB == db {
159+ rows = append (rows , []string {fmt .Sprintf ("Schemas[%s]_Rule_Table" , db ),
160+ fmt .Sprintf ("Table[ %s ]" , tb ), r .ConfigString ()})
161+ }
162+ }
156163
157164 for i := range nodeRows {
158165 rows = append (rows , nodeRows [i ])
0 commit comments