public override string GetCustomizedIndexKeyword(IndexCustomState customState) { var state = customState as SqlServerIndexCustomState; if (state == null) { return(base.GetCustomizedIndexKeyword(customState)); } return(state.ClusteringKeyword + " INDEX"); }
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); }
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)); }
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)) + ")"); }
// 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); }
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); }
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); }
public virtual string GetCustomizedCreateIndexSuffix(IndexCustomState customState) { throw new NotImplementedException(customState.CustomStateType + " is not a supported feature on " + DisplayName); }
// 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)); }
public virtual string GetCreateIndexSuffix(IndexCustomState customState) { return(customState == null ? "" : GetCustomizedCreateIndexSuffix(customState)); }
public virtual string GetIndexKeyword(IndexCustomState customState) { return(customState == null ? "INDEX" : GetCustomizedIndexKeyword(customState)); }
// 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)) + ")"); }
public virtual string GetCustomizedUniqueConstraintKeyword(bool isPrimaryKey, IndexCustomState customState) { throw new NotImplementedException(customState.CustomStateType + " is not a supported feature on " + DisplayName); }
public virtual string GetUniqueConstraintKeyword(bool isPrimaryKey, IndexCustomState customState) { return(customState == null?GetUniqueConstraintKeyword(isPrimaryKey) : GetCustomizedUniqueConstraintKeyword(isPrimaryKey, customState)); }