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


C# NeoDatis.GetOdbTypeId方法代码示例

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


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

示例1: WriteNativeObjectInfo

		/// <summary>Actually write the object data to the database file</summary>
		/// <param name="oidOfObjectToQuery">The object id, can be -1 (not set)</param>
		/// <param name="aoi">The object meta infor The object info to be written</param>
		/// <param name="position">if -1, it is a new instance, if not, it is an update</param>
		/// <param name="updatePointers"></param>
		/// <returns>The object posiiton or id(if &lt;0)</returns>
		/// <exception cref="System.Exception">System.Exception</exception>
		/// <>
		/// * public OID writeObjectInfo(OID oid, AbstractObjectInfo
		/// aoi, long position, boolean updatePointers) throws Exception
		/// { currentDepth++;
		/// try {
		/// if (aoi.isNative()) { return
		/// writeNativeObjectInfo((NativeObjectInfo) aoi, position,
		/// updatePointers, false); }
		/// return writeNonNativeObjectInfo(oid, aoi, position,
		/// updatePointers, false); } finally { currentDepth--; } }
		/// </>
		private long WriteNativeObjectInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.NativeObjectInfo
			 noi, long position, bool updatePointers, bool writeInTransaction)
		{
			if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogIdDebug))
			{
				NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "Writing native object at " + position
					 + " : Type=" + NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.GetNameFromId(noi.GetOdbTypeId
					()) + " | Value=" + noi.ToString());
			}
			if (noi.IsAtomicNativeObject())
			{
				return WriteAtomicNativeObject((NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo
					)noi, writeInTransaction);
			}
			if (noi.IsNull())
			{
				WriteNullNativeObjectHeader(noi.GetOdbTypeId(), writeInTransaction);
				return position;
			}
			if (noi.IsCollectionObject())
			{
				return WriteCollection((NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
					)noi, writeInTransaction);
			}
			if (noi.IsMapObject())
			{
				return WriteMap((NeoDatis.Odb.Core.Layers.Layer2.Meta.MapObjectInfo)noi, writeInTransaction
					);
			}
			if (noi.IsArrayObject())
			{
				return WriteArray((NeoDatis.Odb.Core.Layers.Layer2.Meta.ArrayObjectInfo)noi, writeInTransaction
					);
			}
			if (noi.IsEnumObject())
			{
				return WriteEnumNativeObject((NeoDatis.Odb.Core.Layers.Layer2.Meta.EnumNativeObjectInfo
					)noi, writeInTransaction);
			}
			throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.NativeTypeNotSupported
				.AddParameter(noi.GetOdbTypeId()));
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:60,代码来源:AbstractObjectWriter.cs

