コード例 #1
0
        public override IDbCommand LIST_tabloid(DBConnection db, ETabloid list, string tabloidName = "")
        {
            MySqlCommand command = new MySqlCommand();

            string        emptyTableName = ToRealTableName(db.Application, tabloidName, false);
            string        sysTableName   = ToRealTableName(Application.SystemApp(), tabloidName, false);
            List <string> query          = new List <string>();

            if (list.Contains(ETabloid.ApplicationTables))
            {
                query.Add($"SELECT TABLE_NAME name, 'table' source FROM information_schema.TABLES WHERE TABLE_SCHEMA='{databaseName(db)}' AND TABLE_TYPE='BASE TABLE' AND TABLE_NAME LIKE '{emptyTableName.Replace("_", "\\_")}{(string.IsNullOrEmpty(tabloidName) ? "%" : "")}'");
            }
            if (list.Contains(ETabloid.SystemTables))
            {
                query.Add($"SELECT TABLE_NAME name, 'system' source FROM information_schema.TABLES WHERE TABLE_SCHEMA='{databaseName(db)}' AND TABLE_NAME LIKE '{sysTableName.Replace("_", "\\_")}{(string.IsNullOrEmpty(tabloidName) ? "%" : "")}'");
            }
            if (list.Contains(ETabloid.Views))
            {
                query.Add($"SELECT TABLE_NAME name, 'view' source FROM information_schema.VIEWS WHERE TABLE_SCHEMA='{databaseName(db)}' AND TABLE_NAME LIKE '{emptyTableName.Replace("_", "\\_")}{(string.IsNullOrEmpty(tabloidName) ? "%" : "")}'");
            }

            command.CommandText =
                string.Join(" UNION ALL ", query);

            return(command);
        }
コード例 #2
0
        public override IDbCommand LIST_tabloid(DBConnection db, ETabloid list, string tabloidName = "")
        {
            SqlCommand command = new SqlCommand();

            string        emptyTableName = ToRealTableName(db.Application, tabloidName, false);
            string        sysTableName   = ToRealTableName(Application.SystemApp(), tabloidName, false);
            List <string> query          = new List <string>();

            if (list.Contains(ETabloid.ApplicationTables))
            {
                query.Add($"SELECT name, 'table' [source] FROM sys.tables WHERE name LIKE '{emptyTableName.Replace("_", "[_]")}{(string.IsNullOrEmpty(tabloidName) ? "%" : "")}'");
            }
            if (list.Contains(ETabloid.SystemTables))
            {
                query.Add($"SELECT name, 'system' [source] FROM sys.tables WHERE name LIKE '{sysTableName.Replace("_", "[_]")}{(string.IsNullOrEmpty(tabloidName) ? "%" : "")}'");
            }
            if (list.Contains(ETabloid.Views))
            {
                query.Add($"SELECT name, 'view' [source] FROM sys.views WHERE name LIKE '{emptyTableName.Replace("_", "[_]")}{(string.IsNullOrEmpty(tabloidName) ? "%" : "")}'");
            }

            command.CommandText =
                string.Join(" UNION ALL ", query);

            return(command);
        }
コード例 #3
0
ファイル: DBConnection.cs プロジェクト: taquinil-selei/omnius
        public List <string> List(ETabloid list)
        {
            List <string> result = new List <string>();

            using (DBReader reader = ExecuteCommand(CommandSet.LIST_tabloid(this, list)))
            {
                while (reader.Read())
                {
                    result.Add(CommandSet.FromRealTableName(Application, (string)reader["name"]));
                }
            }

            return(result);
        }
コード例 #4
0
ファイル: DBConnection.cs プロジェクト: taquinil-selei/omnius
        public bool Exists(string tabloidName, ETabloid list)
        {
            bool exists = false;

            using (DBReader reader = ExecuteCommand(CommandSet.LIST_tabloid(this, list, tabloidName)))
            {
                while (reader.Read())
                {
                    exists = true;
                    break;
                }
            }

            return(exists);
        }
コード例 #5
0
 public abstract IDbCommand LIST_tabloid(DBConnection db, ETabloid list, string tabloidNameStartsWith = "");
コード例 #6
0
ファイル: Enums.cs プロジェクト: taquinil-selei/omnius
 public static bool Contains(this ETabloid tabloid, ETabloid item)
 {
     return((tabloid & item) > 0);
 }