Skip to content

Commit 2b0a300

Browse files
committedSep 13, 2016
Support MariaDB
1 parent facd1c3 commit 2b0a300

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed
 

‎myprofiler.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,23 @@ func processList(db *sql.DB) []string {
5555
}
5656
defer rows.Close()
5757

58+
cs, err := rows.Columns()
59+
if err != nil {
60+
panic(err)
61+
}
62+
lcs := len(cs)
63+
if lcs != 8 && lcs != 9 {
64+
log.Fatal("Unknwon columns: ", cs)
65+
}
5866
for rows.Next() {
5967
var user, host, db, command, state, info *string
6068
var id, time int
61-
err := rows.Scan(&id, &user, &host, &db, &command, &time, &state, &info)
69+
if lcs == 8 {
70+
err = rows.Scan(&id, &user, &host, &db, &command, &time, &state, &info)
71+
} else {
72+
var progress interface{}
73+
err = rows.Scan(&id, &user, &host, &db, &command, &time, &state, &info, &progress)
74+
}
6275
if err != nil {
6376
log.Print(err)
6477
continue

0 commit comments

Comments
 (0)
Please sign in to comment.