2 // Mono.Data.SybaseTypes.SybaseDateTime
5 // Tim Coleman <tim@timcoleman.com>
7 // (C) Copyright Tim Coleman, 2002
10 using Mono.Data.SybaseClient;
12 using System.Data.SqlTypes;
13 using System.Globalization;
15 namespace Mono.Data.SybaseTypes {
16 public struct SybaseDateTime : INullable, IComparable
19 private DateTime value;
22 public static readonly SybaseDateTime MaxValue = new SybaseDateTime (9999,12,31);
23 public static readonly SybaseDateTime MinValue = new SybaseDateTime (1753,1,1);
24 public static readonly SybaseDateTime Null;
25 public static readonly int SQLTicksPerHour;
26 public static readonly int SQLTicksPerMinute;
27 public static readonly int SQLTicksPerSecond;
33 public SybaseDateTime (DateTime value)
40 public SybaseDateTime (int dayTicks, int timeTicks)
42 throw new NotImplementedException ();
45 public SybaseDateTime (int year, int month, int day)
47 this.value = new DateTime (year, month, day);
51 public SybaseDateTime (int year, int month, int day, int hour, int minute, int second)
53 this.value = new DateTime (year, month, day, hour, minute, second);
58 public SybaseDateTime (int year, int month, int day, int hour, int minute, int second, double millisecond)
60 throw new NotImplementedException ();
64 public SybaseDateTime (int year, int month, int day, int hour, int minute, int second, int bilisecond)
66 throw new NotImplementedException ();
75 get { throw new NotImplementedException (); }
79 get { return !notNull; }
83 public int TimeTicks {
84 get { throw new NotImplementedException (); }
87 public DateTime Value {
90 throw new SybaseNullValueException ("The property contains Null.");
100 public int CompareTo (object value)
104 else if (!(value is SybaseDateTime))
105 throw new ArgumentException (Locale.GetText ("Value is not a System.Data.SybaseTypes.SybaseDateTime"));
106 else if (((SybaseDateTime)value).IsNull)
109 return this.value.CompareTo (((SybaseDateTime)value).Value);
112 public override bool Equals (object value)
114 if (!(value is SybaseDateTime))
117 return (bool) (this == (SybaseDateTime)value);
120 public static SybaseBoolean Equals (SybaseDateTime x, SybaseDateTime y)
126 public override int GetHashCode ()
131 public static SybaseBoolean GreaterThan (SybaseDateTime x, SybaseDateTime y)
136 public static SybaseBoolean GreaterThanOrEqual (SybaseDateTime x, SybaseDateTime y)
141 public static SybaseBoolean LessThan (SybaseDateTime x, SybaseDateTime y)
146 public static SybaseBoolean LessThanOrEqual (SybaseDateTime x, SybaseDateTime y)
151 public static SybaseBoolean NotEquals (SybaseDateTime x, SybaseDateTime y)
157 public static SybaseDateTime Parse (string s)
159 throw new NotImplementedException ();
162 public SybaseString ToSybaseString ()
164 return ((SybaseString)this);
167 public override string ToString ()
172 return value.ToString ();
176 public static SybaseDateTime operator + (SybaseDateTime x, TimeSpan t)
178 throw new NotImplementedException ();
181 public static SybaseBoolean operator == (SybaseDateTime x, SybaseDateTime y)
183 if (x.IsNull || y.IsNull)
184 return SybaseBoolean.Null;
186 return new SybaseBoolean (x.Value == y.Value);
189 public static SybaseBoolean operator > (SybaseDateTime x, SybaseDateTime y)
191 if (x.IsNull || y.IsNull)
192 return SybaseBoolean.Null;
194 return new SybaseBoolean (x.Value > y.Value);
197 public static SybaseBoolean operator >= (SybaseDateTime x, SybaseDateTime y)
199 if (x.IsNull || y.IsNull)
200 return SybaseBoolean.Null;
202 return new SybaseBoolean (x.Value >= y.Value);
205 public static SybaseBoolean operator != (SybaseDateTime x, SybaseDateTime y)
207 if (x.IsNull || y.IsNull)
208 return SybaseBoolean.Null;
210 return new SybaseBoolean (!(x.Value == y.Value));
213 public static SybaseBoolean operator < (SybaseDateTime x, SybaseDateTime y)
215 if (x.IsNull || y.IsNull)
216 return SybaseBoolean.Null;
218 return new SybaseBoolean (x.Value < y.Value);
221 public static SybaseBoolean operator <= (SybaseDateTime x, SybaseDateTime y)
223 if (x.IsNull || y.IsNull)
224 return SybaseBoolean.Null;
226 return new SybaseBoolean (x.Value <= y.Value);
230 public static SybaseDateTime operator - (SybaseDateTime x, TimeSpan t)
232 throw new NotImplementedException ();
235 public static explicit operator DateTime (SybaseDateTime x)
241 public static explicit operator SybaseDateTime (SybaseString x)
243 throw new NotImplementedException();
246 public static implicit operator SybaseDateTime (DateTime x)
248 return new SybaseDateTime (x);