public void Encode(ByteArrayOutputStream os, IObjectInfo info) { PrimitiveCodec.WriteLong(os, info.GetInternalID()); long sourceDatabaseId = ((FrozenObjectInfo)info).SourceDatabaseId(this._enclosing .Transaction()); PrimitiveCodec.WriteLong(os, sourceDatabaseId); PrimitiveCodec.WriteLong(os, ((FrozenObjectInfo)info).UuidLongPart()); PrimitiveCodec.WriteLong(os, info.GetCommitTimestamp()); }
public virtual void TestVersionIncrease() { VersionNumbersTestCase.Item item = (VersionNumbersTestCase.Item)((VersionNumbersTestCase.Item )RetrieveOnlyInstance(typeof(VersionNumbersTestCase.Item))); IObjectInfo objectInfo = Db().GetObjectInfo(item); long version1 = objectInfo.GetCommitTimestamp(); item._name = "modified"; Db().Store(item); Db().Commit(); long version2 = objectInfo.GetCommitTimestamp(); Assert.IsGreater(version1, version2); Db().Store(item); Db().Commit(); objectInfo = Db().GetObjectInfo(item); long version3 = objectInfo.GetCommitTimestamp(); Assert.IsGreater(version2, version3); }
private void AssertGeneration(IObjectInfo objectInfo, bool expectGeneration) { if (expectGeneration) { Assert.IsNotNull(objectInfo.GetUUID()); } else { Assert.IsNull(objectInfo.GetUUID()); Assert.AreEqual(0L, objectInfo.GetCommitTimestamp()); } }
public long GetVersion() { const long version = 0; try { IObjectInfo objInfo = objectContainer.Ext().GetObjectInfo(m_genObject); return(objInfo != null?objInfo.GetCommitTimestamp() : version); } catch (Exception oEx) { LoggingHelper.HandleException(oEx); return(0); } }
protected override void AssertObjectsAreReadable(IExtObjectContainer objectContainer ) { if (Db4oMajorVersion() <= 6 || (Db4oMajorVersion() == 7 && Db4oMinorVersion() == 0)) { return; } CommitTimestampMigrationTestCase.Item item = ((CommitTimestampMigrationTestCase.Item )objectContainer.Query(typeof(CommitTimestampMigrationTestCase.Item)).Next()); IObjectInfo objectInfo = objectContainer.GetObjectInfo(item); long version = objectInfo.GetCommitTimestamp(); Assert.IsGreater(0, version); }
/// <exception cref="System.Exception"></exception> public virtual void TestCommitTimestampsNoSchemaDetection() { Fixture().ConfigureAtRuntime(new _IRuntimeConfigureAction_30()); Reopen(); Store(new CommitTimeStampsNoSchemaChangesTestCase.Holder()); Commit(); for (IEnumerator holderIter = Db().Query(typeof(CommitTimeStampsNoSchemaChangesTestCase.Holder )).GetEnumerator(); holderIter.MoveNext();) { CommitTimeStampsNoSchemaChangesTestCase.Holder holder = ((CommitTimeStampsNoSchemaChangesTestCase.Holder )holderIter.Current); IObjectInfo objectInfo = Db().Ext().GetObjectInfo(holder); long ts = objectInfo.GetCommitTimestamp(); Assert.IsGreater(0, ts); } }
internal Db4oReplicationReferenceImpl(IObjectInfo objectInfo, object obj) { if (obj == null) { throw new InvalidOperationException("obj may not be null"); } _version = objectInfo.GetCommitTimestamp(); ObjectReference @ref = (ObjectReference)objectInfo; Transaction trans = @ref.Transaction(); Db4objects.Db4o.Internal.VirtualAttributes va = @ref.VirtualAttributes(trans); if (va != null) { SetVirtualAttributes((Db4objects.Db4o.Internal.VirtualAttributes)va.ShallowClone( )); } else { SetVirtualAttributes(new Db4objects.Db4o.Internal.VirtualAttributes()); } SetObject(obj); Ref_init(); }
public virtual void Test() { IExtObjectContainer oc = this.Db(); ObjectVersionTest.Item @object = new ObjectVersionTest.Item("c1"); oc.Store(@object); IObjectInfo objectInfo1 = oc.GetObjectInfo(@object); long oldVer = objectInfo1.GetCommitTimestamp(); //Update @object.SetName("c3"); oc.Store(@object); IObjectInfo objectInfo2 = oc.GetObjectInfo(@object); long newVer = objectInfo2.GetCommitTimestamp(); Assert.IsNotNull(objectInfo1.GetUUID()); Assert.IsNotNull(objectInfo2.GetUUID()); Assert.IsTrue(oldVer > 0); Assert.IsTrue(newVer > 0); Assert.AreEqual(objectInfo1.GetUUID(), objectInfo2.GetUUID()); Assert.IsTrue(newVer > oldVer); }