public override string GenerateSQLQuery() { StringBuilder query = new StringBuilder(); if (IsNew) { query.Append($"create table {ConnectionSettings.getInstance().NameScheme}.{NameTable} ( "); } else { query.Append($"alter table {ConnectionSettings.getInstance().NameScheme}.{NameTable} add "); } foreach (var col in ColumnInTable) { query.Append($"{col.NameColumn} {col.NameType} {col.SizeTypeQuery}, "); } if (IsNew) { query.Replace(", ", ") ", query.Length - 2, 2); } else { query.Replace(", ", " ", query.Length - 2, 2); } return(IsNew ? GenerateQueryWorker.CurentGenerate.GetCreateTableQuery($"{ConnectionSettings.getInstance().NameScheme}.{NameTable}", ColumnInTable.ToList().Select(col => $"{col.NameColumn} {col.NameType} {col.SizeTypeQuery}").ToList()) : GenerateQueryWorker.CurentGenerate.GetAddColumnsQuery($"{ConnectionSettings.getInstance().NameScheme}.{NameTable}", ColumnInTable.ToList().Select(col => $"{col.NameColumn} {col.NameType} {col.SizeTypeQuery}").ToList())); }
public override string GenerateSQLQuery() { return(GenerateQueryWorker.CurentGenerate.GetDeleteColumnsQuery($"{ConnectionSettings.getInstance().NameScheme}.{NameTable}", ColumnInTable.ToList().FindAll(c => c.IsSelect).Select(c => c.NameColumn).ToList())); }