+2002-10-28 Ville Palo <vi64pa@koti.soon.fi>
+
+ * System.Data.SqlTypes/SqlBinary.cs:
+ * System.Data.SqlTypes/SqlBoolean.cs:
+ * System.Data.SqlTypes/SqlByte.cs:
+ * System.Data.SqlTypes/SqlDateTime.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ * System.Data.SqlTypes/SqlDouble.cs:
+ * System.Data.SqlTypes/SqlDecimal.cs:
+ * System.Data.SqlTypes/SqlDouble.cs:
+ * System.Data.SqlTypes/SqlGuid.cs:
+ * System.Data.SqlTypes/SqlInt16.cs:
+ * System.Data.SqlTypes/SqlInt32.cs:
+ * System.Data.SqlTypes/SqlInt64.cs:
+ * System.Data.SqlTypes/Money.cs:
+ * System.Data.SqlTypes/SqlSingle.cs:
+ * System.Data.SqlTypes/SqlString.cs:
+ * System.Data.SqlTypes/SqlSingle.cs: Fixed internal loop bugs and
+ some other minor fixes.
+
2002-10-27 Rodrigo Moya <rodrigo@ximian.com>
* System.Data.OleDb/OleDbDataAdapter.cs (Fill, FillSchema,
#region Fields
byte[] value;
+ private bool notNull;
public static readonly SqlBinary Null;
public SqlBinary (byte[] value)
{
this.value = value;
+ notNull = true;
}
#endregion
#region Properties
public bool IsNull {
- get { return (bool) (this == Null); }
+ get { return !notNull; }
}
public byte this[int index] {
#region Fields
byte value;
+
+ // default is false
+ private bool notNull;
public static readonly SqlBoolean False = new SqlBoolean (false);
public static readonly SqlBoolean Null;
public SqlBoolean (bool value)
{
this.value = (byte) (value ? 1 : 0);
+ notNull = true;
}
public SqlBoolean (int value)
{
this.value = (byte) (value != 0 ? 1 : 0);
+ notNull = true;
}
#endregion // Constructors
public byte ByteValue {
get {
if (this.IsNull)
- throw new SqlNullValueException( "The property is set to null.");
+ throw new SqlNullValueException(Locale.GetText("The property is set to null."));
else
return value;
}
}
public bool IsNull {
- get { return (bool) (this == Null); }
+ get {
+ return !notNull;
+ }
}
public bool IsTrue {
public bool Value {
get {
if (this.IsNull)
- throw new SqlNullValueException( "The property is set to null.");
+ throw new SqlNullValueException(Locale.GetText("The property is set to null."));
else
return this.IsTrue;
}
public SqlString ToSqlString()
{
if (this.IsNull)
- throw new SqlNullValueException ("The value is null");
+ return new SqlString ("Null");
if (this.IsTrue)
return new SqlString ("True");
else
public override string ToString()
{
if (this.IsNull)
- throw new SqlNullValueException ("The value is null");
+ return "Null";
if (this.IsTrue)
return "True";
else
#region Fields
byte value;
+ private bool notNull;
+
public static readonly SqlByte MaxValue = new SqlByte (0xff);
public static readonly SqlByte MinValue = new SqlByte (0);
public static readonly SqlByte Null;
public SqlByte (byte value)
{
this.value = value;
+ notNull = true;
}
#endregion
#region Properties
public bool IsNull {
- get { return (bool) (this == Null); }
+ get { return !notNull; }
}
public byte Value {
public override string ToString ()
{
if (this.IsNull)
- return String.Empty;
+ return "Null";
else
return value.ToString ();
}
{
#region Fields
private DateTime value;
+ private bool notNull;
public static readonly SqlDateTime MaxValue = new SqlDateTime (9999,12,31);
public static readonly SqlDateTime MinValue = new SqlDateTime (1753,1,1);
public SqlDateTime (DateTime value)
{
this.value = value;
+ notNull = true;
}
[MonoTODO]
public SqlDateTime (int dayTicks, int timeTicks)
{
throw new NotImplementedException ();
+ notNull = true;
}
public SqlDateTime (int year, int month, int day)
{
this.value = new DateTime (year, month, day);
+ notNull = true;
}
public SqlDateTime (int year, int month, int day, int hour, int minute, int second)
{
this.value = new DateTime (year, month, day, hour, minute, second);
+ notNull = true;
}
[MonoTODO]
public SqlDateTime (int year, int month, int day, int hour, int minute, int second, double millisecond)
{
throw new NotImplementedException ();
+ notNull = true;
}
[MonoTODO]
public SqlDateTime (int year, int month, int day, int hour, int minute, int second, int bilisecond)
{
throw new NotImplementedException ();
+ notNull = true;
}
#endregion
}
public bool IsNull {
- get { return (bool) (this == Null); }
+ get { return !notNull; }
}
[MonoTODO]
byte scale;
bool positive;
+ private bool notNull;
+
// borrowed from System.Decimal
const int SCALE_SHIFT = 16;
const int SIGN_SHIFT = 31;
this.value[1] = binData[1];
this.value[2] = binData[2];
this.value[3] = 0;
+ notNull = true;
}
public SqlDecimal (double value) : this ((decimal)value) { }
this.value[1] = data2;
this.value[2] = data3;
this.value[3] = data4;
+ notNull = true;
}
#endregion
}
public bool IsNull {
- get { return (bool) (this == Null); }
+ get { return !notNull; }
}
public bool IsPositive {
#region Fields
double value;
+ private bool notNull;
+
public static readonly SqlDouble MaxValue = new SqlDouble (1.7976931348623157e308);
public static readonly SqlDouble MinValue = new SqlDouble (-1.7976931348623157e308);
public static readonly SqlDouble Null;
public SqlDouble (double value)
{
this.value = value;
+ notNull = true;
}
#endregion
#region Properties
public bool IsNull {
- get { return (bool) (this == Null); }
+ get { return !notNull; }
}
public double Value {
public override int GetHashCode ()
{
- return (int)value;
+ long LongValue = (long)value;
+ return (int)(LongValue ^ (LongValue >> 32));
+
}
public static SqlBoolean GreaterThan (SqlDouble x, SqlDouble y)
{
#region Fields
- Guid value;
+ Guid value;
+
+ private bool notNull;
public static readonly SqlGuid Null;
public SqlGuid (byte[] value)
{
this.value = new Guid (value);
+ notNull = true;
}
public SqlGuid (Guid g)
{
this.value = g;
+ notNull = true;
}
public SqlGuid (string s)
{
this.value = new Guid (s);
+ notNull = true;
}
public SqlGuid (int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k)
{
this.value = new Guid (a, b, c, d, e, f, g, h, i, j, k);
+ notNull = true;
}
#endregion
#region Properties
public bool IsNull {
- get { return (bool) (this == SqlGuid.Null); }
+ get { return !notNull; }
}
public Guid Value {
#region Fields
short value;
+ private bool notNull;
public static readonly SqlInt16 MaxValue = new SqlInt16 (32767);
public static readonly SqlInt16 MinValue = new SqlInt16 (-32768);
public SqlInt16 (short value)
{
this.value = value;
+ notNull = true;;
}
#endregion
#region Properties
public bool IsNull {
- get { return (bool) (this == Null); }
+ get { return !notNull; }
}
public short Value {
public override string ToString ()
{
if (this.IsNull)
- return String.Empty;
+ return "Null";
else
return value.ToString ();
}
public static SqlInt16 operator | (SqlInt16 x, SqlInt16 y)
{
- return new SqlInt16 ((short) (x | y));
+ return new SqlInt16 ((short) (x.Value | y.Value));
}
public static SqlInt16 operator / (SqlInt16 x, SqlInt16 y)
#region Fields
int value;
+ private bool notNull;
public static readonly SqlInt32 MaxValue = new SqlInt32 (2147483647);
public static readonly SqlInt32 MinValue = new SqlInt32 (-2147483648);
public SqlInt32(int value)
{
this.value = value;
+ notNull = true;
}
#endregion
#region Properties
public bool IsNull {
- get { return (bool) (this == Null); }
+ get { return !notNull; }
}
public int Value {
public override string ToString()
{
if (this.IsNull)
- return String.Empty;
+ return "Null";
else
return value.ToString ();
}
#region Fields
long value;
-
+
+ private bool notNull;
public static readonly SqlInt64 MaxValue = new SqlInt64 (9223372036854775807);
public static readonly SqlInt64 MinValue = new SqlInt64 (-9223372036854775808);
public SqlInt64 (long value)
{
this.value = value;
+ notNull = true;
}
#endregion
#region Properties
public bool IsNull {
- get { return (bool) (this == Null); }
+ get { return !notNull; }
}
public long Value {
public override string ToString ()
{
+ if (this.IsNull)
+ return "Null";
+
return value.ToString ();
}
#region Fields
decimal value;
+
+ private bool notNull;
- public static readonly SqlMoney MaxValue = new SqlMoney (922337203685475.5807);
+ public static readonly SqlMoney MaxValue = new SqlMoney (922337203685477.5807);
public static readonly SqlMoney MinValue = new SqlMoney (-922337203685477.5808);
public static readonly SqlMoney Null;
public static readonly SqlMoney Zero = new SqlMoney (0);
public SqlMoney (decimal value)
{
this.value = value;
+ notNull = true;
}
public SqlMoney (double value)
{
this.value = (decimal)value;
+ notNull = true;
}
public SqlMoney (int value)
{
this.value = (decimal)value;
+ notNull = true;
}
public SqlMoney (long value)
{
this.value = (decimal)value;
+ notNull = true;
}
#endregion
[MonoTODO]
public bool IsNull {
- get { return (bool) (this == Null); }
+ get { return !notNull; }
}
public decimal Value {
return (x == y);
}
- [MonoTODO]
public override int GetHashCode ()
{
return (int)value;
return (x != y);
}
- [MonoTODO]
public static SqlMoney Parse (string s)
{
- throw new NotImplementedException ();
+ decimal d = Decimal.Parse (s);
+
+ if (d > SqlMoney.MaxValue.Value || d < SqlMoney.MinValue.Value)
+ throw new OverflowException ("");
+
+ return new SqlMoney (d);
}
public static SqlMoney Subtract (SqlMoney x, SqlMoney y)
return new SqlMoney ((decimal)x.Value);
}
- [MonoTODO]
public static explicit operator SqlMoney (SqlString x)
{
- throw new NotImplementedException ();
+ return SqlMoney.Parse (x.Value);
}
public static implicit operator SqlMoney (decimal x)
float value;
+ private bool notNull;
+
public static readonly SqlSingle MaxValue = new SqlSingle (3.40282346638528859e38);
public static readonly SqlSingle MinValue = new SqlSingle (-3.40282346638528859e38);
public static readonly SqlSingle Null;
public SqlSingle (double value)
{
this.value = (float)value;
+ notNull = true;
}
public SqlSingle (float value)
{
this.value = value;
+ notNull = true;
}
#endregion
#region Properties
public bool IsNull {
- get { return (bool) (this == Null); }
+ get { return !notNull; }
}
public float Value {
public override int GetHashCode ()
{
- return (int)value;
+ long LongValue = (long) value;
+ return (int)(LongValue ^ (LongValue >> 32));
}
public static SqlBoolean GreaterThan (SqlSingle x, SqlSingle y)
string value;
+ private bool notNull;
+
public static readonly int BinarySort;
public static readonly int IgnoreCase;
public static readonly int IgnoreKanaType;
public SqlString (string data)
{
this.value = data;
+ notNull = true;
}
// init with a string data and locale id values.
public SqlString (string data, int lcid)
{
throw new NotImplementedException ();
+ notNull = true;
}
// init with locale id, compare options,
public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data)
{
throw new NotImplementedException ();
+ notNull = true;
}
// init with string data, locale id, and compare options
public SqlString (string data, int lcid, SqlCompareOptions compareOptions)
{
throw new NotImplementedException ();
+ notNull = true;
}
// init with locale id, compare options, array of bytes data,
public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data, bool fUnicode)
{
throw new NotImplementedException ();
+ notNull = true;
}
// init with locale id, compare options, array of bytes data,
public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data, int index, int count)
{
throw new NotImplementedException ();
+ notNull = true;
}
// init with locale id, compare options, array of bytes data,
public SqlString (int lcid, SqlCompareOptions compareOptions, byte[] data, int index, int count, bool fUnicode)
{
throw new NotImplementedException ();
+ notNull = true;
}
#endregion // Constructors
}
public bool IsNull {
- get { return (bool) (this == SqlString.Null); }
+ get { return !notNull; }
}
// geographics location and language (locale id)