2 // System.Data.SqlTypes.SqlInt64
5 // Tim Coleman <tim@timcoleman.com>
7 // (C) Copyright 2002 Tim Coleman
12 namespace System.Data.SqlTypes
14 public struct SqlInt64 : INullable, IComparable
20 public static readonly SqlInt64 MaxValue; // 2^63 - 1
23 public static readonly SqlInt64 MinValue; // -2^63
26 public static readonly SqlInt64 Null;
27 public static readonly SqlInt64 Zero = new SqlInt64 (0);
33 public SqlInt64 (long value)
44 get { return (bool) (this == SqlInt64.Null); }
50 throw new SqlNullValueException ("The property contains Null.");
60 public static SqlInt64 Add (SqlInt64 x, SqlInt64 y)
65 public static SqlInt64 BitwiseAnd (SqlInt64 x, SqlInt64 y)
70 public static SqlInt64 BitwiseOr (SqlInt64 x, SqlInt64 y)
76 public int CompareTo (object value)
78 throw new NotImplementedException ();
81 public static SqlInt64 Divide (SqlInt64 x, SqlInt64 y)
87 public override bool Equals (object value)
89 throw new NotImplementedException ();
92 public static SqlBoolean Equals (SqlInt64 x, SqlInt64 y)
98 public override int GetHashCode ()
103 public static SqlBoolean GreaterThan (SqlInt64 x, SqlInt64 y)
108 public static SqlBoolean GreaterThanOrEqual (SqlInt64 x, SqlInt64 y)
113 public static SqlBoolean LessThan (SqlInt64 x, SqlInt64 y)
118 public static SqlBoolean LessThanOrEqual (SqlInt64 x, SqlInt64 y)
123 public static SqlInt64 Multiply (SqlInt64 x, SqlInt64 y)
128 public static SqlBoolean NotEquals (SqlInt64 x, SqlInt64 y)
133 public static SqlInt64 OnesComplement (SqlInt64 x)
139 public static SqlInt64 Parse (string s)
141 throw new NotImplementedException ();
144 public static SqlInt64 Subtract (SqlInt64 x, SqlInt64 y)
149 public SqlBoolean ToSqlBoolean ()
151 return ((SqlBoolean)this);
154 public SqlByte ToSqlByte ()
156 return ((SqlByte)this);
159 public SqlDecimal ToSqlDecimal ()
161 return ((SqlDecimal)this);
164 public SqlDouble ToSqlDouble ()
166 return ((SqlDouble)this);
169 public SqlInt16 ToSqlInt16 ()
171 return ((SqlInt16)this);
174 public SqlInt32 ToSqlInt32 ()
176 return ((SqlInt32)this);
179 public SqlMoney ToSqlMoney ()
181 return ((SqlMoney)this);
184 public SqlSingle ToSqlSingle ()
186 return ((SqlSingle)this);
190 public SqlString ToSqlString ()
192 throw new NotImplementedException ();
196 public override string ToString ()
198 throw new NotImplementedException ();
201 public static SqlInt64 Xor (SqlInt64 x, SqlInt64 y)
206 public static SqlInt64 operator + (SqlInt64 x, SqlInt64 y)
208 return new SqlInt64 (x.Value + y.Value);
211 public static SqlInt64 operator & (SqlInt64 x, SqlInt64 y)
213 return new SqlInt64 (x.value & y.Value);
216 public static SqlInt64 operator | (SqlInt64 x, SqlInt64 y)
218 return new SqlInt64 (x.value | y.Value);
221 public static SqlInt64 operator / (SqlInt64 x, SqlInt64 y)
223 return new SqlInt64 (x.Value / y.Value);
226 public static SqlBoolean operator == (SqlInt64 x, SqlInt64 y)
228 if (x.IsNull || y.IsNull) return SqlBoolean.Null;
229 return new SqlBoolean (x.Value == y.Value);
232 public static SqlInt64 operator ^ (SqlInt64 x, SqlInt64 y)
234 return new SqlInt64 (x.Value ^ y.Value);
237 public static SqlBoolean operator > (SqlInt64 x, SqlInt64 y)
239 if (x.IsNull || y.IsNull) return SqlBoolean.Null;
240 return new SqlBoolean (x.Value > y.Value);
243 public static SqlBoolean operator >= (SqlInt64 x, SqlInt64 y)
245 if (x.IsNull || y.IsNull) return SqlBoolean.Null;
246 return new SqlBoolean (x.Value >= y.Value);
249 public static SqlBoolean operator != (SqlInt64 x, SqlInt64 y)
251 if (x.IsNull || y.IsNull) return SqlBoolean.Null;
252 return new SqlBoolean (!(x.Value == y.Value));
255 public static SqlBoolean operator < (SqlInt64 x, SqlInt64 y)
257 if (x.IsNull || y.IsNull) return SqlBoolean.Null;
258 return new SqlBoolean (x.Value < y.Value);
261 public static SqlBoolean operator <= (SqlInt64 x, SqlInt64 y)
263 if (x.IsNull || y.IsNull) return SqlBoolean.Null;
264 return new SqlBoolean (x.Value <= y.Value);
267 public static SqlInt64 operator % (SqlInt64 x, SqlInt64 y)
269 return new SqlInt64(x.Value % y.Value);
272 public static SqlInt64 operator * (SqlInt64 x, SqlInt64 y)
274 return new SqlInt64 (x.Value * y.Value);
277 public static SqlInt64 operator ~ (SqlInt64 x)
279 return new SqlInt64 (~(x.Value));
282 public static SqlInt64 operator - (SqlInt64 x, SqlInt64 y)
284 return new SqlInt64 (x.Value - y.Value);
287 public static SqlInt64 operator - (SqlInt64 n)
289 return new SqlInt64 (-(n.Value));
292 public static explicit operator SqlInt64 (SqlBoolean x)
295 return SqlInt64.Null;
297 return new SqlInt64 ((long)x.ByteValue);
300 public static explicit operator SqlInt64 (SqlDecimal x)
303 return SqlInt64.Null;
305 return new SqlInt64 ((long)x.Value);
308 public static explicit operator SqlInt64 (SqlDouble x)
311 return SqlInt64.Null;
313 return new SqlInt64 ((long)x.Value);
316 public static explicit operator long (SqlInt64 x)
321 public static explicit operator SqlInt64 (SqlMoney x)
324 return SqlInt64.Null;
326 return new SqlInt64 ((long)x.Value);
329 public static explicit operator SqlInt64 (SqlSingle x)
332 return SqlInt64.Null;
334 return new SqlInt64 ((long)x.Value);
338 public static explicit operator SqlInt64 (SqlString x)
340 throw new NotImplementedException ();
343 public static explicit operator SqlInt64 (long x)
345 return new SqlInt64 (x);
348 public static explicit operator SqlInt64 (SqlByte x)
351 return SqlInt64.Null;
353 return new SqlInt64 ((long)x.Value);
356 public static explicit operator SqlInt64 (SqlInt16 x)
359 return SqlInt64.Null;
361 return new SqlInt64 ((long)x.Value);
364 public static explicit operator SqlInt64 (SqlInt32 x)
367 return SqlInt64.Null;
369 return new SqlInt64 ((long)x.Value);