public QueryPlanIndexItemForge( IList<IndexedPropDesc> hashProps, IList<IndexedPropDesc> btreeProps, bool unique, EventAdvancedIndexProvisionCompileTime advancedIndexProvisionDesc, EventType eventType) : this( GetNames(hashProps), GetTypes(hashProps), GetNames(btreeProps), GetTypes(btreeProps), unique, advancedIndexProvisionDesc, eventType) { // EventAdvancedIndexProvisionDesc }
public static QueryPlanIndexItemForge ValidateCompileExplicitIndex( string indexName, bool unique, IList<CreateIndexItem> columns, EventType eventType, StatementRawInfo statementRawInfo, StatementCompileTimeServices services) { IList<IndexedPropDesc> hashProps = new List<IndexedPropDesc>(); IList<IndexedPropDesc> btreeProps = new List<IndexedPropDesc>(); ISet<string> indexedColumns = new HashSet<string>(); EventAdvancedIndexProvisionCompileTime advancedIndexProvisionDesc = null; foreach (var columnDesc in columns) { string indexType = columnDesc.IndexType.Trim(); if (indexType.Equals(CreateIndexType.HASH.GetName(), StringComparison.InvariantCultureIgnoreCase) || indexType.Equals(CreateIndexType.BTREE.GetName(), StringComparison.InvariantCultureIgnoreCase)) { ValidateBuiltin(columnDesc, eventType, hashProps, btreeProps, indexedColumns); } else { if (advancedIndexProvisionDesc != null) { throw new ExprValidationException("Nested advanced-type indexes are not supported"); } advancedIndexProvisionDesc = ValidateAdvanced( indexName, indexType, columnDesc, eventType, statementRawInfo, services); } } if (unique && !btreeProps.IsEmpty()) { throw new ExprValidationException("Combination of unique index with btree (range) is not supported"); } if ((!btreeProps.IsEmpty() || !hashProps.IsEmpty()) && advancedIndexProvisionDesc != null) { throw new ExprValidationException( "Combination of hash/btree columns an advanced-type indexes is not supported"); } return new QueryPlanIndexItemForge(hashProps, btreeProps, unique, advancedIndexProvisionDesc, eventType); }
public QueryPlanIndexItemForge( string[] hashProps, Type[] hashTypes, string[] rangeProps, Type[] rangeTypes, bool unique, EventAdvancedIndexProvisionCompileTime advancedIndexProvisionDesc, EventType eventType) { if (advancedIndexProvisionDesc == null) { if (unique && hashProps.Length == 0) { throw new ArgumentException("Invalid unique index planned without hash index props"); } if (unique && rangeProps.Length > 0) { throw new ArgumentException("Invalid unique index planned that includes range props"); } } if (hashProps == null || hashTypes == null || rangeProps == null || rangeTypes == null) { throw new ArgumentException("Invalid null hash and range props"); } if (hashProps.Length != hashTypes.Length) { throw new ArgumentException("Mismatch size hash props and types"); } if (rangeProps.Length != rangeTypes.Length) { throw new ArgumentException("Mismatch size hash props and types"); } HashProps = hashProps; HashTypes = hashTypes; RangeProps = rangeProps; RangeTypes = rangeTypes; IsUnique = unique; AdvancedIndexProvisionDesc = advancedIndexProvisionDesc; this.eventType = eventType; }