- Status: open --> closed
Proper code is as follows:
try
{
string tables = String.Join(" OR ", Enumerable.Range(0, connections.Length).Select(x => String.Format("table_name = '{0}'", GetTableName(x))));
string query = "";
if (StorageEngine == MySQLStorageEngine.TokuDB)
{
query = String.Format("select sum(bt_size_allocated) from information_schema.TokuDB_fractal_tree_info where table_schema='{0}' and ({1});", conn.Database, tables);
}
else
{
query = String.Format("SELECT SUM(Data_length + Index_length) FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '{0}' and ({1});", conn.Database, tables);
}
IDataReader reader = conn.ExecuteQuery(query);
long size = 0;
if (reader.Read())
size = reader.GetInt64(0);
reader.Close();
return size;
}