예제 #1
0
 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();
 }
예제 #2
0
 public override string DropIndex(Index index) {
     throw new InvalidOperationException("There is no Ansi-SQL way of dropping an index.");
 }
예제 #3
0
        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();
        }
예제 #4
0
 public abstract string DropIndex(Index index);
예제 #5
0
 public string DropIndex(Index index) {
     return this.dialect.DropIndex(index);
 }
예제 #6
0
 public override string DropIndex(Index index) {
     throw new System.NotImplementedException();
 }
예제 #7
0
파일: Map.cs 프로젝트: Polylytics/dashing
 public void AddIndex(Index index) {
     this.indexes.Add(index);
 }
예제 #8
0
        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;
        }