public virtual IBlobData Overlay(Session session, IBlobData data, IBlobData overlay, long offset, long length, bool hasLength) { if ((data == null) || (overlay == null)) { return(null); } if (!hasLength) { length = overlay.Length(session); } int typeCode = base.TypeCode; if (typeCode == 30) { byte[] bytes = this.Substring(session, data, 0L, offset, false).GetBytes(); long num2 = (data.Length(session) + overlay.Length(session)) - length; IBlobData data3 = session.CreateBlob(num2); data3.SetBytes(session, 0L, bytes); data3.SetBytes(session, data3.Length(session), overlay.GetBytes()); bytes = this.Substring(session, data, offset + length, 0L, false).GetBytes(); data3.SetBytes(session, data3.Length(session), bytes); return(data3); } if ((typeCode - 60) > 1) { throw Error.RuntimeError(0xc9, "BinaryType"); } return(new BinaryData(session, new BinaryData(session, this.Substring(session, data, 0L, offset, true), overlay), this.Substring(session, data, offset + length, 0L, false))); }
public BinaryData(ISessionInterface session, IBlobData b1, IBlobData b2) { long num = b1.Length(session) + b2.Length(session); if (num > 0x7fffffffL) { throw Error.GetError(0xd49); } this._data = new byte[(int)num]; Array.Copy(b1.GetBytes(), 0, this._data, 0, (int)b1.Length(session)); Array.Copy(b2.GetBytes(), 0, this._data, (int)b1.Length(session), (int)b2.Length(session)); this._bitLength = (b1.Length(session) + b2.Length(session)) * 8L; }
public static long Position(ISessionInterface session, IBlobData data, IBlobData otherData, SqlType otherType, long offset) { if ((data == null) || (otherData == null)) { return(-1L); } long num2 = data.Length(session); if ((offset + num2) > data.Length(session)) { return(-1L); } return(data.Position(session, otherData, offset)); }
public override object ConvertToType(ISessionInterface session, object a, SqlType othType) { if (a == null) { return(null); } if (othType.TypeCode == 30) { return(a); } if ((othType.TypeCode == 60) || (othType.TypeCode == 0x3d)) { IBlobData data = (IBlobData)a; BlobDataId id1 = session.CreateBlob(data.Length(session)); id1.SetBytes(session, 0L, data.GetBytes()); return(id1); } if ((othType.TypeCode != 12) && (othType.TypeCode != 1)) { throw Error.GetError(0x15b9); } IBlobData data2 = session.GetScanner().ConvertToBinary((string)a); BlobDataId id2 = session.CreateBlob(data2.Length(session)); id2.SetBytes(session, 0L, data2.GetBytes()); return(id2); }
public override object ConvertSQLToCSharp(ISessionInterface session, object a) { IBlobData data1 = (IBlobData)a; int length = (int)data1.Length(session); return(data1.GetBytes(session, 0L, length)); }
public virtual IBlobData Substring(ISessionInterface session, IBlobData data, long offset, long length, bool hasLength) { long num2; long num = data.Length(session); if (hasLength) { num2 = offset + length; } else { num2 = (num > offset) ? num : offset; } if (offset > num2) { throw Error.GetError(0xd67); } if ((offset > num2) || (num2 < 0L)) { offset = 0L; num2 = 0L; } if (offset < 0L) { offset = 0L; } if (num2 > num) { num2 = num; } length = num2 - offset; return(new BinaryData(data.GetBytes(session, offset, (int)length), false)); }
public long Position(ISessionInterface session, IBlobData pattern, long start) { if (pattern.Length(session) > this._data.Length) { return(-1L); } byte[] bytes = pattern.GetBytes(); return(this.Position(session, bytes, start)); }
private object CastOrConvertToType(ISessionInterface session, object a, SqlType otherType, bool cast) { if (a == null) { return(null); } int typeCode = otherType.TypeCode; if (typeCode > 12) { if ((typeCode != 30) && ((typeCode - 60) > 1)) { goto Label_005A; } IBlobData data1 = (IBlobData)a; goto Label_0065; } switch (typeCode) { case 1: case 12: { IBlobData data = session.GetScanner().ConvertToBinary((string)a); otherType = GetBinaryType(0x3d, data.Length(session)); goto Label_0065; } } Label_005A: throw Error.GetError(0xd8f); Label_0065: if (base.Precision == 0) { return(null); } IBlobData data2 = null; if ((data2.Length(session) > base.Precision) && (data2.NonZeroLength(session) > base.Precision)) { if (!cast) { throw Error.GetError(0xd49); } session.AddWarning(Error.GetError(0x3ec)); } if (otherType.TypeCode == 30) { long num2 = data2.Length(session); if (num2 > base.Precision) { throw Error.GetError(0xd8f); } data2 = new BinaryData(data2.GetBytes(session, 0L, (int)num2), false); } int num3 = base.TypeCode; if (num3 == 60) { if (data2.Length(session) > base.Precision) { return(new BinaryData(data2.GetBytes(session, 0L, (int)base.Precision), false)); } if (data2.Length(session) < base.Precision) { data2 = new BinaryData(ArrayUtil.ResizeArray <byte>(data2.GetBytes(), (int)base.Precision), false); } return(data2); } if (num3 != 0x3d) { throw Error.GetError(0xd8f); } if (data2.Length(session) > base.Precision) { data2 = new BinaryData(data2.GetBytes(session, 0L, (int)base.Precision), false); } return(data2); }