当前位置: 首页>>代码示例>>C#>>正文


C# NeoDatis.SetPreviousInstanceOID方法代码示例

本文整理汇总了C#中NeoDatis.SetPreviousInstanceOID方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.SetPreviousInstanceOID方法的具体用法?C# NeoDatis.SetPreviousInstanceOID怎么用?C# NeoDatis.SetPreviousInstanceOID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NeoDatis的用法示例。


在下文中一共展示了NeoDatis.SetPreviousInstanceOID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateNonNativeObjectInfo


//.........这里部分代码省略.........
					}
				}
				// If we reach this update, In Place Update was not possible. Do a
				// normal update. Deletes the
				// current object and creates a new one
				if (oldMetaRepresentation == null && withIndex)
				{
					// We must load old meta representation to be able to compute
					// old index key to update index
					oldMetaRepresentation = objectReader.ReadNonNativeObjectInfoFromPosition(null, oid
						, currentPosition, false, false);
				}
				nbNormalUpdates++;
				if (hasObject)
				{
					cache.StartInsertingObjectWithOid(@object, oid, nnoi);
				}
				// gets class info from in memory meta model
				NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo ci = lsession.GetMetaModel().GetClassInfoFromId
					(lastHeader.GetClassInfoId());
				if (hasObject)
				{
					// removes the object from the cache
					// cache.removeObjectWithOid(oid, object);
					cache.EndInsertingObject(@object);
				}
				NeoDatis.Odb.OID previousObjectOID = lastHeader.GetPreviousObjectOID();
				NeoDatis.Odb.OID nextObjectOid = lastHeader.GetNextObjectOID();
				if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
				{
					NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "Updating object " + nnoi.ToString(
						));
					NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "position =  " + currentPosition + 
						" | prev instance = " + previousObjectOID + " | next instance = " + nextObjectOid
						);
				}
				nnoi.SetPreviousInstanceOID(previousObjectOID);
				nnoi.SetNextObjectOID(nextObjectOid);
				// Mark the block of current object as deleted
				MarkAsDeleted(currentPosition, oid, objectIsInConnectedZone);
				// Creates the new object
				oid = InsertNonNativeObject(oid, nnoi, false);
				// This position after write must be call just after the insert!!
				long positionAfterWrite = fsi.GetPosition();
				if (hasObject)
				{
					// update cache
					cache.AddObject(oid, @object, nnoi.GetHeader());
				}
				//TODO check if we must update cross session cache
				fsi.SetWritePosition(positionAfterWrite, true);
				long nbConnectedObjectsAfter = nnoi.GetClassInfo().GetCommitedZoneInfo().GetNbObjects
					();
				long nbNonConnectedObjectsAfter = nnoi.GetClassInfo().GetUncommittedZoneInfo().GetNbObjects
					();
				if (nbConnectedObjectsAfter != nbConnectedObjects || nbNonConnectedObjectsAfter !=
					 nbNonConnectedObjects)
				{
				}
				// TODO check this
				// throw new
				// ODBRuntimeException(Error.INTERNAL_ERROR.addParameter("Error
				// in nb connected/unconnected counter"));
				return oid;
			}
			catch (System.Exception e)
			{
				message = DepthToSpaces() + "Error updating object " + nnoi.ToString() + " : " + 
					NeoDatis.Tool.Wrappers.OdbString.ExceptionToString(e, true);
				NeoDatis.Tool.DLogger.Error(message);
				throw new NeoDatis.Odb.ODBRuntimeException(e, message);
			}
			finally
			{
				if (objectHasChanged)
				{
					if (withIndex)
					{
						ManageIndexesForUpdate(oid, nnoi, oldMetaRepresentation);
					}
					// triggers,FIXME passing null to old object representation
					// (oldMetaRepresentation may be null)
					if (hasObject)
					{
						storageEngine.GetTriggerManager().ManageUpdateTriggerAfter(nnoi.GetClassInfo().GetFullClassName
							(), oldMetaRepresentation, @object, oid);
					}
					else
					{
						storageEngine.GetTriggerManager().ManageUpdateTriggerAfter(nnoi.GetClassInfo().GetFullClassName
							(), oldMetaRepresentation, nnoi, oid);
					}
				}
				if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
				{
					NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "end updating object with oid=" + oid
						 + " at pos " + nnoi.GetPosition() + " => " + nnoi.ToString());
				}
			}
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:101,代码来源:AbstractObjectWriter.cs

示例2: 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);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:74,代码来源:AbstractObjectWriter.cs


注:本文中的NeoDatis.SetPreviousInstanceOID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。