예제 #1
0
        public ColumnData(ColumnDataBase source, IUnmanagedAllocator allocator)
            : base(source, allocator)
        {
            var typed = (ColumnData <T>)source;

            m_dbType            = typed.DbType;
            DataArray           = typed.DataArray;
            AssignFromDriverRow = typed.AssignFromDriverRow;
            AssignToDriverRow   = typed.AssignToDriverRow;
            WriteData           = typed.WriteData;
            ReadData            = typed.ReadData;
        }
예제 #2
0
        public long CreateChangeset(DriverChangeBuffer changeBuffer, bool isBulk)
        {
            CheckInitialized();

            if (changeBuffer == null)
            {
                throw new ArgumentNullException("changeBuffer");
            }

            var key = Interlocked.Increment(ref m_lastChangesetHandle);

            ColumnDataBase[] columnStores = null;
            var documentContainer         = m_dataContainer.RequireDocumentContainer(changeBuffer.TargetEntity);

            if (changeBuffer.Fields != null && changeBuffer.Fields.Length > 0)
            {
                columnStores = new ColumnDataBase[changeBuffer.Fields.Length];
                for (var i = 0; i < changeBuffer.Fields.Length; i++)
                {
                    var field = changeBuffer.Fields[i];
                    columnStores[i] = documentContainer.RequireColumnStore(field.FieldId);
                }
            }

            var changesetRec = new RamDriverChangeset(this, changeBuffer, isBulk, documentContainer, columnStores);

            documentContainer.StructureLock.EnterReadLock();
            try
            {
                if (!m_changesets.TryAdd(key, changesetRec))
                {
                    throw new Exception("Internal error");
                }
                return(key);
            }
            catch
            {
                documentContainer.StructureLock.ExitReadLock();
                throw;
            }
        }
예제 #3
0
 protected ColumnDataBase(ColumnDataBase source, IUnmanagedAllocator allocator)
 {
     // may throw due to insufficient memory
     NotNulls = new BitVector(source.NotNulls, allocator);
 }
예제 #4
0
        /// <summary>
        /// Ctr.
        /// </summary>
        public RamDriverChangeset(RamDriver driver, DriverChangeBuffer changeBuffer, bool isBulk, DocumentDataContainer documentContainer, ColumnDataBase[] columnStores)
        {
            if (driver == null)
            {
                throw new ArgumentNullException("driver");
            }

            if (changeBuffer == null)
            {
                throw new ArgumentNullException("changeBuffer");
            }

            if (documentContainer == null)
            {
                throw new ArgumentNullException("documentContainer");
            }

            Driver = driver;
            ChangeBuffer = changeBuffer;
            IsBulk = isBulk;
            ColumnStores = columnStores;
            DocumentContainer = documentContainer;
        }
예제 #5
0
        public long CreateChangeset(DriverChangeBuffer changeBuffer, bool isBulk)
        {
            CheckInitialized();

            if (changeBuffer == null)
            {
                throw new ArgumentNullException("changeBuffer");
            }

            var key = Interlocked.Increment(ref m_lastChangesetHandle);

            ColumnDataBase[] columnStores = null;
            var documentContainer = m_dataContainer.RequireDocumentContainer(changeBuffer.TargetEntity);
            if (changeBuffer.Fields != null && changeBuffer.Fields.Length > 0)
            {
                columnStores = new ColumnDataBase[changeBuffer.Fields.Length];
                for (var i = 0; i < changeBuffer.Fields.Length; i++)
                {
                    var field = changeBuffer.Fields[i];
                    columnStores[i] = documentContainer.RequireColumnStore(field.FieldId);
                }
            }

            var changesetRec = new RamDriverChangeset(this, changeBuffer, isBulk, documentContainer, columnStores);

            documentContainer.StructureLock.EnterReadLock();
            try
            {
                if (!m_changesets.TryAdd(key, changesetRec))
                {
                    throw new Exception("Internal error");
                }
                return key;
            }
            catch
            {
                documentContainer.StructureLock.ExitReadLock();
                throw;
            }
        }
        private static ColumnDataBase CreateColumnStore(DbType dbType, IUnmanagedAllocator allocator, ColumnDataBase migrated)
        {
            var dataType = DriverRowData.DeriveSystemType(dbType);
            var columnStoreType = typeof(ColumnData<>).MakeGenericType(dataType);

            return migrated == null
                       ? (ColumnDataBase) Activator.CreateInstance(columnStoreType, dbType, allocator)
                       : (ColumnDataBase) Activator.CreateInstance(columnStoreType, migrated, allocator);
        }
        private static ColumnDataBase CreateColumnStore(DbType dbType, IUnmanagedAllocator allocator, ColumnDataBase migrated)
        {
            var dataType        = DriverRowData.DeriveSystemType(dbType);
            var columnStoreType = typeof(ColumnData <>).MakeGenericType(dataType);

            return(migrated == null
                       ? (ColumnDataBase)Activator.CreateInstance(columnStoreType, dbType, allocator)
                       : (ColumnDataBase)Activator.CreateInstance(columnStoreType, migrated, allocator));
        }
예제 #8
0
 protected ColumnDataBase(ColumnDataBase source, IUnmanagedAllocator allocator)
 {
     // may throw due to insufficient memory
     NotNulls = new BitVector(source.NotNulls, allocator);
 }