本文整理汇总了C#中NeoDatis.GetCommitedZoneInfo方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.GetCommitedZoneInfo方法的具体用法?C# NeoDatis.GetCommitedZoneInfo怎么用?C# NeoDatis.GetCommitedZoneInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeoDatis
的用法示例。
在下文中一共展示了NeoDatis.GetCommitedZoneInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1:
/// <summary>Shift all unconnected infos to connected (committed) infos</summary>
/// <param name="classInfo"></param>
/// <returns>The updated class info</returns>
public virtual NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo BuildClassInfoForCommit
(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo)
{
long nbObjects = classInfo.GetNumberOfObjects();
classInfo.GetCommitedZoneInfo().SetNbObjects(nbObjects);
if (classInfo.GetCommitedZoneInfo().first != null)
{
}
else
{
// nothing to change
classInfo.GetCommitedZoneInfo().first = classInfo.GetUncommittedZoneInfo().first;
}
if (classInfo.GetUncommittedZoneInfo().last != null)
{
classInfo.GetCommitedZoneInfo().last = classInfo.GetUncommittedZoneInfo().last;
}
// Resets the unconnected zone info
classInfo.GetUncommittedZoneInfo().Set(new NeoDatis.Odb.Core.Layers.Layer2.Meta.CIZoneInfo
(classInfo, null, null, 0));
return classInfo;
}
示例2: UpdateInstanceFieldsOfClassInfo
/// <summary>
/// Updates the instance related field of the class info into the database
/// file Updates the number of objects, the first object oid and the next
/// class oid
/// </summary>
/// <param name="classInfo">The class info to be updated</param>
/// <param name="writeInTransaction">To specify if it must be part of a transaction @
/// </param>
public virtual void UpdateInstanceFieldsOfClassInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
classInfo, bool writeInTransaction)
{
long currentPosition = fsi.GetPosition();
if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogIdDebug))
{
NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "Start of updateInstanceFieldsOfClassInfo for "
+ classInfo.GetFullClassName());
}
long position = classInfo.GetPosition() + NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
.ClassOffsetClassNbObjects;
fsi.SetWritePosition(position, writeInTransaction);
long nbObjects = classInfo.GetNumberOfObjects();
fsi.WriteLong(nbObjects, writeInTransaction, "class info update nb objects", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
.PointerWriteAction);
WriteOid(classInfo.GetCommitedZoneInfo().first, writeInTransaction, "class info update first obj oid"
, NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.PointerWriteAction);
WriteOid(classInfo.GetCommitedZoneInfo().last, writeInTransaction, "class info update last obj oid"
, NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.PointerWriteAction);
if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogIdDebug))
{
NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "End of updateInstanceFieldsOfClassInfo for "
+ classInfo.GetFullClassName());
}
fsi.SetWritePosition(currentPosition, writeInTransaction);
}
示例3: WriteClassInfoHeader
public virtual void WriteClassInfoHeader(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
classInfo, long position, bool writeInTransaction)
{
NeoDatis.Odb.OID classId = classInfo.GetId();
if (classId == null)
{
classId = idManager.GetNextClassId(position);
classInfo.SetId(classId);
}
else
{
idManager.UpdateClassPositionForId(classId, position, true);
}
fsi.SetWritePosition(position, writeInTransaction);
if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
{
NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "Writing new Class info header at "
+ position + " : " + classInfo.ToString());
}
// Real value of block size is only known at the end of the writing
fsi.WriteInt(0, writeInTransaction, "block size");
fsi.WriteByte(NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes.BlockTypeClassHeader
, writeInTransaction, "class header block type");
fsi.WriteByte(classInfo.GetClassCategory(), writeInTransaction, "Class info category"
);
fsi.WriteLong(classId.GetObjectId(), writeInTransaction, "class id", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
.DataWriteAction);
WriteOid(classInfo.GetPreviousClassOID(), writeInTransaction, "prev class oid", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
.DataWriteAction);
WriteOid(classInfo.GetNextClassOID(), writeInTransaction, "next class oid", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
.DataWriteAction);
fsi.WriteLong(classInfo.GetCommitedZoneInfo().GetNbObjects(), writeInTransaction,
"class nb objects", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.DataWriteAction
);
WriteOid(classInfo.GetCommitedZoneInfo().first, writeInTransaction, "class first obj pos"
, NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.DataWriteAction);
WriteOid(classInfo.GetCommitedZoneInfo().last, writeInTransaction, "class last obj pos"
, NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.DataWriteAction);
// FIXME : append extra info if not empty (.net compatibility)
fsi.WriteString(classInfo.GetFullClassName(), false, writeInTransaction);
fsi.WriteInt(classInfo.GetMaxAttributeId(), writeInTransaction, "Max attribute id"
);
if (classInfo.GetAttributesDefinitionPosition() != -1)
{
fsi.WriteLong(classInfo.GetAttributesDefinitionPosition(), writeInTransaction, "class att def pos"
, NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.DataWriteAction);
}
else
{
// @todo check this
fsi.WriteLong(-1, writeInTransaction, "class att def pos", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
.DataWriteAction);
}
int blockSize = (int)(fsi.GetPosition() - position);
WriteBlockSizeAt(position, blockSize, writeInTransaction, classInfo);
}
示例4: ManageNewObjectPointers
/// <summary>Updates pointers of objects, Only changes uncommitted info pointers</summary>
/// <param name="objectInfo">The meta representation of the object being inserted</param>
/// <param name="classInfo">The class of the object being inserted</param>
/// <param name="position">The position where the object is being inserted @</param>
private void ManageNewObjectPointers(NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
objectInfo, NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo, long position
, NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel)
{
NeoDatis.Odb.Core.Transaction.ICache cache = storageEngine.GetSession(true).GetCache
();
bool isFirstUncommitedObject = !classInfo.GetUncommittedZoneInfo().HasObjects();
// if it is the first uncommitted object
if (isFirstUncommitedObject)
{
classInfo.GetUncommittedZoneInfo().first = objectInfo.GetOid();
NeoDatis.Odb.OID lastCommittedObjectOid = classInfo.GetCommitedZoneInfo().last;
if (lastCommittedObjectOid != null)
{
// Also updates the last committed object next object oid in
// memory to connect the committed
// zone with unconnected for THIS transaction (only in memory)
NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = cache.GetObjectInfoHeaderFromOid
(lastCommittedObjectOid, true);
oih.SetNextObjectOID(objectInfo.GetOid());
// And sets the previous oid of the current object with the last
// committed oid
objectInfo.SetPreviousInstanceOID(lastCommittedObjectOid);
}
}
else
{
// Gets the last object, updates its (next object)
// pointer to the new object and updates the class info 'last
// uncommitted object
// oid' field
NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oip = classInfo.GetLastObjectInfoHeader
();
if (oip == null)
{
throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.InternalError
.AddParameter("last OIP is null in manageNewObjectPointers oid=" + objectInfo.GetOid
()));
}
if (oip.GetNextObjectOID() != objectInfo.GetOid())
{
oip.SetNextObjectOID(objectInfo.GetOid());
// Here we are working in unconnected zone, so this
// can be done without transaction: actually
// write in database file
UpdateNextObjectFieldOfObjectInfo(oip.GetOid(), oip.GetNextObjectOID(), false);
objectInfo.SetPreviousInstanceOID(oip.GetOid());
// Resets the class info oid: In some case,
// (client // server) it may be -1.
oip.SetClassInfoId(classInfo.GetId());
// object info oip has been changed, we must put it
// in the cache to turn this change available for current
// transaction until the commit
storageEngine.GetSession(true).GetCache().AddObjectInfo(oip);
}
}
// always set the new last object oid and the number of objects
classInfo.GetUncommittedZoneInfo().last = objectInfo.GetOid();
classInfo.GetUncommittedZoneInfo().IncreaseNbObjects();
// Then updates the last info pointers of the class info
// with this new created object
// At this moment, the objectInfo.getHeader() do not have the
// attribute ids.
// but later in this code, the attributes will be set, so the class
// info also will have them
classInfo.SetLastObjectInfoHeader(objectInfo.GetHeader());
// // Saves the fact that something has changed in the class (number of
// objects and/or last object oid)
storageEngine.GetSession(true).GetMetaModel().AddChangedClass(classInfo);
}