2003-12-16 Joerg Rosenkranz <joergr@voelcker.com>
[mono.git] / mcs / class / System.Data.OracleClient / System.Data.OracleClient / OracleString.cs
1 //
2 // OracleString.cs 
3 //
4 // Part of the Mono class libraries at
5 // mcs/class/System.Data.OracleClient/System.Data.OracleClient
6 //
7 // Assembly: System.Data.OracleClient.dll
8 // Namespace: System.Data.OracleClient
9 //
10 // Author: Tim Coleman <tim@timcoleman.com>
11 //
12 // Copyright (C) Tim Coleman, 2003
13 //
14 // Licensed under the MIT/X11 License.
15 //
16
17 using System;
18 using System.Data.SqlTypes;
19
20 namespace System.Data.OracleClient {
21         public struct OracleString : IComparable, INullable
22         {
23                 #region Fields
24
25                 string value;
26                 bool notNull;
27
28                 public static readonly OracleString Empty = new OracleString (String.Empty);
29                 public static readonly OracleString Null = new OracleString ();
30
31                 #endregion // Fields
32
33                 #region Constructors
34
35                 public OracleString (string s)
36                 {
37                         value = s;
38                         notNull = true;
39                 }
40
41                 #endregion // Constructors
42
43                 #region Properties
44
45                 public bool IsNull {
46                         get { return !notNull; }
47                 }
48
49                 public string Value {
50                         get { return value; }
51                 }
52
53                 #endregion // Properties
54
55                 #region Methods
56
57                 public int CompareTo (object value)
58                 {
59                         if (value == null)
60                                 return 1;
61                         else if (!(value is OracleString))
62                                 throw new ArgumentException ("Value is not a System.Data.OracleClient.OracleString");
63                         else if (((OracleString) value).IsNull)
64                                 return 1;
65                         else
66                                 return this.value.CompareTo (((OracleString) value).Value);
67                 }
68
69                 #endregion // Methods
70         }
71 }