|
|
@@ -7,7 +7,8 @@
|
|
|
// Assembly: System.Data.OracleClient.dll
|
|
|
// Namespace: System.Data.OracleClient
|
|
|
//
|
|
|
-// Author: Tim Coleman <[email protected]>
|
|
|
+// Authors: Tim Coleman <[email protected]>
|
|
|
+// Atsushi Enomoto <[email protected]>
|
|
|
//
|
|
|
// Copyright (C) Tim Coleman, 2003
|
|
|
//
|
|
|
@@ -16,8 +17,10 @@
|
|
|
|
|
|
using System;
|
|
|
using System.Data.SqlTypes;
|
|
|
+using System.Globalization;
|
|
|
|
|
|
-namespace System.Data.OracleClient {
|
|
|
+namespace System.Data.OracleClient
|
|
|
+{
|
|
|
public struct OracleString : IComparable, INullable
|
|
|
{
|
|
|
#region Fields
|
|
|
@@ -46,6 +49,14 @@ namespace System.Data.OracleClient {
|
|
|
get { return !notNull; }
|
|
|
}
|
|
|
|
|
|
+ public int Length {
|
|
|
+ get { return value.Length; }
|
|
|
+ }
|
|
|
+
|
|
|
+ public char this [int index] {
|
|
|
+ get { return value [index]; }
|
|
|
+ }
|
|
|
+
|
|
|
public string Value {
|
|
|
get { return value; }
|
|
|
}
|
|
|
@@ -66,6 +77,61 @@ namespace System.Data.OracleClient {
|
|
|
return this.value.CompareTo (((OracleString) value).Value);
|
|
|
}
|
|
|
|
|
|
+ public static OracleBoolean LessThan (OracleString x, OracleString y)
|
|
|
+ {
|
|
|
+ return (!x.notNull || !y.notNull) ?
|
|
|
+ OracleBoolean.Null :
|
|
|
+ new OracleBoolean (String.Compare (x.value, y.value, false, CultureInfo.InvariantCulture) < 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static OracleBoolean LessThanOrEqual (OracleString x, OracleString y)
|
|
|
+ {
|
|
|
+ return (!x.notNull || !y.notNull) ?
|
|
|
+ OracleBoolean.Null : new OracleBoolean (String.Compare (x.value, y.value, false, CultureInfo.InvariantCulture) <= 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static OracleString Concat (OracleString x, OracleString y)
|
|
|
+ {
|
|
|
+ return (x.notNull && y.notNull) ?
|
|
|
+ new OracleString (x.value + y.value) :
|
|
|
+ Null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public override int GetHashCode ()
|
|
|
+ {
|
|
|
+ // It returns value string's HashCode.
|
|
|
+ return notNull ? value.GetHashCode () : 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public override bool Equals (object o)
|
|
|
+ {
|
|
|
+ if (o is OracleString) {
|
|
|
+ OracleString s = (OracleString) o;
|
|
|
+ if (notNull && s.notNull)
|
|
|
+ return value == s.value;
|
|
|
+ else
|
|
|
+ throw new InvalidOperationException ("the value is Null.");
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static OracleBoolean Equals (OracleString x, OracleString y)
|
|
|
+ {
|
|
|
+ return (!x.notNull || !y.notNull) ?
|
|
|
+ OracleBoolean.Null : new OracleBoolean (x.value == y.value);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static OracleBoolean NotEquals (OracleString x, OracleString y)
|
|
|
+ {
|
|
|
+ return (!x.notNull || !y.notNull) ?
|
|
|
+ OracleBoolean.Null : x.value != y.value;
|
|
|
+ }
|
|
|
+
|
|
|
+ public override string ToString ()
|
|
|
+ {
|
|
|
+ return notNull ? value : "Null";
|
|
|
+ }
|
|
|
+
|
|
|
#endregion // Methods
|
|
|
}
|
|
|
}
|