Esempio n. 1
0
        public override string GetCustomizedIndexKeyword(IndexCustomState customState)
        {
            var state = customState as SqlServerIndexCustomState;

            if (state == null)
            {
                return(base.GetCustomizedIndexKeyword(customState));
            }
            return(state.ClusteringKeyword + " INDEX");
        }
Esempio n. 2
0
 public virtual bool IsIndexCustomStateEqual(IndexCustomState a, IndexCustomState b)
 {
     if (a != null)
     {
         throw new NotImplementedException(a.CustomStateType + " is not a supported feature on " + DisplayName);
     }
     if (b != null)
     {
         throw new NotImplementedException(b.CustomStateType + " is not a supported feature on " + DisplayName);
     }
     return(true);
 }
Esempio n. 3
0
        public override bool IsIndexCustomStateEqual(IndexCustomState a, IndexCustomState b)
        {
            var sqlA = a as SqlServerIndexCustomState;
            var sqlB = b as SqlServerIndexCustomState;

            if (sqlA == null || sqlB == null)
            {
                return(base.IsIndexCustomStateEqual(a, b));
            }

            return(sqlA.IsClustered == sqlB.IsClustered &&
                   sqlA.IncludedFields.SetEquals(sqlB.IncludedFields));
        }
Esempio n. 4
0
        public override string GetCustomizedCreateIndexSuffix(IndexCustomState customState)
        {
            var state = customState as SqlServerIndexCustomState;

            if (state == null)
            {
                return(base.GetCustomizedCreateIndexSuffix(customState));
            }
            if (!state.IncludedFields.Any())
            {
                return("");
            }

            return(" INCLUDE (" + string.Join(", ", from field in state.IncludedFields select QuoteIdentifier(field)) + ")");
        }
Esempio n. 5
0
        // Specific SQL server custom features on indexes
        public override string GetCustomizedUniqueConstraintKeyword(bool isPrimaryKey, IndexCustomState customState)
        {
            var state = customState as SqlServerIndexCustomState;

            if (state == null)
            {
                return(base.GetCustomizedUniqueConstraintKeyword(isPrimaryKey, customState));
            }
            return(GetUniqueConstraintKeyword(isPrimaryKey) + " " + state.ClusteringKeyword);
        }
Esempio n. 6
0
        public override string GetCreateUniqueConstraintSql(string tableName, bool isPrimaryKey, string indexName, IEnumerable <string> fieldNames, IndexCustomState customState)
        {
            var result = base.GetCreateUniqueConstraintSql(tableName, isPrimaryKey, indexName, fieldNames, customState);

            if (IndexTablespace != null)
            {
                result += " USING INDEX TABLESPACE " + IndexTablespace;
            }
            return(result);
        }
Esempio n. 7
0
        public override string GetCreateIndexSql(string tableName, string indexName, IEnumerable <string> fieldNames, IndexCustomState customState)
        {
            var result = base.GetCreateIndexSql(tableName, indexName, fieldNames, customState);

            if (IndexTablespace != null)
            {
                result += " TABLESPACE " + IndexTablespace;
            }
            return(result);
        }
Esempio n. 8
0
 public virtual string GetCustomizedCreateIndexSuffix(IndexCustomState customState)
 {
     throw new NotImplementedException(customState.CustomStateType + " is not a supported feature on " + DisplayName);
 }
Esempio n. 9
0
 // Create index
 public virtual string GetCreateIndexSql(string tableName, string indexName, IEnumerable <string> fieldNames, IndexCustomState customState)
 {
     return("CREATE " + GetIndexKeyword(customState) + " " + GetIndexName(tableName, indexName) + " ON " + QuoteSchemaIdentifier(tableName) + " (" +
            string.Join(", ", from field in fieldNames select QuoteIdentifier(field)) +
            ")" + GetCreateIndexSuffix(customState));
 }
Esempio n. 10
0
 public virtual string GetCreateIndexSuffix(IndexCustomState customState)
 {
     return(customState == null ? "" : GetCustomizedCreateIndexSuffix(customState));
 }
Esempio n. 11
0
 public virtual string GetIndexKeyword(IndexCustomState customState)
 {
     return(customState == null ? "INDEX" : GetCustomizedIndexKeyword(customState));
 }
Esempio n. 12
0
 // Create unique (pkey/unique) index
 public virtual string GetCreateUniqueConstraintSql(string tableName, bool isPrimaryKey, string indexName, IEnumerable <string> fieldNames, IndexCustomState customState)
 {
     return("ALTER TABLE " + QuoteSchemaIdentifier(tableName) + " ADD CONSTRAINT " + QuoteIdentifier(indexName) + " " +
            GetUniqueConstraintKeyword(isPrimaryKey, customState) + " (" + string.Join(", ", from field in fieldNames select QuoteIdentifier(field)) + ")");
 }
Esempio n. 13
0
 public virtual string GetCustomizedUniqueConstraintKeyword(bool isPrimaryKey, IndexCustomState customState)
 {
     throw new NotImplementedException(customState.CustomStateType + " is not a supported feature on " + DisplayName);
 }
Esempio n. 14
0
 public virtual string GetUniqueConstraintKeyword(bool isPrimaryKey, IndexCustomState customState)
 {
     return(customState == null?GetUniqueConstraintKeyword(isPrimaryKey) : GetCustomizedUniqueConstraintKeyword(isPrimaryKey, customState));
 }