Browse Source

2004-05-20 Atsushi Enomoto <[email protected]>

	* OracleCommandBuilder.cs : Added (stub).
	* OracleString.cs : Implemented missing bits.

svn path=/trunk/mcs/; revision=27766
Atsushi Eno 21 năm trước cách đây
mục cha
commit
ccdf2e0bc1

+ 5 - 0
mcs/class/System.Data.OracleClient/ChangeLog

@@ -1,3 +1,8 @@
+2004-05-20  Atsushi Enomoto <[email protected]>
+
+	* OracleCommandBuilder.cs : Added (stub).
+	* OracleString.cs : Implemented missing bits.
+
 2004-04-10  Gonzalo Paniagua Javier <[email protected]>
 
 	* System.Data.OracleClient.Oci/OciDefineHandle.cs: added support for

+ 121 - 0
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommandBuilder.cs

@@ -0,0 +1,121 @@
+//
+// System.Data.Oracle.OracleCommandBuilder
+//
+// Author:
+//	Atsushi Enomoto <[email protected]>
+//
+// (C)2004 Novell Inc.
+//
+
+using System.ComponentModel;
+using System.Data;
+using System.Data.Common;
+
+namespace System.Data.Oracle
+{
+	public sealed class OracleCommandBuilder : Component
+	{
+		#region Fields
+
+		OracleDataAdapter adapter;
+		string quotePrefix;
+		string quoteSuffix;
+
+		#endregion // Fields
+
+		#region Constructors
+		
+		public OracleCommandBuilder ()
+		{
+			adapter = null;
+			quotePrefix = String.Empty;
+			quoteSuffix = String.Empty;
+		}
+
+		public OracleCommandBuilder (OracleDataAdapter adapter) 
+			: this ()
+		{
+			this.adapter = adapter;
+		}
+
+		#endregion // Constructors
+
+		#region Properties
+
+		[DataSysDescriptionAttribute ("The DataAdapter for which to automatically generate OracleCommands")]
+		[DefaultValue (null)]
+		public OracleDataAdapter DataAdapter {
+			get {
+				return adapter;
+			}
+			set {
+				adapter = value;
+			}
+		}
+
+		[BrowsableAttribute (false)]
+		[DataSysDescriptionAttribute ("The prefix string wrapped around sql objects")]
+                [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public string QuotePrefix {
+			get {
+				return quotePrefix;
+			}
+			set {
+				quotePrefix = value;
+			}
+		}
+
+		[BrowsableAttribute (false)]
+                [DataSysDescriptionAttribute ("The suffix string wrapped around sql objects")]
+                [DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
+		public string QuoteSuffix {
+			get {
+				return quoteSuffix;
+			}
+			set {
+				quoteSuffix = value;
+			}
+		}
+
+		#endregion // Properties
+
+		#region Methods
+
+		public static void DeriveParameters (OracleCommand command) 
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		protected override void Dispose (bool disposing) 
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public OracleCommand GetDeleteCommand ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public OracleCommand GetInsertCommand ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public OracleCommand GetUpdateCommand ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public void RefreshSchema ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		#endregion // Methods
+	}
+}

+ 68 - 2
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleString.cs

@@ -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
 	}
 }