2 // Mono.Data.TdsTypes.TdsBinary
5 // Tim Coleman (tim@timcoleman.com)
7 // (C) Copyright Tim Coleman, 2002
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using Mono
.Data
.TdsClient
;
33 using System
.Data
.SqlTypes
;
34 using System
.Globalization
;
36 namespace Mono
.Data
.TdsTypes
{
37 public struct TdsBinary
: INullable
, IComparable
44 public static readonly TdsBinary Null
;
50 public TdsBinary (byte[] value)
61 get { return !notNull; }
64 public byte this[int index
] {
67 throw new TdsNullValueException ("The property contains Null.");
68 else if (index
>= this.Length
)
69 throw new TdsNullValueException ("The index parameter indicates a position beyond the length of the byte array.");
78 throw new TdsNullValueException ("The property contains Null.");
88 throw new TdsNullValueException ("The property contains Null.");
99 public int CompareTo (object value)
101 throw new NotImplementedException ();
104 public static TdsBinary
Concat (TdsBinary x
, TdsBinary y
)
109 public override bool Equals (object value)
111 if (!(value is TdsBinary
))
114 return (bool) (this == (TdsBinary
)value);
117 public static TdsBoolean
Equals (TdsBinary x
, TdsBinary y
)
123 public override int GetHashCode ()
125 throw new NotImplementedException ();
132 public static TdsBoolean
GreaterThan (TdsBinary x
, TdsBinary y
)
137 public static TdsBoolean
GreaterThanOrEqual (TdsBinary x
, TdsBinary y
)
142 public static TdsBoolean
LessThan (TdsBinary x
, TdsBinary y
)
147 public static TdsBoolean
LessThanOrEqual (TdsBinary x
, TdsBinary y
)
152 public static TdsBoolean
NotEquals (TdsBinary x
, TdsBinary y
)
157 public TdsGuid
ToTdsGuid ()
159 return new TdsGuid (value);
162 public override string ToString ()
166 return String
.Format ("TdsBinary ({0})", Length
);
174 public static TdsBinary
operator + (TdsBinary x
, TdsBinary y
)
176 throw new NotImplementedException ();
180 public static TdsBoolean
operator == (TdsBinary x
, TdsBinary y
)
182 if (x
.IsNull
|| y
.IsNull
)
183 return TdsBoolean
.Null
;
185 throw new NotImplementedException ();
189 public static TdsBoolean
operator > (TdsBinary x
, TdsBinary y
)
191 if (x
.IsNull
|| y
.IsNull
)
192 return TdsBoolean
.Null
;
194 throw new NotImplementedException ();
198 public static TdsBoolean
operator >= (TdsBinary x
, TdsBinary y
)
200 if (x
.IsNull
|| y
.IsNull
)
201 return TdsBoolean
.Null
;
203 throw new NotImplementedException ();
207 public static TdsBoolean
operator != (TdsBinary x
, TdsBinary y
)
209 if (x
.IsNull
|| y
.IsNull
)
210 return TdsBoolean
.Null
;
212 throw new NotImplementedException ();
216 public static TdsBoolean
operator < (TdsBinary x
, TdsBinary y
)
218 if (x
.IsNull
|| y
.IsNull
)
219 return TdsBoolean
.Null
;
221 throw new NotImplementedException ();
225 public static TdsBoolean
operator <= (TdsBinary x
, TdsBinary y
)
227 if (x
.IsNull
|| y
.IsNull
)
228 return TdsBoolean
.Null
;
230 throw new NotImplementedException ();
233 public static explicit operator byte[] (TdsBinary x
)
239 public static explicit operator TdsBinary (TdsGuid x
)
241 throw new NotImplementedException ();
244 public static implicit operator TdsBinary (byte[] x
)
246 return new TdsBinary (x
);