using Connected.Entities.Storage; namespace Connected.Data.Schema.Sql; internal class SchemaExists : SynchronizationQuery { public SchemaExists(string name) { Name = name; } private string Name { get; } protected override async Task OnExecute() { if (string.IsNullOrWhiteSpace(Name)) return true; var rdr = await Context.OpenReader(new StorageOperation { CommandText = $"SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = '{Name}'" }); var result = rdr.Read(); rdr.Close(); return result; } }