private void _read() { _magic = m_io.EnsureFixedContents(new byte[] { 83, 81, 76, 105, 116, 101, 32, 102, 111, 114, 109, 97, 116, 32, 51, 0 }); _lenPageMod = m_io.ReadU2be(); _writeVersion = ((Versions)m_io.ReadU1()); _readVersion = ((Versions)m_io.ReadU1()); _reservedSpace = m_io.ReadU1(); _maxPayloadFrac = m_io.ReadU1(); _minPayloadFrac = m_io.ReadU1(); _leafPayloadFrac = m_io.ReadU1(); _fileChangeCounter = m_io.ReadU4be(); _numPages = m_io.ReadU4be(); _firstFreelistTrunkPage = m_io.ReadU4be(); _numFreelistPages = m_io.ReadU4be(); _schemaCookie = m_io.ReadU4be(); _schemaFormat = m_io.ReadU4be(); _defPageCacheSize = m_io.ReadU4be(); _largestRootPage = m_io.ReadU4be(); _textEncoding = ((Encodings)m_io.ReadU4be()); _userVersion = m_io.ReadU4be(); _isIncrementalVacuum = m_io.ReadU4be(); _applicationId = m_io.ReadU4be(); _reserved = m_io.ReadBytes(20); _versionValidFor = m_io.ReadU4be(); _sqliteVersionNumber = m_io.ReadU4be(); _rootPage = new BtreePage(m_io, this, m_root); }
private void _read() { _magic = m_io.ReadBytes(16); if (!((KaitaiStream.ByteArrayCompare(Magic, new byte[] { 83, 81, 76, 105, 116, 101, 32, 102, 111, 114, 109, 97, 116, 32, 51, 0 }) == 0))) { throw new ValidationNotEqualError(new byte[] { 83, 81, 76, 105, 116, 101, 32, 102, 111, 114, 109, 97, 116, 32, 51, 0 }, Magic, M_Io, "/seq/0"); } _lenPageMod = m_io.ReadU2be(); _writeVersion = ((Versions)m_io.ReadU1()); _readVersion = ((Versions)m_io.ReadU1()); _reservedSpace = m_io.ReadU1(); _maxPayloadFrac = m_io.ReadU1(); _minPayloadFrac = m_io.ReadU1(); _leafPayloadFrac = m_io.ReadU1(); _fileChangeCounter = m_io.ReadU4be(); _numPages = m_io.ReadU4be(); _firstFreelistTrunkPage = m_io.ReadU4be(); _numFreelistPages = m_io.ReadU4be(); _schemaCookie = m_io.ReadU4be(); _schemaFormat = m_io.ReadU4be(); _defPageCacheSize = m_io.ReadU4be(); _largestRootPage = m_io.ReadU4be(); _textEncoding = ((Encodings)m_io.ReadU4be()); _userVersion = m_io.ReadU4be(); _isIncrementalVacuum = m_io.ReadU4be(); _applicationId = m_io.ReadU4be(); _reserved = m_io.ReadBytes(20); _versionValidFor = m_io.ReadU4be(); _sqliteVersionNumber = m_io.ReadU4be(); _rootPage = new BtreePage(m_io, this, m_root); }
public override IPersistent[] ToArray() { IPersistent[] arr = (IPersistent[])Array.CreateInstance(cls, nElems); if (root != 0) { BtreePage.traverseForward((StorageImpl)Storage, root, type, height, arr, 0); } return(arr); }
internal void getByteArray(Page pg, int i) { int len = BtreePage.getKeyStrSize(pg, i); int offs = BtreePage.firstKeyOffs + BtreePage.getKeyStrOffs(pg, i); byte[] bval = new byte[len]; Array.Copy(pg.data, offs, bval, 0, len); key = new Key(bval); }
public override IPersistent[] Get(Key from, Key till) { ArrayList list = new ArrayList(); if (root != 0) { BtreePage.find((StorageImpl)Storage, root, checkKey(from), checkKey(till), this, height, list); } return((IPersistent[])list.ToArray(cls)); }
public override object[] ToArray() { object[] arr = (object[])Array.CreateInstance(cls, nElems); #endif if (root != 0) { BtreePage.traverseForward((StorageImpl)Storage, root, type, height, arr, 0); } return(arr); }
internal void getStr(Page pg, int i) { int len = BtreePage.getKeyStrSize(pg, i); int offs = BtreePage.firstKeyOffs + BtreePage.getKeyStrOffs(pg, i); char[] sval = new char[len]; for (int j = 0; j < len; j++) { sval[j] = (char)Bytes.unpack2(pg.data, offs); offs += 2; } key = new Key(sval); }
public override object[] Get(Key from, Key till) #endif { ArrayList list = new ArrayList(); if (root != 0) { BtreePage.find((StorageImpl)Storage, root, checkKey(from), checkKey(till), this, height, list); } #if USE_GENERICS return((V[])list.ToArray(cls)); #else return((object[])list.ToArray(cls)); #endif }
protected override object unpackByteArrayKey(Page pg, int pos) { int offs = BtreePage.firstKeyOffs + BtreePage.getKeyStrOffs(pg, pos); byte[] data = pg.data; Object[] values = new Object[types.Length]; for (int i = 0; i < types.Length; i++) { Object v = null; switch (types[i]) { case ClassDescriptor.FieldType.tpBoolean: v = data[offs++] != 0; break; case ClassDescriptor.FieldType.tpSByte: v = (sbyte)data[offs++]; break; case ClassDescriptor.FieldType.tpByte: v = data[offs++]; break; case ClassDescriptor.FieldType.tpShort: v = Bytes.unpack2(data, offs); offs += 2; break; case ClassDescriptor.FieldType.tpUShort: v = (ushort)Bytes.unpack2(data, offs); offs += 2; break; case ClassDescriptor.FieldType.tpChar: v = (char)Bytes.unpack2(data, offs); offs += 2; break; case ClassDescriptor.FieldType.tpInt: v = Bytes.unpack4(data, offs); offs += 4; break; case ClassDescriptor.FieldType.tpUInt: v = (uint)Bytes.unpack4(data, offs); offs += 4; break; case ClassDescriptor.FieldType.tpOid: case ClassDescriptor.FieldType.tpObject: { int oid = Bytes.unpack4(data, offs); v = oid == 0 ? null : ((StorageImpl)Storage).lookupObject(oid, null); offs += 4; break; } case ClassDescriptor.FieldType.tpLong: v = Bytes.unpack8(data, offs); offs += 8; break; case ClassDescriptor.FieldType.tpDate: { v = new DateTime(Bytes.unpack8(data, offs)); offs += 8; break; } case ClassDescriptor.FieldType.tpULong: v = (ulong)Bytes.unpack8(data, offs); offs += 8; break; case ClassDescriptor.FieldType.tpFloat: v = Bytes.unpackF4(data, offs); offs += 4; break; case ClassDescriptor.FieldType.tpDouble: v = Bytes.unpackF8(data, offs); offs += 8; break; case ClassDescriptor.FieldType.tpDecimal: v = Bytes.unpackDecimal(data, offs); offs += 16; break; case ClassDescriptor.FieldType.tpGuid: v = Bytes.unpackGuid(data, offs); offs += 16; break; case ClassDescriptor.FieldType.tpString: { int len = Bytes.unpack4(data, offs); offs += 4; char[] sval = new char[len]; for (int j = 0; j < len; j++) { sval[j] = (char)Bytes.unpack2(pg.data, offs); offs += 2; } v = new String(sval); break; } case ClassDescriptor.FieldType.tpArrayOfByte: { int len = Bytes.unpack4(data, offs); offs += 4; byte[] val = new byte[len]; Array.Copy(pg.data, offs, val, 0, len); offs += len; v = val; break; } default: Debug.Assert(false, "Invalid type"); break; } values[i] = v; } return(values); }