示例2: WriteAtomicNativeObject

		public virtual long WriteAtomicNativeObject(NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo
			 anoi, bool writeInTransaction, int totalSpaceIfString)
		{
			long startPosition = fsi.GetPosition();
			int odbTypeId = anoi.GetOdbTypeId();
			WriteNativeObjectHeader(odbTypeId, anoi.IsNull(), NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes
				.BlockTypeNativeObject, writeInTransaction);
			if (anoi.IsNull())
			{
				// Even if object is null, reserve space for to simplify/enable in
				// place update
				fsi.EnsureSpaceFor(anoi.GetOdbType());
				return startPosition;
			}
			object @object = anoi.GetObject();
			switch (odbTypeId)
			{
				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.ByteId:
				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeByteId:
				{
					fsi.WriteByte(((byte)@object), writeInTransaction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.BooleanId:
				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeBooleanId:
				{
					fsi.WriteBoolean(((bool)@object), writeInTransaction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.CharacterId:
				{
					fsi.WriteChar(((char)@object), writeInTransaction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeCharId:
				{
					fsi.WriteChar(@object.ToString()[0], writeInTransaction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.FloatId:
				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeFloatId:
				{
					fsi.WriteFloat(((float)@object), writeInTransaction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.DoubleId:
				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeDoubleId:
				{
					fsi.WriteDouble(((double)@object), writeInTransaction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.IntegerId:
				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeIntId:
				{
					fsi.WriteInt(((int)@object), writeInTransaction, "native attr");
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.LongId:
				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeLongId:
				{
					fsi.WriteLong(((long)@object), writeInTransaction, "native attr", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
						.DataWriteAction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.ShortId:
				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.NativeShortId:
				{
					fsi.WriteShort(((short)@object), writeInTransaction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.BigDecimalId:
				{
					fsi.WriteBigDecimal((System.Decimal)@object, writeInTransaction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.BigIntegerId:
				{
					fsi.WriteBigInteger((System.Decimal)@object, writeInTransaction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.DateId:
				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.DateSqlId:
				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.DateTimestampId:
				{
					fsi.WriteDate((System.DateTime)@object, writeInTransaction);
					break;
				}

				case NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.StringId:
//.........这里部分代码省略.........
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:101,代码来源:AbstractObjectWriter.cs

示例3: WriteEnumNativeObject

		public virtual long WriteEnumNativeObject(NeoDatis.Odb.Core.Layers.Layer2.Meta.EnumNativeObjectInfo
			 anoi, bool writeInTransaction)
		{
			long startPosition = fsi.GetPosition();
			int odbTypeId = anoi.GetOdbTypeId();
			WriteNativeObjectHeader(odbTypeId, anoi.IsNull(), NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes
				.BlockTypeNativeObject, writeInTransaction);
			// Writes the Enum ClassName
			fsi.WriteLong(anoi.GetEnumClassInfo().GetId().GetObjectId(), writeInTransaction, 
				"enum class info id", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.DataWriteAction
				);
			// Write the Enum String value
			fsi.WriteString(anoi.GetObject().ToString(), writeInTransaction, true, -1);
			return startPosition;
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:15,代码来源:AbstractObjectWriter.cs

示例4: SafeOverWriteAtomicNativeObject

		/// <exception cref="Java.Lang.NumberFormatException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public virtual long SafeOverWriteAtomicNativeObject(long position, NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo
			 newAnoi, bool writeInTransaction)
		{
			// If the attribute an a non fix ize, check if this write is safe
			if (NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.HasFixSize(newAnoi.GetOdbTypeId(
				)))
			{
				fsi.SetWritePosition(position, writeInTransaction);
				return WriteAtomicNativeObject(newAnoi, writeInTransaction);
			}
			if (NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType.IsStringOrBigDicemalOrBigInteger
				(newAnoi.GetOdbTypeId()))
			{
				fsi.SetReadPosition(position + NeoDatis.Odb.Impl.Core.Layers.Layer3.Engine.StorageEngineConstant
					.NativeObjectOffsetDataArea);
				int totalSize = fsi.ReadInt("String total size");
				int stringNumberOfBytes = byteArrayConverter.GetNumberOfBytesOfAString(newAnoi.GetObject
					().ToString(), true);
				// Checks if there is enough space to store this new string in place
				bool canUpdate = totalSize >= stringNumberOfBytes;
				if (canUpdate)
				{
					fsi.SetWritePosition(position, writeInTransaction);
					return WriteAtomicNativeObject(newAnoi, writeInTransaction, totalSize);
				}
			}
			return -1;
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:30,代码来源:AbstractObjectWriter.cs

示例5: WriteMap

		/// <summary>
		/// <pre>
		/// Write a map to the database
		/// This is done by writing the number of element s and then the key and value pair of all elements.
		/// </summary>
		/// <remarks>
		/// <pre>
		/// Write a map to the database
		/// This is done by writing the number of element s and then the key and value pair of all elements.
		/// Example : a map with two string element : '1/olivier' and '2/chico'
		/// write 2 (as an int) : the number of elements
		/// write 4 times 0 (as long) to reserve the space for the elements positions
		/// then write the object '1' and 'olivier', and keeps the two posiitons in the 'positions' array of long
		/// then write the object '2' and the string chico' and keep the two position in the 'positions' array of long
		/// Then write back all the positions (in this case , 4 positions) after the size of the map
		/// &#064;param object
		/// &#064;param writeInTransaction To specify if these writes must be done in or out of a transaction
		/// &#064;
		/// </remarks>
		private long WriteMap(NeoDatis.Odb.Core.Layers.Layer2.Meta.MapObjectInfo moi, bool
			 writeInTransaction)
		{
			long firstObjectPosition = 0;
			long[] positions;
			long startPosition = fsi.GetPosition();
			WriteNativeObjectHeader(moi.GetOdbTypeId(), moi.IsNull(), NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes
				.BlockTypeMapObject, writeInTransaction);
			if (moi.IsNull())
			{
				return startPosition;
			}
			System.Collections.Generic.IDictionary<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
				, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo> map = moi.GetMap();
			int mapSize = map.Count;
			System.Collections.Generic.IEnumerator<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
				> keys = map.Keys.GetEnumerator();
			// write the map class
			fsi.WriteString(moi.GetRealMapClassName(), false, writeInTransaction);
			// write the size of the map
			fsi.WriteInt(mapSize, writeInTransaction, "map size");
			// build a n array to store all element positions
			positions = new long[mapSize * 2];
			// Gets the current position, to know later where to put the
			// references
			firstObjectPosition = fsi.GetPosition();
			// reserve space for object positions : write 'mapSize*2' long
			// with zero to store each object position
			for (int i = 0; i < mapSize * 2; i++)
			{
				fsi.WriteLong(0, writeInTransaction, "map element pos", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
					.DataWriteAction);
			}
			int currentElement = 0;
			while (keys.MoveNext())
			{
				NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo key = keys.Current;
				NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo value = map[key];
				NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType keyType = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
					.GetFromClass(key.GetType());
				NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType valueType = NeoDatis.Odb.Core.Layers.Layer2.Meta.ODBType
					.GetFromClass(value.GetType());
				positions[currentElement++] = InternalStoreObjectWrapper(key);
				positions[currentElement++] = InternalStoreObjectWrapper(value);
			}
			long positionAfterWrite = fsi.GetPosition();
			// now that all objects have been stored, sets their position in the
			// space that have been reserved
			fsi.SetWritePosition(firstObjectPosition, writeInTransaction);
			for (int i = 0; i < mapSize * 2; i++)
			{
				fsi.WriteLong(positions[i], writeInTransaction, "map real element pos", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
					.DataWriteAction);
			}
			// Gos back to the end of the array
			fsi.SetWritePosition(positionAfterWrite, writeInTransaction);
			return startPosition;
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:77,代码来源:AbstractObjectWriter.cs

示例6: WriteCollection

		/// <summary>
		/// TODO check if we should pass the position instead of requesting if to fsi
		/// <pre>
		/// Write a collection to the database
		/// This is done by writing the number of element s and then the position of all elements.
		/// </summary>
		/// <remarks>
		/// TODO check if we should pass the position instead of requesting if to fsi
		/// <pre>
		/// Write a collection to the database
		/// This is done by writing the number of element s and then the position of all elements.
		/// Example : a list with two string element : 'ola' and 'chico'
		/// write 2 (as an int) : the number of elements
		/// write two times 0 (as long) to reserve the space for the elements positions
		/// then write the string 'ola', and keeps its position in the 'positions' array of long
		/// then write the string 'chico' and keeps its position in the 'positions' array of long
		/// Then write back all the positions (in this case , 2 positions) after the size of the collection
		/// &lt;pre&gt;
		/// &#064;param coi
		/// &#064;param writeInTransaction
		/// &#064;
		/// </remarks>
		private long WriteCollection(NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
			 coi, bool writeInTransaction)
		{
			long firstObjectPosition = 0;
			long[] attributeIdentifications;
			long startPosition = fsi.GetPosition();
			WriteNativeObjectHeader(coi.GetOdbTypeId(), coi.IsNull(), NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes
				.BlockTypeCollectionObject, writeInTransaction);
			if (coi.IsNull())
			{
				return startPosition;
			}
			System.Collections.Generic.ICollection<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
				> collection = coi.GetCollection();
			int collectionSize = collection.Count;
			System.Collections.IEnumerator iterator = collection.GetEnumerator();
			// write the real type of the collection
			fsi.WriteString(coi.GetRealCollectionClassName(), false, writeInTransaction);
			// write the size of the collection
			fsi.WriteInt(collectionSize, writeInTransaction, "collection size");
			// build a n array to store all element positions
			attributeIdentifications = new long[collectionSize];
			// Gets the current position, to know later where to put the
			// references
			firstObjectPosition = fsi.GetPosition();
			// reserve space for object positions : write 'collectionSize' long
			// with zero to store each object position
			for (int i = 0; i < collectionSize; i++)
			{
				fsi.WriteLong(0, writeInTransaction, "collection element pos ", NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction
					.DataWriteAction);
			}
			int currentElement = 0;
			NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo element = null;
			while (iterator.MoveNext())
			{
				element = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo)iterator.Current;
				attributeIdentifications[currentElement] = InternalStoreObjectWrapper(element);
				currentElement++;
			}
			long positionAfterWrite = fsi.GetPosition();
			// now that all objects have been stored, sets their position in the
			// space that have been reserved
			fsi.SetWritePosition(firstObjectPosition, writeInTransaction);
			for (int i = 0; i < collectionSize; i++)
			{
				fsi.WriteLong(attributeIdentifications[i], writeInTransaction, "collection element real pos "
					, NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.DataWriteAction);
			}
			// Goes back to the end of the array
			fsi.SetWritePosition(positionAfterWrite, writeInTransaction);
			return startPosition;
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:75,代码来源:AbstractObjectWriter.cs


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