public virtual DataTable GetTables(string[] restrictions)
{
DataTable dt = new DataTable("Tables");
dt.Columns.Add("TABLE_CATALOG", typeof (string));
dt.Columns.Add("TABLE_SCHEMA", typeof (string));
dt.Columns.Add("TABLE_NAME", typeof (string));
dt.Columns.Add("TABLE_TYPE", typeof (string));
dt.Columns.Add("ENGINE", typeof (string));
dt.Columns.Add("VERSION", typeof (ulong));
dt.Columns.Add("ROW_FORMAT", typeof (string));
dt.Columns.Add("TABLE_ROWS", typeof (ulong));
dt.Columns.Add("AVG_ROW_LENGTH", typeof (ulong));
dt.Columns.Add("DATA_LENGTH", typeof (ulong));
dt.Columns.Add("MAX_DATA_LENGTH", typeof (ulong));
dt.Columns.Add("INDEX_LENGTH", typeof (ulong));
dt.Columns.Add("DATA_FREE", typeof (ulong));
dt.Columns.Add("AUTO_INCREMENT", typeof (ulong));
dt.Columns.Add("CREATE_TIME", typeof (DateTime));
dt.Columns.Add("UPDATE_TIME", typeof (DateTime));
dt.Columns.Add("CHECK_TIME", typeof (DateTime));
dt.Columns.Add("TABLE_COLLATION", typeof (string));
dt.Columns.Add("CHECKSUM", typeof (ulong));
dt.Columns.Add("CREATE_OPTIONS", typeof (string));
dt.Columns.Add("TABLE_COMMENT", typeof (string));
// we have to new up a new restriction array here since
// GetDatabases takes the database in the first slot
string[] dbRestriction = new string[4];
if (restrictions != null && restrictions.Length >= 2)
dbRestriction[0] = restrictions[1];
DataTable databases = GetDatabases(dbRestriction);
if (restrictions != null)
Array.Copy(restrictions, dbRestriction,
Math.Min(dbRestriction.Length, restrictions.Length));
foreach (DataRow db in databases.Rows)
{
dbRestriction[1] = db["SCHEMA_NAME"].ToString();
FindTables(dt, dbRestriction);
}
return dt;
}