OracleString.cs :  » 2.6.4-mono-.net-core » System.Data » System » Data » OracleClient » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » 2.6.4 mono .net core » System.Data 
System.Data » System » Data » OracleClient » OracleString.cs
//
// OracleString.cs 
//
// Part of the Mono class libraries at
// mcs/class/System.Data.OracleClient/System.Data.OracleClient
//
// Assembly: System.Data.OracleClient.dll
// Namespace: System.Data.OracleClient
//
// Authors: Tim Coleman <tim@timcoleman.com>
//          Atsushi Enomoto <atsushi@ximian.com>
//
// Copyright (C) Tim Coleman, 2003
//
// Licensed under the MIT/X11 License.
//

using System;
using System.Data.SqlTypes;
using System.Globalization;

namespace System.Data.OracleClient{
  public struct OracleString : IComparable, INullable
  {
    #region Fields

    string value;
    bool notNull;

    public static readonly OracleString Empty = new OracleString (String.Empty);
    public static readonly OracleString Null = new OracleString ();

    #endregion // Fields

    #region Constructors

    public OracleString (string s)
    {
      value = s;
      notNull = true;
    }

    #endregion // Constructors

    #region Properties

    public bool IsNull {
      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; }
    }

    #endregion // Properties

    #region Methods

    public int CompareTo (object obj)
    {
      if (obj == null)
        return 1;
      else if (!(obj is OracleString))
        throw new ArgumentException ("Value is not a System.Data.OracleClient.OracleString");
      else if (((OracleString) obj).IsNull)
        return 1;
      else
        return value.CompareTo (((OracleString) obj).Value);
    }

    public static OracleBoolean GreaterThan (OracleString x, OracleString y)
    {
      if (x.IsNull || y.IsNull)
        return OracleBoolean.Null;
      return (x > y);
    }

    public static OracleBoolean GreaterThanOrEqual (OracleString x, OracleString y)
    {
      if (x.IsNull || y.IsNull)
        return OracleBoolean.Null;
      return (x  >= y);
    }

    public static OracleBoolean LessThan (OracleString x, OracleString y)
    {
      return (x < y);
    }

    public static OracleBoolean LessThanOrEqual (OracleString x, OracleString y)
    {
      return (x <= y);
    }

    public static OracleString Concat (OracleString x, OracleString y)
    {
      return x + y;
    }

    public override int GetHashCode ()
    {
      // It returns value string's HashCode.
      return notNull ? value.GetHashCode () : 0;
    }

    public override bool Equals (object value)
    {
      if (value is OracleString) {
        OracleString s = (OracleString) value;
        if (notNull && s.notNull)
          return this.value == s.value;
        else
          throw new InvalidOperationException ("the value is Null.");
      }
      return false;
    }

    public static OracleBoolean Equals (OracleString x, OracleString y)
    {
      return (x == y);
    }

    public static OracleBoolean NotEquals (OracleString x, OracleString y)
    {
      return (x != y);
    }

    public override string ToString ()
    {
      return notNull ? value : "Null";
    }

    #endregion // Methods

    #region Operators

    public static OracleString operator + (OracleString x, OracleString y)
    {
      return (x.notNull && y.notNull) ?
        new OracleString (x.value + y.value) :
        Null;
    }

    public static OracleBoolean operator == (OracleString x, OracleString y)
    {
      return (!x.notNull || !y.notNull) ?
        OracleBoolean.Null : new OracleBoolean (x.value == y.value);
    }

    public static explicit operator string (OracleString x)
    {
      return x.Value;
    }

    [MonoTODO]
    public static OracleBoolean operator > (OracleString x, OracleString y)
    {
      throw new NotImplementedException ();
    }

    [MonoTODO]
    public static OracleBoolean operator >= (OracleString x, OracleString y)
    {
      throw new NotImplementedException ();
    }

    public static implicit operator OracleString (string s)
    {
      return new OracleString (s);
    }

    public static OracleBoolean operator != (OracleString x, OracleString y)
    {
      return (!x.notNull || !y.notNull) ?
        OracleBoolean.Null : x.value != y.value;
    }

    public static OracleBoolean operator < (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 operator <= (OracleString x, OracleString y)
    {
      return (!x.notNull || !y.notNull) ?
        OracleBoolean.Null : new OracleBoolean (String.Compare (x.value, y.value, false, CultureInfo.InvariantCulture) <= 0);
    }

    #endregion // Operators
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.