Esempio n. 1
0
 private object BuildOneInstance(NativeObjectInfo objectInfo)
 {
     if (objectInfo.IsAtomicNativeObject())
         return BuildOneInstance((AtomicNativeObjectInfo) objectInfo);
     if (objectInfo.IsArrayObject())
         return BuildArrayInstance((ArrayObjectInfo) objectInfo);
     if (objectInfo.IsNull())
         return null;
     throw new OdbRuntimeException(
         NDatabaseError.InstanceBuilderNativeType.AddParameter(OdbType.GetNameFromId(objectInfo.GetOdbTypeId())));
 }
Esempio n. 2
0
        /// <summary>
        ///   Actually write the object data to the database file
        /// </summary>
        /// <param name="noi"> 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="writeInTransaction"> </param>
        /// <returns> The object posiiton or id(if &lt; 0) </returns>
        private long WriteNativeObjectInfo(NativeObjectInfo noi, long position, bool writeInTransaction)
        {
            if (OdbConfiguration.IsLoggingEnabled())
            {
                var positionAsString = position.ToString();
                DLogger.Debug(string.Concat("ObjectWriter: Writing native object at", positionAsString,
                                            string.Format(" : Type={0} | Value={1}",
                                                          OdbType.GetNameFromId(noi.GetOdbTypeId()), noi)));
            }

            if (noi.IsAtomicNativeObject())
                return WriteAtomicNativeObject((AtomicNativeObjectInfo) noi, writeInTransaction);
            if (noi.IsNull())
            {
                WriteNullNativeObjectHeader(noi.GetOdbTypeId(), writeInTransaction);
                return position;
            }
            if (noi.IsArrayObject())
                return WriteArray((ArrayObjectInfo) noi, writeInTransaction);
            if (noi.IsEnumObject())
                return WriteEnumNativeObject((EnumNativeObjectInfo) noi, writeInTransaction);
            throw new OdbRuntimeException(NDatabaseError.NativeTypeNotSupported.AddParameter(noi.GetOdbTypeId()));
        }