Пример #1
0
        /// <summary>
        /// Reads a column
        /// </summary>
        /// <param name="table">The table</param>
        /// <param name="rid">Row ID</param>
        /// <param name="column">Column</param>
        /// <param name="value">Result is put here or 0 if we return <c>false</c></param>
        /// <returns><c>true</c> if we could read the column, <c>false</c> otherwise</returns>
        public bool ReadColumn(MDTable table, uint rid, ColumnInfo column, out uint value)
        {
            if (table == null || table.IsInvalidRID(rid))
            {
                value = 0;
                return(false);
            }
            var cr = columnReader;

            if (cr != null && cr.ReadColumn(table, rid, column, out value))
            {
                return(true);
            }
#if THREAD_SAFE
            theLock.EnterWriteLock(); try {
#endif
            var reader = GetReader_NoLock(table, rid);
            reader.Position += column.Offset;
            value            = column.Read(reader);
#if THREAD_SAFE
        }

        finally { theLock.ExitWriteLock(); }
#endif
            return(true);
        }
Пример #2
0
        /// <summary>
        /// Reads a column
        /// </summary>
        /// <param name="table">The table</param>
        /// <param name="rid">Row ID</param>
        /// <param name="column">Column</param>
        /// <param name="value">Result is put here or 0 if we return <c>false</c></param>
        /// <returns><c>true</c> if we could read the column, <c>false</c> otherwise</returns>
        public bool TryReadColumn(MDTable table, uint rid, ColumnInfo column, out uint value)
        {
            if (table.IsInvalidRID(rid))
            {
                value = 0;
                return(false);
            }
            var cr = columnReader;

            if (cr != null && cr.ReadColumn(table, rid, column, out value))
            {
                return(true);
            }
            var reader = table.DataReader;

            reader.Position = (rid - 1) * (uint)table.TableInfo.RowSize + (uint)column.Offset;
            value           = column.Read(ref reader);
            return(true);
        }
Пример #3
0
		/// <summary>
		/// Reads a column
		/// </summary>
		/// <param name="table">The table</param>
		/// <param name="rid">Row ID</param>
		/// <param name="column">Column</param>
		/// <param name="value">Result is put here or 0 if we return <c>false</c></param>
		/// <returns><c>true</c> if we could read the column, <c>false</c> otherwise</returns>
		internal bool ReadColumn_NoLock(MDTable table, uint rid, ColumnInfo column, out uint value) {
			if (table.IsInvalidRID(rid)) {
				value = 0;
				return false;
			}
			var cr = columnReader;
			if (cr != null && cr.ReadColumn(table, rid, column, out value))
				return true;
			var reader = GetReader_NoLock(table, rid);
			reader.Position += column.Offset;
			value = column.Read(reader);
			return true;
		}
Пример #4
0
		/// <summary>
		/// Reads a column
		/// </summary>
		/// <param name="table">The table</param>
		/// <param name="rid">Row ID</param>
		/// <param name="column">Column</param>
		/// <param name="value">Result is put here or 0 if we return <c>false</c></param>
		/// <returns><c>true</c> if we could read the column, <c>false</c> otherwise</returns>
		public bool ReadColumn(MDTable table, uint rid, ColumnInfo column, out uint value) {
			if (table.IsInvalidRID(rid)) {
				value = 0;
				return false;
			}
			var cr = columnReader;
			if (cr != null && cr.ReadColumn(table, rid, column, out value))
				return true;
#if THREAD_SAFE
			theLock.EnterWriteLock(); try {
#endif
			var reader = GetReader_NoLock(table, rid);
			reader.Position += column.Offset;
			value = column.Read(reader);
#if THREAD_SAFE
			} finally { theLock.ExitWriteLock(); }
#endif
			return true;
		}