From 65304c0015111aacff2a8ce2c64fcb8931163736 Mon Sep 17 00:00:00 2001 From: mahdi Date: Sat, 2 Dec 2023 13:56:34 +0100 Subject: [PATCH] db - amend SizeTable method --- db/db.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/db.go b/db/db.go index 6cd1b87..e131ffe 100644 --- a/db/db.go +++ b/db/db.go @@ -178,7 +178,7 @@ type TableSize struct { func (db *Db) SizeTable(dbname string) []TableSize { rs := make([]TableSize, 1) db.onDbExec("information_schema", func(sqlDb *sql.DB) bool { - query := "SELECT `TABLE_NAME` AS `table`, ROUND(((`DATA_LENGTH` + `INDEX_LENGTH`) / 1024 / 1024), 2) `size` FROM `TABLES` WHERE `table_schema` = 'local_bosub' ORDER BY (`DATA_LENGTH` + `INDEX_LENGTH`) DESC;" + query := "SELECT `TABLE_NAME` AS `table`, ROUND(((`DATA_LENGTH` + `INDEX_LENGTH`) / 1024 / 1024), 2) `size` FROM `TABLES` WHERE `table_schema` = ? ORDER BY (`DATA_LENGTH` + `INDEX_LENGTH`) DESC;" rows, err := sqlDb.Query(query, dbname) if err != nil { fmt.Printf("cannot get table size of db %s : %v", dbname, err)