예제 #1
0
        public override void Write(Record record, PageCursor cursor)
        {
            PageCountRecord r      = ( PageCountRecord )record;
            int             shorts = RecordSize / 2;

            for (int i = 0; i < shorts; i++)
            {
                cursor.PutShort(r.RecordId);
            }
        }
예제 #2
0
        internal static void Put(PageCursor cursor, sbyte[] byteArray, long long0, long long2)
        {
            // There are two variants of a text value, one is string, the other is char. Both are the same ValueGroup, i.e. TEXT
            // and should be treated the same, it's just that we need to know if it's a char so that we can materialize a CharValue for chars.
            // We put a special marker for char values, knowing that a char is exactly 2 bytes in storage.
            // This can be picked up by reader and set the right flag in state so that a CharValue can be materialized.
            short length = toNonNegativeShortExact(long0);

            cursor.PutShort(IsCharValueType(long2) ? ( short )(length | CHAR_TYPE_LENGTH_MARKER) : length);
            cursor.PutBytes(byteArray, 0, length);
        }
예제 #3
0
        public override void Write(Record record, PageCursor cursor)
        {
            StandardRecord r = ( StandardRecord )record;

            sbyte[] pathBytes = r.File.Path.getBytes(StandardCharsets.UTF_8);
            sbyte   fileByte  = pathBytes[pathBytes.Length - 1];

            cursor.PutByte(r.Type);
            cursor.PutByte(fileByte);
            cursor.PutShort(r.Fill1);
            cursor.PutInt(r.RecordId);
            cursor.PutLong(r.Fill2);
        }
예제 #4
0
 public override void Write(DynamicRecord record, PageCursor cursor, int recordSize)
 {
     if (record.InUse())
     {
         Debug.Assert(record.Length < (1 << 24) - 1);
         sbyte headerByte = ( sbyte )((record.InUse() ? IN_USE_BIT : 0) | (record.StartRecord ? START_RECORD_BIT : 0));
         cursor.PutByte(headerByte);
         cursor.PutShort(( short )record.Length);
         cursor.PutByte(( sbyte )(( int )(( uint )record.Length >> 16)));
         cursor.PutLong(record.NextBlock);
         cursor.PutBytes(record.Data);
     }
     else
     {
         MarkAsUnused(cursor);
     }
 }
예제 #5
0
        public override void SetShort(long index, int offset, short value)
        {
            long pageId = pageId(index);

            offset += offset(index);
            try
            {
                using (PageCursor cursor = PagedFile.io(pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW))
                {
                    cursor.Next();
                    cursor.PutShort(offset, value);
                    CheckBounds(cursor);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
예제 #6
0
        public override void Set3ByteInt(long index, int offset, int value)
        {
            long pageId = pageId(index);

            offset += offset(index);
            try
            {
                using (PageCursor cursor = PagedFile.io(pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW))
                {
                    cursor.Next();
                    cursor.PutShort(offset, ( short )value);
                    cursor.PutByte(offset + Short.BYTES, ( sbyte )(( int )(( uint )value >> (sizeof(short) * 8))));
                    CheckBounds(cursor);
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
예제 #7
0
 private static void Put3BInt(PageCursor cursor, int value)
 {
     cursor.PutShort(( short )value);
     cursor.PutByte(( sbyte )(( int )(( uint )value >> (sizeof(short) * 8))));
 }
예제 #8
0
 internal static void PutArrayHeader(PageCursor cursor, short arrayLength)
 {
     cursor.PutShort(arrayLength);
 }