public DocumentDataContainer( DataContainerDescriptor dataContainerDescriptor, DocumentTypeDescriptor documentTypeDescriptor, IUnmanagedAllocator allocator, ITracer tracer) { if (tracer == null) { throw new ArgumentNullException("tracer"); } if (dataContainerDescriptor == null) { throw new ArgumentNullException("dataContainerDescriptor"); } if (documentTypeDescriptor == null) { throw new ArgumentNullException("documentTypeDescriptor"); } if (allocator == null) { throw new ArgumentNullException("allocator"); } m_logger = tracer; m_allocator = allocator; DocDesc = documentTypeDescriptor; DataContainerDescriptor = dataContainerDescriptor; ColumnStores = new ColumnDataBase[DocDesc.Fields.Length]; DocumentKeys = new ExpandableArrayOfKeys(m_allocator); FieldIdToColumnStore = new Dictionary <int, int>(ColumnStores.Length * 2); PrimaryKeyFieldId = dataContainerDescriptor.RequireField(documentTypeDescriptor.DocumentType, documentTypeDescriptor.PrimaryKeyFieldName).FieldId; for (var i = 0; i < DocDesc.Fields.Length; i++) { var field = dataContainerDescriptor.RequireField(DocDesc.Fields[i]); ColumnStores[i] = CreateColumnStore(field.DbType, m_allocator, null); FieldIdToColumnStore.Add(field.FieldId, i); } DocumentIdToIndex = new ConcurrentHashmapOfKeys(m_allocator); ValidDocumentsBitmap = new BitVector(m_allocator); SortIndexManager = new SortIndexManager(this); StructureLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); }
public DocumentDataContainer( DataContainerDescriptor dataContainerDescriptor, DocumentTypeDescriptor documentTypeDescriptor, IUnmanagedAllocator allocator, ITracer tracer) { if (tracer == null) { throw new ArgumentNullException("tracer"); } if (dataContainerDescriptor == null) { throw new ArgumentNullException("dataContainerDescriptor"); } if (documentTypeDescriptor == null) { throw new ArgumentNullException("documentTypeDescriptor"); } if (allocator == null) { throw new ArgumentNullException("allocator"); } m_logger = tracer; m_allocator = allocator; DocDesc = documentTypeDescriptor; DataContainerDescriptor = dataContainerDescriptor; ColumnStores = new ColumnDataBase[DocDesc.Fields.Length]; DocumentKeys = new ExpandableArrayOfKeys(m_allocator); FieldIdToColumnStore = new Dictionary<int, int>(ColumnStores.Length * 2); PrimaryKeyFieldId = dataContainerDescriptor.RequireField(documentTypeDescriptor.DocumentType, documentTypeDescriptor.PrimaryKeyFieldName).FieldId; for (var i = 0; i < DocDesc.Fields.Length; i++) { var field = dataContainerDescriptor.RequireField(DocDesc.Fields[i]); ColumnStores[i] = CreateColumnStore(field.DbType, m_allocator, null); FieldIdToColumnStore.Add(field.FieldId, i); } DocumentIdToIndex = new ConcurrentHashmapOfKeys(m_allocator); ValidDocumentsBitmap = new BitVector(m_allocator); SortIndexManager = new SortIndexManager(this); StructureLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); }
public void AddDocumentTypeDescriptor(DocumentTypeDescriptor docType) { if (docType == null) { throw new ArgumentNullException("docType"); } var existing = RequireDocumentTypeName(docType.Name); if (docType.DocumentType != existing) { throw new ArgumentException(string.Format( "Supplied document type id {0} does not match existing id {1} for document type {2}", docType.DocumentType, existing, docType.Name)); } DocumentTypeDescriptors.Add(docType.DocumentType, docType); }
public DocumentTypeDescriptor AddDocumentTypeDescriptorWithPrimaryKey(string docTypeName, string baseDatasetName, string primaryKeyFieldName, params object[] data) { if (string.IsNullOrEmpty(docTypeName)) { throw new ArgumentNullException(docTypeName); } if (data == null) { throw new ArgumentNullException("data"); } if (data.Length == 0 || 0 != data.Length % 2) { throw new ArgumentException("Invalid data array length: " + data.Length, "data"); } if (m_fieldsMap == null) { throw new InvalidOperationException("Cannot invoke AddDocumentTypeDescriptor before BeginDefineDocumentTypes"); } if (m_descriptor == null) { throw new InvalidOperationException("Cannot invoke AddDocumentTypeDescriptor after Commit was called"); } var docType = m_descriptor.RequireDocumentTypeName(docTypeName); var fields = new FieldMetadata[data.Length / 2]; for (var i = 0; i < fields.Length; i++) { fields[i] = new FieldMetadata(++m_lastFieldId, (string)data[i*2], (string)data[i*2], (DbType)data[i*2+1], docType); } var result = new DocumentTypeDescriptor(docTypeName, baseDatasetName ?? docTypeName, docType, primaryKeyFieldName, fields.Select(x => x.FieldId).ToArray()); m_descriptor.AddDocumentTypeDescriptor(result); foreach (var field in fields) { m_descriptor.AddField(field); } return result; }
public void Clear() { IsBulk = false; HaveParametersDataInput = false; OrdinalOfPrimaryKey = -1; StatementType = (StatementType)(-1); TargetEntity = null; TargetEntityPkField = null; if (Bulk != null) { Bulk.Detach(); } Select.SelectClauses.Clear(); Select.SelectFields.Clear(); Select.OutputColumns.Clear(); Modify.InsertUpdateSetClauses.Clear(); Modify.ModifiedFields.Clear(); Modify.UpdateAssignments.Clear(); BaseDataset.BaseFieldsMainCount = 0; BaseDataset.BaseFields.Clear(); BaseDataset.WhereClauseFields.Clear(); BaseDataset.WhereClauseRoot = null; BaseDataset.WhereClauseProcessor = null; BaseDataset.OrderClauseFields.Clear(); BaseDataset.OrderClause = null; BaseDataset.Paging.Offset = PagingOptions.DefaultPagingOffsetFunc; BaseDataset.Paging.PageSize = PagingOptions.DefaultPagingPageSizeFunc; BulkInput.BulkInputFields.Clear(); Params.Names = null; Params.InputValues = null; Params.InputCollections = null; Params.OrdinalToLocalOrdinal = null; Params.DataTypes = null; SpecialCommand.IsSpecialCommand = false; SpecialCommand.CommandType = SpecialCommandData.SpecialCommandType.InvalidValue; }
private string GetDocRootPath(string storageRoot, DocumentTypeDescriptor docTypeDesc) { return(Path.Combine(storageRoot, GetFolderName(docTypeDesc))); }
private string GetFolderName(DocumentTypeDescriptor docTypeDesc) { return(string.Format("{0}-{1}", docTypeDesc.BaseDatasetName ?? docTypeDesc.Name, docTypeDesc.DocumentType)); }
private string GetFolderName(DocumentTypeDescriptor docTypeDesc) { return string.Format("{0}-{1}", docTypeDesc.BaseDatasetName ?? docTypeDesc.Name, docTypeDesc.DocumentType); }
private string GetDocRootPath(string storageRoot, DocumentTypeDescriptor docTypeDesc) { return Path.Combine(storageRoot, GetFolderName(docTypeDesc)); }