public override string DropIndex(Index index) { var sql = new StringBuilder("alter table "); this.AppendQuotedTableName(sql, index.Map); sql.Append(" drop index "); this.AppendQuotedName(sql, index.Name); return sql.ToString(); }
public override string DropIndex(Index index) { throw new InvalidOperationException("There is no Ansi-SQL way of dropping an index."); }
public virtual string CreateIndex(Index index) { var sql = new StringBuilder(128); sql.Append("create "); if (index.IsUnique) { sql.Append("unique "); } sql.Append("index "); this.AppendQuotedName(sql, index.Name); sql.Append(" on "); this.AppendQuotedTableName(sql, index.Map); sql.Append(" ("); foreach (var column in index.Columns) { this.AppendQuotedName(sql, column.DbName); sql.Append(", "); } sql.Remove(sql.Length - 2, 2); sql.Append(")"); return sql.ToString(); }
public abstract string DropIndex(Index index);
public string DropIndex(Index index) { return this.dialect.DropIndex(index); }
public override string DropIndex(Index index) { throw new System.NotImplementedException(); }
public void AddIndex(Index index) { this.indexes.Add(index); }
public override string CreateIndex(Index index) { var statement = base.CreateIndex(index); if (index.IsUnique && index.Columns.Any(c => c.IsNullable)) { var whereClause = new StringBuilder(); whereClause.Append(" where "); bool first = true; foreach (var column in index.Columns.Where(c => c.IsNullable)) { if (!first) { whereClause.Append(" and "); } this.AppendQuotedName(whereClause, column.DbName); whereClause.Append(" is not null"); first = false; } statement += whereClause.ToString(); } return statement; }