Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@ -0,0 +1,271 @@
2010-02-14 Veerapuram Varadhan <vvaradhan@novell.com>
** Fixes 667855
* OracleParameter.cs (InferSize): For Raw types, use the appropriate
methods to convert value to bytearray and use them to bind.
(Bind): Fix index parameters in call to Array.ConstrainedCopy.
2010-01-30 Veerapuram Varadhan <vvaradhan@novell.com>
** Fixes #667236 - Based on patch by Kalyanov.Dmitry@gmail.com
* OracleParameter.cs (GetOutValue): Handle OciDataType.Integer
appropriately using the underlying dbType.
2009-10-29 Veerapuram Varadhan <vvaradhan@novell.com>
** Fixes #322695
* OracleParameter.cs: Use oracle returned rsize instead of
MAXBYTECOUNT. Reduces the size of allocated buffer.
2009-10-29 Veerapuram Varadhan <vvaradhan@novell.com>
** Fixes #321718
* OracleParameter.cs: Update Environment handle in OciLobLocator.
2009-09-30 Veerapuram Varadhan <vvaradhan@novell.com>
** Fixes #543207
* OracleParameter.cs (Bind): Do not remove the trailing-null-byte.
2009-09-25 Veerapuram Varadhan <vvaradhan@novell.com>
** Fixes #535889
* OracleParameter.cs: In case of OUT param, update sizeSet even if
value is null or DBNull. Also, use rsize instead of bindSize to
avoid extra allocation.
2009-09-20 Daniel Morgan <monodanmorg@yahoo.com>
* OracleConnection.cs: implement GetSchema methods
2009-06-04 Veerapuram Varadhan <vvaradhan@novell.com>
* OracleParameter.cs: Infer size only for 2.0 profile when only
value is passed. Fixes test failure under 1.1 profile.
2009-06-03 Veerapuram Varadhan <vvaradhan@novell.com>
* OracleParameter.cs: If a non-zero size is passed, update
the size member but sizeSet is updated only when a non-null
value is passed.
2009-05-15 Veerapuram Varadhan <vvaradhan@novell.com>
* OracleParameter.cs: Consider DBNull.Value as null and
update size and sizeSet accordingly.
2009-05-15 Veerapuram Varadhan <vvaradhan@novell.com>
** Fixes #424908
* OracleParameter.cs: Make sure size and sizeSet are properly
updated whenever value changes.
2009-03-29 Veerapuram Varadhan <vvaradhan@novell.com>
* Fixes #480377
* OracleDataReader.cs: Implement MonthSpan and TimeSpan.
2009-03-20 Daniel Morgan <monodanmorg@yahoo.com>
* OracleCommand.cs: fix suggested by Thracx <SpamMonkey01+Mono@gmail.com>
where the parameter was always item zero for an out parameter.
2009-02-23 Veerapuram Varadhan <vvaradhan@novell.com>
* OracleException: 2.0 changes - patch submitted by
Jay Wren <jrwren@xmtp.net>
2009-02-19 Veerapuram Varadhan <vvaradhan@novell.com>
* OracleParameter.cs (bind): Consider OciDataType.Float and .Integer as
OciDataType.Number. Patch provided by Russell <russell.kay@realtimeworlds.com>
2008-07-06 Sebastien Pouliot <sebastien@ximian.com>
* OracleDataReader.cs: Replace a few Type.GetType by typeof
[Found using Gendarme AvoidTypeGetTypeForConstantStringsRule]
2008-05-07 Gert Driesen <drieseng@users.sourceforge.net>
* OracleTransaction.cs: Corcompare fixes for 2.0 profile. Implemented
DbConnection and Dispose override. Code formatting.
* OracleLob.cs: Implemented Dispose overloads. Code formatting.
* OracleCommand.cs: Removed extra connection_timeout field. Fixed
DesignTimeVisible. Changed CommandText to return zero-length string
when underlying value is null. Fixed CommandTimeout to always
return 0. Implemented DbConnection, DbParameterCollection and
DbTransaction properties. Corcompare fixes for 2.0 profile.
* OracleTimeSpan.cs: In OracleTimeSpan ctor, throw NRE when from
is Null timespan. Fixed Hours property to actually return hours instead
of days. Modified Value to throw InvalidOperationException when
current instance is Null. Fixed explicit operator argument name.
* OracleRowUpdatingEventArgs.cs: Added missing BaseCommand override.
* OracleParameterCollection.cs: Removed extra internal ctor.
Corcompare fixes for 2.0 profile. On 1.0 profile, perform culture
sensitive and case-insensitive lookup. On 2.0 profile, first perform
case-sensitive lookup and fallback to case-insensitive lookup.
Set and remove Container where necessary, and perform checks for
ownership. Implemented AddRange overloads, and (Get/Set)Parameter.
Added several 2.0 overloads taking OracleParameter. Fixed exceptions
to match MS.
* OracleDataReader.cs: Corcompare fixes for 2.0 profile. Moved
disposing of schematable to Close, and invoke Close from Dispose.
Reduce casts. Stubbed methods introduced in 2.0 profile.
* OracleConnection.cs: Corcompare fixes for 2.0 profile. Changed
ConnectionString to return zero-length string when underlying value is
null. Removed explicit IDisposable implementation. Use string.Empty
instead of "". Code formatting.
* OracleMonthSpan.cs: Code formatting. Changed argument name of
explicit operator to match MS.
* OracleDataAdapter.cs: Code formatting. Fixed default ctor to use
null for SelectCommand. In 2.0 profile, set UpdateBatchSize to 1 and
throw AORE when setting it to negative value. Modified *Command setters
to throw InvalidCastException instead of ArgumentException. Removed
extra TableMappings property.
* OracleParameter.cs: Use zero-length string as default for
SourceColumn. Added missing 2.0 ctor. In ParameterName return zero
length string when name is null. Added SourceColumnNullMapping
property. Corcompare fixes for 2.0 profile. Code formatting.
* OracleBFile.cs: Added Dispose override for 2.0 profile.
2007-11-11 Leszek Ciesielski <skolima@gmail.com>
* OracleCommands.cs: fix for binging procedure parameters by name
rather than position (by Gary Thomas)
2007-11-01 Marek Safar <marek.safar@gmail.com>
* OracleCommand.cs,
* OracleConnection.cs,
* OracleTransaction.cs: 2.0 profile updates.
2007-05-25 Nidhi Rawal <rawalnidhi_rawal@gmail.com>
* OracleDateTime.cs: Wrote the methods CompareTo (object) and Equals (object).
* OracleClientFactory.cs: Wrote methods CreatePermission (PermissionState) and CreateDataSourceEnumerator ().
* OracleString.cs: Wrote methods GreaterThan (OracleString, OracleString) and
GreaterThanOrEqual (OracleString, OracleString).
* OracleDataAdapter.cs: Wrote the property UpdateBatchSize.
2007-05-25 Amit Biswas <amit@amitbiswas.com>
* OracleParameterCollection.cs: Fixed the bugs in properties IsFixedSize, IsReadOnly and IsSynchronized.
* OracleTimeSpan.cs: Implemented methods CompareTo (object) and Equals (object).
* OracleMonthSpan.cs: Implemented methods CompareTo (object) and Equals (object).
2007-03-29 Leszek Ciesielski <skolima@gmail.com>
* OracleConnection.cs: consecutive calls to Open() do not spawn
multiple connections
2007-02-13 Leszek Ciesielski <skolima@gmail.com>
* OracleNumber.cs: added an internal IFormattable ToString
* OracleParameter.cs: added handling of OracleString, OracleDateTime,
OracleNumber
2007-01-04 Leszek Ciesielski <skolima@gmail.com>
* OracleParameter.cs: padding the allocated memory with 0's (this is what OCI
expects)
2006-10-19 Leszek Ciesielski <skolima@gmail.com>
* OracleConnection.cs: moved setting SessionFormatProvider from Open() into first access to it.
* OracleParameter.cs: made exception in InferOracleType a bit more verbose.
2006-10-17 Leszek Ciesielski <skolima@gmail.com>
* OracleCommand.cs: changed returned value of ExecuteScalar to null when no recods are
found
* OracleDataReader.cs: Marked GetSchemaTable with MonoTODO
* OracleParameter.cs: fixed the constructor (it ignored some
parameters and could not handle System.DBNull)
* OciDefineHandle.cs: applied patch for trimming strings with unicode,
although I can't test it :-/
2006-05-31 Gert Driesen <drieseng@users.sourceforge.net>
* OciGlue.cs: Set eol-style to native.
* OracleBFile.cs: Set eol-style to native.
* OracleBinary.cs: Set eol-style to native.
* OracleBoolean.cs: Set eol-style to native.
* OracleCommandBuilder.cs: Set eol-style to native.
* OracleCommand.cs: Set eol-style to native.
* OracleConnection.cs: Set eol-style to native.
* OracleConnectionPool.cs: Set eol-style to native.
* OracleConnectionPoolManager.cs: Set eol-style to native.
* OracleDataAdapter.cs: Set eol-style to native.
* OracleDataReader.cs: Set eol-style to native.
* OracleDateTime.cs: Set eol-style to native.
* OracleException.cs: Set eol-style to native.
* OracleInfoMessageEventArgs.cs: Set eol-style to native.
* OracleInfoMessageEventHandler.cs: Set eol-style to native.
* OracleLob.cs: Set eol-style to native.
* OracleLobOpenMode.cs: Set eol-style to native.
* OracleMonthSpan.cs: Set eol-style to native.
* OracleNumber.cs: Set eol-style to native.
* OracleParameterCollection.cs: Set eol-style to native.
* OracleParameter.cs: Set eol-style to native.
* OraclePermissionAttribute.cs: Set eol-style to native.
* OraclePermission.cs: Set eol-style to native.
* OracleRowUpdatedEventArgs.cs: Set eol-style to native.
* OracleRowUpdatedEventHandler.cs: Set eol-style to native.
* OracleRowUpdatingEventArgs.cs: Set eol-style to native.
* OracleRowUpdatingEventHandler.cs: Set eol-style to native.
* OracleString.cs: Set eol-style to native.
* OracleTimeSpan.cs: Set eol-style to native.
* OracleTransaction.cs: Set eol-style to native.
* OracleType.cs: Set eol-style to native.
2006-05-31 Gert Driesen <drieseng@users.sourceforge.net>
* OracleLob.cs: Explicitly implement IDisposable interface. Fixes
API signature warning for Dispose () method.
* OracleParameterCollection.cs: Removed explicit interface implemenation
of IList.IsFixedSize, IList.IsReadOnbly, IList.IsSynchronized and
IList.SyncRoot. Fixes API signature mismatches.
* OracleBFile.cs: Explicit implemenat IDisposable interface. Fixed
API signature warning for Dispose () method.
* OracleCommand.cs: Fixed line endings.
* OracleConnection.cs: Removed destructor, as the destructor in
System.ComponentModel.Component already calls the Dispose (bool) method.
* OracleDataReader.cs: Fixed line endings.
* OracleDateTime.cs: Fixed line endings.
* OracleParameter.cs: Fixed line endings.
2006-02-27 Konstantin Triger <kostat@mainsoft.com>
* OracleDataAdapter.cs: Do not throw ArgumentException when null is passed.
2005-11-21 Senganal T <tsenganal@novell.com>
* OracleCommandBuilder.cs :
- ApplyParameterInfo - modified the args list
- GetParameterName (string) - added
Changes for ado.net 2.0 api compatibility
2005-04-06 Daniel Morgan <danielmorgan@verizon.net>
* OracleParameter.cs: implement IClonable.Clone()
patch from eto@shaw.ca (Curtis)
2005-02-21 Sureshkumar T <tsureshkumar@novell.com>
* OracleCommand.cs: set behavior for execute reader.
fixes bug #72607.
2005-02-15 Sureshkumar T <tsureshkumar@novell.com>
* OracleDataReader.cs : GetBytes: return the length of the data if
output buffer is null. if not, copy the values to buffer and
return the bytes actually read.
fixes bug #72472.
2004-12-19 Daniel Morgan <danielmorgan@verizon.net>
* OracleCommand.cs: ExecuteReader needs to be able
to handle non queries too
2004-09-14 Sebastien Pouliot <sebastien@ximian.com>
* ChangeLog: New.
* OraclePermission.cs: Adapted to work for both Fx 1.1 and 2.0. Fx 1.1
version isn't complete (as anyway it requires FullTrust on MS
implementation) but DO NOT throw exceptions (for the security engine).
* OraclePermissionAttribute.cs: Implemented CreatePermission. Adapted
to work for both Fx 1.1 and 2.0.

View File

@ -0,0 +1,253 @@
//
// ociglue.cs - provides glue between
// managed C#/.NET System.Data.OracleClient.dll and
// unmanaged native c library oci.dll
// to be used in Mono System.Data.OracleClient as
// the Oracle 8i data provider.
//
// Part of managed C#/.NET library System.Data.OracleClient.dll
//
// Part of the Mono class libraries at
// mcs/class/System.Data.OracleClient/System.Data.OracleClient.OCI
//
// Assembly: System.Data.OracleClient.dll
// Namespace: System.Data.OracleClient.Oci
//
// Authors:
// Daniel Morgan <monodanmorg@yahoo.com>
// Tim Coleman <tim@timcoleman.com>
//
// Copyright (C) Daniel Morgan, 2002, 2009
// Copyright (C) Tim Coleman, 2002
//
//#define ORACLE_DATA_ACCESS
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace System.Data.OracleClient.Oci {
internal sealed class OciGlue
{
#region Fields
bool connected;
OciEnvironmentHandle environment;
OciErrorHandle error;
OciServerHandle server;
OciServiceHandle service;
OciSessionHandle session;
// OCI Return Codes
public const int OCI_DEFAULT = 0;
public const int OCI_SUCCESS = 0;
public const int OCI_SUCCESS_WITH_INFO = 1; // Diagnostic or Warning message - call OCIErrorGet
public const int OCI_RESERVED_FOR_INT_USE = 200;
public const int OCI_NO_DATA = 100;
public const int OCI_ERROR = -1; // use error handle to get error code and description - call OCIErrorGet
public const int OCI_INVALID_HANDLE = -2;
public const int OCI_NEED_DATA = 99;
public const int OCI_STILL_EXECUTING = -3123;
public const int OCI_CONTINUE = -24200;
#endregion // Fields
#region Properties
public bool Connected {
get { return connected; }
}
public OciEnvironmentHandle Environment {
get { return environment; }
}
public OciErrorHandle ErrorHandle {
get { return error; }
}
public OciServiceHandle ServiceContext {
get { return service; }
}
public OciServerHandle ServerHandle {
get { return server; }
}
public OciSessionHandle SessionHandle {
get { return session; }
}
#endregion // Properties
#region Methods
public void CreateConnection (OracleConnectionInfo conInfo)
{
environment = new OciEnvironmentHandle (OciEnvironmentMode.Threaded | OciEnvironmentMode.NoUserCallback);
if (environment.Handle == IntPtr.Zero)
throw new OracleException (0, "Could not allocate the Oracle environment.");
service = (OciServiceHandle) environment.Allocate (OciHandleType.Service);
if (service == null) {
OciErrorInfo info = environment.HandleError ();
Disconnect ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
error = (OciErrorHandle) environment.Allocate (OciHandleType.Error);
if (error == null) {
OciErrorInfo info = environment.HandleError ();
Disconnect ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
service.ErrorHandle = error;
server = (OciServerHandle) environment.Allocate (OciHandleType.Server);
if (server == null) {
OciErrorInfo info = environment.HandleError ();
Disconnect ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
session = (OciSessionHandle) environment.Allocate (OciHandleType.Session);
if (session == null) {
OciErrorInfo info = environment.HandleError ();
Disconnect ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
session.Username = conInfo.Username;
session.Password = conInfo.Password;
session.Service = service;
if (!server.Attach (conInfo.Database, ErrorHandle)) {
OciErrorInfo info = error.HandleError ();
Disconnect ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
if (!service.SetServer (server)) {
OciErrorInfo info = error.HandleError ();
Disconnect ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
#if ORACLE_DATA_ACCESS
if (conInfo.SetNewPassword == true) {
// open with new password
if (!service.SetSession (session)) {
OciErrorInfo info = error.HandleError ();
Disconnect ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
if (!service.ChangePassword (conInfo.NewPassword, error)) {
OciErrorInfo info = error.HandleError ();
Disconnect ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
conInfo.Password = conInfo.NewPassword;
conInfo.SetNewPassword = false;
conInfo.NewPassword = string.Empty;
} else {
#endif
// open normally
if (!session.BeginSession (conInfo.CredentialType, OciSessionMode.Default, ErrorHandle)) {
OciErrorInfo info = error.HandleError ();
Disconnect ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
if (!service.SetSession (session)) {
OciErrorInfo info = error.HandleError ();
Disconnect ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
#if ORACLE_DATA_ACCESS
}
#endif
connected = true;
}
public OciStatementHandle CreateStatement ()
{
OciStatementHandle statement = (OciStatementHandle) environment.Allocate (OciHandleType.Statement);
if (statement == null) {
OciErrorInfo info = environment.HandleError ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
statement.ErrorHandle = error;
statement.Service = service;
return statement;
}
public OciTransactionHandle CreateTransaction ()
{
OciTransactionHandle transaction = (OciTransactionHandle) environment.Allocate (OciHandleType.Transaction);
if (transaction == null) {
OciErrorInfo info = environment.HandleError ();
throw new OracleException (info.ErrorCode, info.ErrorMessage);
}
transaction.ErrorHandle = error;
transaction.Service = service;
return transaction;
}
public void Disconnect()
{
if (session != null) {
session.EndSession (error);
session.Dispose ();
session = null;
}
if (server != null) {
server.Detach (error);
server.Dispose ();
server = null;
}
if (error != null) {
error.Dispose ();
error = null;
}
if (service != null) {
service.Dispose ();
service = null;
}
if (environment != null) {
environment.Dispose ();
environment = null;
}
}
public static string ReturnCodeToString (int status)
{
switch (status) {
case OCI_DEFAULT:
return "OCI_DEFAULT or OCI_SUCCESS"; // both are zero
case OCI_SUCCESS_WITH_INFO:
return "OCI_SUCCESS_WITH_INFO";
case OCI_RESERVED_FOR_INT_USE:
return "OCI_RESERVED_FOR_INT_USE";
case OCI_NO_DATA:
return "OCI_NO_DATA";
case OCI_ERROR:
return "OCI_ERROR";
case OCI_INVALID_HANDLE:
return "OCI_INVALID_HANDLE";
case OCI_NEED_DATA:
return "OCI_NEED_DATA";
case OCI_STILL_EXECUTING:
return "OCI_STILL_EXECUTING";
case OCI_CONTINUE:
return "OCI_CONTINUE";
}
return "Unknown Error";
}
#endregion // Methods
}
}

View File

@ -0,0 +1,225 @@
//
// OracleBFile.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
//
// Author: Tim Coleman <tim@timcoleman.com>
//
// Copyright (C) Tim Coleman, 2003
//
// Licensed under the MIT/X11 License.
//
using System;
using System.IO;
using System.Data.SqlTypes;
namespace System.Data.OracleClient
{
public sealed class OracleBFile : Stream, ICloneable, IDisposable, INullable
{
#region Fields
public static readonly new OracleBFile Null = new OracleBFile ();
//OracleConnection connection;
//bool isOpen;
//bool notNull;
#endregion // Fields
#region Constructors
internal OracleBFile ()
{
}
#endregion // Constructors
#region Properties
public override bool CanRead {
get {
//return (IsNull || isOpen);
throw new NotImplementedException ();
}
}
public override bool CanSeek {
get {
//return (IsNull || isOpen);
throw new NotImplementedException ();
}
}
public override bool CanWrite {
get {
//return false;
throw new NotImplementedException ();
}
}
public OracleConnection Connection {
get {
//return connection;
throw new NotImplementedException ();
}
}
public string DirectoryName {
[MonoTODO]
get {
//if (!isOpen)
// throw new ObjectDisposedException ("OracleBFile");
throw new NotImplementedException ();
}
}
public bool FileExists {
[MonoTODO]
get {
//if (!isOpen)
// throw new ObjectDisposedException ("OracleBFile");
//if (Connection.State == ConnectionState.Closed)
// throw new InvalidOperationException ();
throw new NotImplementedException ();
}
}
public string FileName {
[MonoTODO]
get {
//if (!isOpen)
// throw new ObjectDisposedException ("OracleBFile");
//if (IsNull)
// return String.Empty;
throw new NotImplementedException ();
}
}
public bool IsNull {
get {
//return !notNull;
throw new NotImplementedException ();
}
}
public override long Length {
[MonoTODO]
get {
//if (!isOpen)
// throw new ObjectDisposedException ("OracleBFile");
throw new NotImplementedException ();
}
}
public override long Position {
[MonoTODO]
get {
//if (!isOpen)
// throw new ObjectDisposedException ("OracleBFile");
throw new NotImplementedException ();
}
[MonoTODO]
set {
//if (!isOpen)
// throw new ObjectDisposedException ("OracleBFile");
//if (value > Length)
// throw new ArgumentOutOfRangeException ();
throw new NotImplementedException ();
}
}
public object Value {
[MonoTODO]
get {
throw new NotImplementedException ();
}
}
#endregion // Properties
#region Methods
[MonoTODO]
public object Clone ()
{
throw new NotImplementedException ();
}
[MonoTODO]
public long CopyTo (OracleLob destination)
{
throw new NotImplementedException ();
}
[MonoTODO]
public long CopyTo (OracleLob destination, long destinationOffset)
{
throw new NotImplementedException ();
}
[MonoTODO]
public long CopyTo (long sourceOffset, OracleLob destination, long destinationOffset, long amount)
{
throw new NotImplementedException ();
}
#if NET_2_0
protected override void Dispose (bool disposing)
{
throw new NotImplementedException ();
}
#else
[MonoTODO]
public void Dispose ()
{
throw new NotImplementedException ();
}
#endif
[MonoTODO]
public override void Flush ()
{
throw new NotImplementedException ();
}
[MonoTODO]
public override int Read (byte[] buffer, int offset, int count)
{
throw new NotImplementedException ();
}
[MonoTODO]
public override long Seek (long offset, SeekOrigin origin)
{
throw new NotImplementedException ();
}
[MonoTODO]
public void SetFileName (string directory, string file)
{
throw new NotImplementedException ();
}
[MonoTODO]
public override void SetLength (long value)
{
throw new InvalidOperationException ();
}
[MonoTODO]
public override void Write (byte[] buffer, int offset, int count)
{
throw new NotSupportedException ();
}
#endregion // Methods
}
}

View File

@ -0,0 +1,204 @@
//
// OracleBinary.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
//
// Author: Tim Coleman <tim@timcoleman.com>
//
// Copyright (C) Tim Coleman, 2003
//
// Licensed under the MIT/X11 License.
//
using System;
using System.IO;
using System.Data.SqlTypes;
namespace System.Data.OracleClient {
public struct OracleBinary : IComparable, INullable
{
#region Fields
public static readonly OracleBinary Null = new OracleBinary ();
bool notNull;
byte[] value;
#endregion // Fields
#region Constructors
public OracleBinary (byte[] b)
{
value = b;
notNull = true;
}
#endregion // Constructors
#region Properties
public bool IsNull {
get { return !notNull; }
}
public byte this [int index] {
get {
if (IsNull)
throw new Exception ("Data is null.");
return value [index];
}
}
public int Length {
get {
if (IsNull)
throw new Exception ("Data is null.");
return value.Length;
}
}
public byte[] Value {
get {
if (IsNull)
throw new Exception ("Data is null.");
return value;
}
}
#endregion // Properties
#region Methods
[MonoTODO]
public int CompareTo (object obj)
{
throw new NotImplementedException ();
}
[MonoTODO]
public static OracleBinary Concat (OracleBinary x, OracleBinary y)
{
throw new NotImplementedException ();
}
[MonoTODO]
public override bool Equals (object value)
{
throw new NotImplementedException ();
}
public static OracleBoolean Equals (OracleBinary x, OracleBinary y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value == y.Value);
}
[MonoTODO]
public override int GetHashCode ()
{
throw new NotImplementedException ();
}
[MonoTODO]
public static OracleBoolean GreaterThan (OracleBinary x, OracleBinary y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
//return (x.Value > y.Value);
throw new NotImplementedException ();
}
[MonoTODO]
public static OracleBoolean GreaterThanOrEqual (OracleBinary x, OracleBinary y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
//return (x.Value >= y.Value);
throw new NotImplementedException ();
}
[MonoTODO]
public static OracleBoolean LessThan (OracleBinary x, OracleBinary y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
//return (x.Value < y.Value);
throw new NotImplementedException ();
}
[MonoTODO]
public static OracleBoolean LessThanOrEqual (OracleBinary x, OracleBinary y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
//return (x.Value <= y.Value);
throw new NotImplementedException ();
}
[MonoTODO]
public static OracleBoolean NotEquals (OracleBinary x, OracleBinary y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
//return (x.Value != y.Value);
throw new NotImplementedException ();
}
#endregion // Methods
#region Operators and Type Conversions
public static OracleBinary operator + (OracleBinary x, OracleBinary y)
{
return Concat (x, y);
}
public static OracleBoolean operator == (OracleBinary x, OracleBinary y)
{
return Equals (x, y);
}
public static OracleBoolean operator > (OracleBinary x, OracleBinary y)
{
return GreaterThan (x, y);
}
public static OracleBoolean operator >= (OracleBinary x, OracleBinary y)
{
return GreaterThanOrEqual (x, y);
}
public static OracleBoolean operator != (OracleBinary x, OracleBinary y)
{
return NotEquals (x, y);
}
public static OracleBoolean operator < (OracleBinary x, OracleBinary y)
{
return LessThan (x, y);
}
public static OracleBoolean operator <= (OracleBinary x, OracleBinary y)
{
return LessThan (x, y);
}
public static explicit operator byte[] (OracleBinary x)
{
return x.Value;
}
public static implicit operator OracleBinary (byte[] b)
{
return new OracleBinary (b);
}
#endregion // Operators and Type Conversions
}
}

View File

@ -0,0 +1,223 @@
//
// OracleBoolean.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
//
// Author: Tim Coleman <tim@timcoleman.com>
//
// Copyright (C) Tim Coleman, 2003
//
// Licensed under the MIT/X11 License.
//
using System;
using System.Data.SqlTypes;
namespace System.Data.OracleClient {
public struct OracleBoolean : IComparable
{
#region Fields
public static readonly OracleBoolean False = new OracleBoolean (false);
public static readonly OracleBoolean Null = new OracleBoolean ();
public static readonly OracleBoolean One = new OracleBoolean (1);
public static readonly OracleBoolean True = new OracleBoolean (true);
public static readonly OracleBoolean Zero = new OracleBoolean (0);
bool value;
bool notNull;
#endregion // Fields
#region Constructors
public OracleBoolean (bool value)
{
this.value = value;
notNull = true;
}
public OracleBoolean (int value)
: this (value != 0)
{
}
#endregion // Constructors
#region Properties
public bool IsFalse {
get { return (!IsNull && !value); }
}
public bool IsNull {
get { return !notNull; }
}
public bool IsTrue {
get { return (!IsNull && value); }
}
public bool Value {
get { return IsTrue; }
}
#endregion // Properties
#region Methods
public static OracleBoolean And (OracleBoolean x, OracleBoolean y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value && y.Value);
}
[MonoTODO]
public int CompareTo (object obj)
{
throw new NotImplementedException ();
}
[MonoTODO]
public override bool Equals (object value)
{
throw new NotImplementedException ();
}
public static OracleBoolean Equals (OracleBoolean x, OracleBoolean y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value == y.Value);
}
[MonoTODO]
public override int GetHashCode ()
{
throw new NotImplementedException ();
}
public static OracleBoolean NotEquals (OracleBoolean x, OracleBoolean y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value != y.Value);
}
public static OracleBoolean OnesComplement (OracleBoolean x)
{
if (x.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (!x.Value);
}
public static OracleBoolean Or (OracleBoolean x, OracleBoolean y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value || y.Value);
}
[MonoTODO]
public static OracleBoolean Parse (string s)
{
throw new NotImplementedException ();
}
public override string ToString ()
{
if (IsNull)
return "Null";
if (IsTrue)
return "True";
return "False";
}
public static OracleBoolean Xor (OracleBoolean x, OracleBoolean y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value ^ y.Value);
}
#endregion // Methods
#region Operators and Type Conversions
public static OracleBoolean operator & (OracleBoolean x, OracleBoolean y)
{
return And (x, y);
}
public static OracleBoolean operator | (OracleBoolean x, OracleBoolean y)
{
return Or (x, y);
}
public static OracleBoolean operator == (OracleBoolean x, OracleBoolean y)
{
return Equals (x, y);
}
public static OracleBoolean operator ^ (OracleBoolean x, OracleBoolean y)
{
return Xor (x, y);
}
public static bool operator false (OracleBoolean x)
{
return x.IsFalse;
}
public static OracleBoolean operator != (OracleBoolean x, OracleBoolean y)
{
return NotEquals (x, y);
}
public static OracleBoolean operator ! (OracleBoolean x)
{
return OnesComplement (x);
}
public static OracleBoolean operator ~ (OracleBoolean x)
{
return OnesComplement (x);
}
public static bool operator true (OracleBoolean x)
{
return x.IsTrue;
}
public static explicit operator bool (OracleBoolean x)
{
if (x.IsNull)
throw new NullReferenceException ();
return x.Value;
}
public static explicit operator OracleBoolean (OracleNumber x)
{
return new OracleBoolean ((int) x);
}
public static explicit operator OracleBoolean (string x)
{
return OracleBoolean.Parse (x);
}
public static implicit operator OracleBoolean (bool x)
{
return new OracleBoolean (x);
}
#endregion // Operators and Type Conversions
}
}

View File

@ -0,0 +1,97 @@
//
// System.Data.OracleClient.OracleClientFactory.cs
//
// Author:
// Sureshkumar T (tsureshkumar@novell.com)
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
namespace System.Data.OracleClient
{
using System.Data;
using System.Data.Common;
using System.Security;
using System.Security.Permissions;
public sealed class OracleClientFactory : DbProviderFactory
{
#region Fields
public static readonly OracleClientFactory Instance = new OracleClientFactory();
#endregion //Fields
#region Constructors
private OracleClientFactory () {
}
#endregion //Constructors
[MonoTODO]
public override bool CanCreateDataSourceEnumerator {
get { throw new NotImplementedException (); }
}
#region public overrides
public override DbCommand CreateCommand () {
return new OracleCommand ();
}
public override DbCommandBuilder CreateCommandBuilder () {
return new OracleCommandBuilder ();
}
public override DbConnection CreateConnection () {
return new OracleConnection ();
}
public override DbConnectionStringBuilder CreateConnectionStringBuilder () {
return new OracleConnectionStringBuilder ();
}
#if !TARGET_JVM
public override CodeAccessPermission CreatePermission (PermissionState state) {
return new OraclePermission (state);
}
#endif
public override DbDataAdapter CreateDataAdapter () {
return new OracleDataAdapter ();
}
public override DbDataSourceEnumerator CreateDataSourceEnumerator () {
// Note: there is no OracleDataSourceEnumerator.
// .net 2.0 returns a null here instead of an exception
return null;
}
public override DbParameter CreateParameter () {
return new OracleParameter ();
}
#endregion // public overrides
}
}
#endif // NET_2_0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,113 @@
//
// OracleConnectionPool.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:
// Hubert FONGARNAND <informatique.internet@fiducial.fr>
//
// (C) Copyright 2005 Hubert FONGARNAND
//
//
// Licensed under the MIT/X11 License.
//
using System;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Data.OracleClient.Oci;
using System.Drawing.Design;
using System.EnterpriseServices;
using System.Text;
using System.Threading;
namespace System.Data.OracleClient
{
internal class OracleConnectionPool
{
ArrayList list = new ArrayList (); // list of connections
OracleConnectionInfo info;
OracleConnectionPoolManager manager;
bool initialized;
int activeConnections = 0;
int PoolMinSize;
int PoolMaxSize;
public OracleConnectionPool (OracleConnectionPoolManager manager, OracleConnectionInfo info, int minPoolSize, int maxPoolSize)
{
this.info = info;
this.manager = manager;
initialized = false;
PoolMinSize = minPoolSize;
PoolMaxSize = maxPoolSize;
}
public OciGlue GetConnection ()
{
OciGlue connection = null;
lock (list) {
if (!initialized) {
for (int n = 0; n < PoolMinSize; n++)
list.Add (CreateConnection ());
initialized = true;
}
do {
if (list.Count > 0) {
// There are available connections in the pool
connection = (OciGlue)list [list.Count - 1];
list.RemoveAt (list.Count -1);
if (!connection.Connected){
connection = null;
continue;
}
}
if (connection == null && activeConnections < PoolMaxSize) {
connection = CreateConnection ();
}
// Pas de connection disponible on attends que quelqu'un en libere une
if (connection == null) {
if (Monitor.Wait (list, 6000) == false)
throw new InvalidOperationException ("Timeout expired. The timeout expired waiting for a connection in the pool probably due to max connections reached.");
}
} while (connection == null);
}
return connection;
}
public void ReleaseConnection (OciGlue connection)
{
lock (list) {
list.Add (connection);
Monitor.Pulse (list);
}
}
OciGlue CreateConnection ()
{
activeConnections++;
return manager.CreateConnection (info);
}
public void Dispose ()
{
if (list != null) {
if (list.Count > 0)
foreach (OciGlue connection in list)
if (connection.Connected)
connection.Disconnect ();
list.Clear ();
list = null;
}
}
}
}

View File

@ -0,0 +1,77 @@
//
// OracleConnectionPoolManager.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:
// Hubert FONGARNAND <informatique.internet@fiducial.fr>
//
// (C) Copyright Hubert FONGARNAND, 2005
//
//
// Licensed under the MIT/X11 License.
//
using System;
using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Data.OracleClient.Oci;
using System.Drawing.Design;
using System.EnterpriseServices;
using System.Text;
using System.Threading;
namespace System.Data.OracleClient
{
internal class OracleConnectionPoolManager
{
Hashtable pools = new Hashtable();
public OracleConnectionPoolManager ()
{
}
public OracleConnectionPool GetConnectionPool (OracleConnectionInfo info, int minPoolSize, int maxPoolSize)
{
lock (pools) {
OracleConnectionPool pool = (OracleConnectionPool) pools [info.ConnectionString];
if (pool == null) {
pool = new OracleConnectionPool (this, info, minPoolSize, maxPoolSize);
pools [info.ConnectionString] = pool;
}
return pool;
}
}
public virtual OciGlue CreateConnection (OracleConnectionInfo info)
{
OciGlue oci;
oci = new OciGlue ();
oci.CreateConnection (info);
return oci;
}
public void Dispose ()
{
if (pools != null) {
foreach (OracleConnectionPool pool in pools)
pool.Dispose ();
pools.Clear ();
pools = null;
}
}
~OracleConnectionPoolManager ()
{
Dispose ();
}
}
}

View File

@ -0,0 +1,188 @@
//
// OracleDataAdapter.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
//
// Author: Tim Coleman <tim@timcoleman.com>
//
// Parts transferred from System.Data.SqlClient/SqlDataAdapter.cs
// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
// Daniel Morgan (danmorg@sc.rr.com)
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2003
// (C) Ximian, Inc 2002
//
// Licensed under the MIT/X11 License.
//
using System;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Drawing.Design;
namespace System.Data.OracleClient
{
[DefaultEvent ("RowUpdated")]
[Designer ("Microsoft.VSDesigner.Data.VS.OracleDataAdapterDesigner, " + Consts.AssemblyMicrosoft_VSDesigner)]
[ToolboxItem ("Microsoft.VSDesigner.Data.VS.OracleDataAdapterToolboxItem, " + Consts.AssemblyMicrosoft_VSDesigner)]
public sealed class OracleDataAdapter : DbDataAdapter, IDbDataAdapter
{
#region Fields
OracleCommand deleteCommand;
OracleCommand insertCommand;
OracleCommand selectCommand;
OracleCommand updateCommand;
#if NET_2_0
int updateBatchSize;
#endif
#endregion
#region Constructors
public OracleDataAdapter () : this ((OracleCommand) null)
{
}
public OracleDataAdapter (OracleCommand selectCommand)
{
SelectCommand = selectCommand;
#if NET_2_0
UpdateBatchSize = 1;
#endif
}
public OracleDataAdapter (string selectCommandText, OracleConnection selectConnection)
: this (new OracleCommand (selectCommandText, selectConnection))
{
}
public OracleDataAdapter (string selectCommandText, string selectConnectionString)
: this (selectCommandText, new OracleConnection (selectConnectionString))
{
}
#endregion
#region Properties
[DefaultValue (null)]
[Editor ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, " + Consts.AssemblyMicrosoft_VSDesigner, typeof(UITypeEditor))]
public
#if NET_2_0
new
#endif
OracleCommand DeleteCommand {
get { return deleteCommand; }
set { deleteCommand = value; }
}
[DefaultValue (null)]
[Editor ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, " + Consts.AssemblyMicrosoft_VSDesigner, typeof(UITypeEditor))]
public
#if NET_2_0
new
#endif
OracleCommand InsertCommand {
get { return insertCommand; }
set { insertCommand = value; }
}
[DefaultValue (null)]
[Editor ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, " + Consts.AssemblyMicrosoft_VSDesigner, typeof(UITypeEditor))]
public
#if NET_2_0
new
#endif
OracleCommand SelectCommand {
get { return selectCommand; }
set { selectCommand = value; }
}
[DefaultValue (null)]
[Editor ("Microsoft.VSDesigner.Data.Design.DBCommandEditor, " + Consts.AssemblyMicrosoft_VSDesigner, typeof(UITypeEditor))]
public
#if NET_2_0
new
#endif
OracleCommand UpdateCommand {
get { return updateCommand; }
set { updateCommand = value; }
}
#if NET_2_0
public override int UpdateBatchSize {
get { return updateBatchSize; }
set {
if (value < 0)
throw new ArgumentOutOfRangeException ("UpdateBatchSize");
updateBatchSize = value;
}
}
#endif
IDbCommand IDbDataAdapter.DeleteCommand {
get { return DeleteCommand; }
set { DeleteCommand = (OracleCommand) value; }
}
IDbCommand IDbDataAdapter.InsertCommand {
get { return InsertCommand; }
set { InsertCommand = (OracleCommand) value; }
}
IDbCommand IDbDataAdapter.SelectCommand {
get { return SelectCommand; }
set { SelectCommand = (OracleCommand) value; }
}
IDbCommand IDbDataAdapter.UpdateCommand {
get { return UpdateCommand; }
set { UpdateCommand = (OracleCommand) value; }
}
#endregion // Properties
#region Methods
protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
{
return new OracleRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
}
protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
{
return new OracleRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
}
protected override void OnRowUpdated (RowUpdatedEventArgs value)
{
if (RowUpdated != null)
RowUpdated (this, (OracleRowUpdatedEventArgs) value);
}
protected override void OnRowUpdating (RowUpdatingEventArgs value)
{
if (RowUpdating != null)
RowUpdating (this, (OracleRowUpdatingEventArgs) value);
}
#endregion // Methods
#region Events and Delegates
public event OracleRowUpdatedEventHandler RowUpdated;
public event OracleRowUpdatingEventHandler RowUpdating;
#endregion // Events and Delegates
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,474 @@
//
// OracleDateTime.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>
// Daniel Morgan <danielmorgan@verizon.net>
//
// Copyright (C) Tim Coleman, 2003
// Copyright (C) Daniel Morgan, 2005
//
// Licensed under the MIT/X11 License.
//
using System;
using System.Data.SqlTypes;
using System.Globalization;
using System.Text;
namespace System.Data.OracleClient {
public struct OracleDateTime : IComparable, INullable
{
#region Fields
public static readonly OracleDateTime MaxValue = new OracleDateTime (4712, 12, 31);
public static readonly OracleDateTime MinValue = new OracleDateTime (1, 1, 1);
public static readonly OracleDateTime Null = new OracleDateTime ();
DateTime value;
bool notNull;
#endregion // Fields
#region Constructors
public OracleDateTime (DateTime dt)
{
value = dt;
notNull = true;
}
public OracleDateTime (long ticks)
: this (new DateTime (ticks))
{
}
public OracleDateTime (OracleDateTime from)
: this (from.Value)
{
}
public OracleDateTime (int year, int month, int day)
: this (new DateTime (year, month, day))
{
}
public OracleDateTime (int year, int month, int day, Calendar calendar)
: this (new DateTime (year, month, day, calendar))
{
}
public OracleDateTime (int year, int month, int day, int hour, int minute, int second)
: this (new DateTime (year, month, day, hour, minute, second))
{
}
public OracleDateTime (int year, int month, int day, int hour, int minute, int second, Calendar calendar)
: this (new DateTime (year, month, day, hour, minute, second, calendar))
{
}
public OracleDateTime (int year, int month, int day, int hour, int minute, int second, int millisecond)
: this (new DateTime (year, month, day, hour, minute, second, millisecond))
{
}
public OracleDateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar)
: this (new DateTime (year, month, day, hour, minute, second, millisecond, calendar))
{
}
#endregion // Constructors
#region Properties
public int Day {
get { return value.Day; }
}
public int Hour {
get { return value.Hour; }
}
public bool IsNull {
get { return !notNull; }
}
public int Millisecond {
get { return value.Millisecond; }
}
public int Minute {
get { return value.Minute; }
}
public int Month {
get { return value.Month; }
}
public int Second {
get { return value.Second; }
}
public DateTime Value {
get { return value; }
}
public int Year {
get { return value.Year; }
}
#endregion // Properties
#region Methods
public int CompareTo (object obj)
{
OracleDateTime o = (OracleDateTime) obj;
if (obj == null)
throw new NullReferenceException ("Object reference not set to an instance of an object");
else if (!(obj is OracleDateTime))
throw new ArgumentException ("Value is not a System.Data.OracleClient.OracleDateTime", obj.ToString ());
else if (o.IsNull && this.IsNull)
return 0;
else if (o.IsNull && !(this.IsNull))
return 1;
else
return value.CompareTo (o.Value);
}
public override bool Equals (object value)
{
if (value is OracleDateTime)
{
OracleDateTime d = (OracleDateTime) value;
if (!(this.IsNull) && !(d.IsNull))
return this.value == d.value;
else
throw new InvalidOperationException ("The value is null");
}
return false;
}
public static OracleBoolean Equals (OracleDateTime x, OracleDateTime y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value == y.Value);
}
[MonoTODO]
public override int GetHashCode ()
{
throw new NotImplementedException ();
}
public static OracleBoolean GreaterThan (OracleDateTime x, OracleDateTime y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value > y.Value);
}
public static OracleBoolean GreaterThanOrEqual (OracleDateTime x, OracleDateTime y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value >= y.Value);
}
public static OracleBoolean LessThan (OracleDateTime x, OracleDateTime y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value < y.Value);
}
public static OracleBoolean LessThanOrEqual (OracleDateTime x, OracleDateTime y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value <= y.Value);
}
public static OracleBoolean NotEquals (OracleDateTime x, OracleDateTime y)
{
if (x.IsNull || y.IsNull)
return OracleBoolean.Null;
return new OracleBoolean (x.Value != y.Value);
}
public static OracleDateTime Parse (string s)
{
return new OracleDateTime (DateTime.Parse (s));
}
public override string ToString ()
{
if (IsNull)
return "Null";
return Value.ToString ();
}
#endregion // Methods
#region Operators and Type Conversions
public static OracleBoolean operator == (OracleDateTime x, OracleDateTime y)
{
return Equals (x, y);
}
public static OracleBoolean operator > (OracleDateTime x, OracleDateTime y)
{
return GreaterThan (x, y);
}
public static OracleBoolean operator >= (OracleDateTime x, OracleDateTime y)
{
return GreaterThanOrEqual (x, y);
}
public static OracleBoolean operator != (OracleDateTime x, OracleDateTime y)
{
return NotEquals (x, y);
}
public static OracleBoolean operator < (OracleDateTime x, OracleDateTime y)
{
return LessThan (x, y);
}
public static OracleBoolean operator <= (OracleDateTime x, OracleDateTime y)
{
return LessThanOrEqual (x, y);
}
public static explicit operator DateTime (OracleDateTime x)
{
return x.Value;
}
public static explicit operator OracleDateTime (string x)
{
return new OracleDateTime (DateTime.Parse (x));
}
private static string ConvertSystemDatePartToOracleDate (string sysPart)
{
if (sysPart.Length == 0)
return "";
else {
switch (sysPart) {
case "tt":
return "AM";
case "yy":
return "YY";
case "yyyy":
return "YYYY";
case "MM":
return "MM";
case "MON":
return "MMM";
case "MMMM":
return "MONTH";
case "dd":
return "DD";
case "ddd":
return "DY";
case "dddd":
return "DAY";
case "hh":
return "HH";
case "HH":
return "HH24";
case "mm":
return "MI";
case "ss":
return "SS";
default:
// ignore any others?
return "";
}
}
}
private static string ConvertOracleDatePartToSystemDatePart (string oraPart)
{
if (oraPart.Length == 0)
return "";
else {
switch (oraPart) {
case "AM":
case "PM":
// TODO: need to handle "A.M." and "P.M."
return "tt";
case "RR": // TODO: handle special year RR. for now, treat it like yy
return "yy";
case "YY":
return "yy";
case "YYYY":
return "yyyy";
case "MM":
return "MM";
case "MON":
return "MMM";
case "MONTH":
return "MMMM";
case "DD":
return "dd";
case "DY":
return "ddd";
case "DAY":
return "dddd";
case "HH":
case "HH12":
return "hh";
case "HH24":
return "HH";
case "MI":
return "mm";
case "SS":
return "ss";
default:
// ignore any others?
return "";
}
}
}
internal static string ConvertSystemDateTimeFormatToOracleDate (string sysFormat)
{
if (sysFormat == String.Empty)
return String.Empty;
char[] chars = sysFormat.ToCharArray ();
StringBuilder sb = new StringBuilder ();
StringBuilder sfinal = new StringBuilder ();
int i = 0;
bool inQuote = false;
char quoteChar = '\"';
string sPart;
for (i = 0; i < chars.Length; i++) {
char ch = chars[i];
if (inQuote == true) {
sfinal.Append (ch);
if (ch == quoteChar)
inQuote = false;
}
else {
switch (ch) {
case ' ':
case '.':
case ',':
case '/':
case '-':
case ':':
if (sb.Length > 0) {
sPart = ConvertSystemDatePartToOracleDate (sb.ToString ());
if (sPart.Length > 0)
sfinal.Append (sPart);
}
sb = null;
sb = new StringBuilder ();
sfinal.Append (ch);
break;
case '\"':
sfinal.Append (ch);
inQuote = true;
quoteChar = '\"';
break;
default:
sb.Append (ch);
break;
}
}
}
if (sb.Length > 0) {
sPart = ConvertSystemDatePartToOracleDate (sb.ToString ());
if (sPart.Length > 0)
sfinal.Append (sPart);
sb = null;
}
string returnStr = sfinal.ToString ();
sfinal = null;
return returnStr;
}
internal static string ConvertOracleDateFormatToSystemDateTime (string oraFormat)
{
if (oraFormat == String.Empty)
return String.Empty;
char[] chars = oraFormat.ToCharArray ();
StringBuilder sb = new StringBuilder ();
StringBuilder sfinal = new StringBuilder ();
int i = 0;
bool inQuote = false;
char quoteChar = '\"';
string sPart;
for (i = 0; i < chars.Length; i++) {
char ch = chars[i];
if (inQuote == true) {
sfinal.Append (ch);
if (ch == quoteChar)
inQuote = false;
}
else {
switch (ch) {
case ' ':
case '.':
case ',':
case '/':
case '-':
case ':':
if (sb.Length > 0) {
sPart = ConvertOracleDatePartToSystemDatePart (sb.ToString ());
if (sPart.Length > 0)
sfinal.Append (sPart);
}
sb = null;
sb = new StringBuilder ();
sfinal.Append (ch);
break;
case '\"':
sfinal.Append (ch);
inQuote = true;
quoteChar = '\"';
break;
default:
sb.Append (ch);
break;
}
}
}
if (sb.Length > 0) {
sPart = ConvertOracleDatePartToSystemDatePart (sb.ToString ());
if (sPart.Length > 0)
sfinal.Append (sPart);
sb = null;
}
string returnStr = sfinal.ToString ();
sfinal = null;
return returnStr;
}
#endregion // Operators and Type Conversions
}
}

View File

@ -0,0 +1,46 @@
//
// OracleException.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>
//
// Copyright (C) Daniel Morgan, 2002
// Copyright (C) Tim Coleman , 2003
//
// Licensed under the MIT/X11 License.
//
using System;
using System.Runtime.Serialization;
namespace System.Data.OracleClient {
[Serializable]
public sealed class OracleException : System.Data.Common.DbException
{
int code;
internal OracleException (int code, string message) : base (message)
{
this.code = code;
}
private OracleException (SerializationInfo si, StreamingContext sc) : base(si, sc)
{
code = si.GetInt32 ("code");
}
public int Code {
get { return code; }
}
public override void GetObjectData (SerializationInfo si, StreamingContext context)
{
si.AddValue ("code", code, typeof(int));
base.GetObjectData (si, context);
}
}
}

View File

@ -0,0 +1,69 @@
//
// OracleInfoMessageEventArgs.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
//
// Author: Tim Coleman <tim@timcoleman.com>
//
// Copyright (C) Tim Coleman, 2003
//
// Licensed under the MIT/X11 License.
//
using System;
using System.IO;
using System.Data.SqlTypes;
using System.Data.OracleClient.Oci;
namespace System.Data.OracleClient
{
public sealed class OracleInfoMessageEventArgs : EventArgs
{
#region Fields
int code;
string message;
#endregion // Fields
#region Constructors
internal OracleInfoMessageEventArgs (OciErrorInfo info)
{
code = info.ErrorCode;
message = info.ErrorMessage;
}
#endregion // Constructors
#region Properties
public int Code {
get { return code; }
}
public string Message {
get { return message; }
}
public string Source {
[MonoTODO]
get { throw new NotImplementedException (); }
}
#endregion // Properties
#region Methods
public override string ToString ()
{
return Message;
}
#endregion // Methods
}
}

View File

@ -0,0 +1,26 @@
//
// OracleInfoMessageEventHandler.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
//
// Author: Tim Coleman <tim@timcoleman.com>
//
// Copyright (C) Tim Coleman, 2003
//
// Licensed under the MIT/X11 License.
//
using System;
using System.IO;
using System.Data.SqlTypes;
namespace System.Data.OracleClient {
#if !NET_2_0
[Serializable]
#endif
public delegate void OracleInfoMessageEventHandler (object sender, OracleInfoMessageEventArgs e);
}

View File

@ -0,0 +1,403 @@
//
// OracleLob.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
//
// Author: Tim Coleman <tim@timcoleman.com>
//
// Copyright (C) Tim Coleman, 2003
//
// Licensed under the MIT/X11 License.
//
using System;
using System.Data.OracleClient.Oci;
using System.Data.SqlTypes;
using System.IO;
using System.Text;
namespace System.Data.OracleClient
{
public sealed class OracleLob : Stream, ICloneable, IDisposable, INullable
{
#region Fields
public static readonly new OracleLob Null = new OracleLob ();
internal OracleConnection connection;
bool isBatched;
bool isOpen = true;
bool notNull;
OciLobLocator locator;
OracleType type;
long length = -1;
long position;
#endregion // Fields
#region Constructors
internal OracleLob ()
{
}
internal OracleLob (OciLobLocator locator, OciDataType ociType)
{
notNull = true;
this.locator = locator;
switch (ociType) {
case OciDataType.Blob:
type = OracleType.Blob;
break;
case OciDataType.Clob:
type = OracleType.Clob;
break;
}
}
#endregion // Constructors
#region Properties
public override bool CanRead {
get { return (IsNull || isOpen); }
}
public override bool CanSeek {
get { return (IsNull || isOpen); }
}
public override bool CanWrite {
get { return isOpen; }
}
public int ChunkSize {
[MonoTODO]
get {
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
return locator.GetChunkSize ();
}
}
public OracleConnection Connection {
get { return connection; }
}
public bool IsBatched {
get { return isBatched; }
}
public bool IsNull {
get { return !notNull; }
}
public bool IsTemporary {
get {
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
throw new NotImplementedException ();
}
}
public override long Length {
get {
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
if (length >= 0)
return length;
return locator.GetLength (LobType == OracleType.Blob);
}
}
public OracleType LobType {
get { return type; }
}
internal OciLobLocator Locator {
get { return locator; }
}
public override long Position {
get {
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
return position;
}
set {
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
position = value;
}
}
public object Value {
get {
AssertObjectNotDisposed ();
if (IsNull)
return DBNull.Value;
byte[] buffer = null;
int len = (int) Length;
if (len == 0) {
// LOB is not Null, but it is Empty
if (LobType == OracleType.Clob)
return string.Empty;
else // OracleType.Blob
return new byte[0];
}
if (LobType == OracleType.Clob) {
buffer = new byte [len];
Read (buffer, 0, len);
UnicodeEncoding encoding = new UnicodeEncoding ();
return encoding.GetString (buffer);
} else {
// OracleType.Blob
buffer = new byte [len];
Read (buffer, 0, len);
return buffer;
}
}
}
#endregion // Properties
#region Methods
[MonoTODO]
public void Append (OracleLob source)
{
if (source.IsNull)
throw new ArgumentNullException ();
if (Connection.State == ConnectionState.Closed)
throw new InvalidOperationException ();
throw new NotImplementedException ();
}
void AssertAmountIsEven (long amount, string argName)
{
if (amount % 2 == 1)
throw new ArgumentOutOfRangeException ("CLOB and NCLOB parameters require even number of bytes for this argument.");
}
void AssertAmountIsValid (long amount, string argName)
{
if (amount > UInt32.MaxValue)
throw new ArgumentOutOfRangeException ("Argument too big.");
if (LobType == OracleType.Clob || LobType == OracleType.NClob)
AssertAmountIsEven (amount, argName);
}
void AssertConnectionIsOpen ()
{
if (connection.State == ConnectionState.Closed)
throw new InvalidOperationException ("Invalid operation. The connection is closed.");
}
void AssertObjectNotDisposed ()
{
if (!isOpen)
throw new ObjectDisposedException ("OracleLob");
}
void AssertTransactionExists ()
{
if (connection.Transaction == null)
throw new InvalidOperationException ("Modifying a LOB requires that the connection be transacted.");
}
public void BeginBatch ()
{
BeginBatch (OracleLobOpenMode.ReadOnly);
}
public void BeginBatch (OracleLobOpenMode mode)
{
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
locator.BeginBatch (mode);
isBatched = true;
}
[MonoTODO]
public object Clone ()
{
throw new NotImplementedException ();
}
#if !NET_2_0
[MonoTODO]
public override void Close ()
{
Dispose (true);
}
[MonoTODO]
public void Dispose ()
{
this.Dispose (true);
GC.SuppressFinalize (this);
}
#endif
#if NET_2_0
protected override
#endif
void Dispose (bool disposing)
{
if (disposing) {
if (locator != null)
locator.Dispose ();
}
locator = null;
isOpen = false;
}
public long CopyTo (OracleLob destination)
{
return CopyTo (0, destination, 0, Length);
}
public long CopyTo (OracleLob destination, long destinationOffset)
{
return CopyTo (0, destination, destinationOffset, Length);
}
public long CopyTo (long sourceOffset, OracleLob destination, long destinationOffset, long amount)
{
if (destination.IsNull)
throw new ArgumentNullException ();
AssertAmountIsValid (sourceOffset, "sourceOffset");
AssertAmountIsValid (destinationOffset, "destinationOffset");
AssertAmountIsValid (amount, "amount");
AssertTransactionExists ();
AssertConnectionIsOpen ();
return (long) locator.Copy (destination.Locator, (uint) amount, (uint) destinationOffset + 1, (uint) sourceOffset + 1);
}
public void EndBatch ()
{
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
locator.EndBatch ();
isBatched = false;
}
public long Erase ()
{
return Erase (0, Length);
}
public long Erase (long offset, long amount)
{
if (offset < 0 || amount < 0)
throw new ArgumentOutOfRangeException ("Must be a positive value.");
if (offset + amount > Length)
throw new ArgumentOutOfRangeException ();
AssertAmountIsValid (offset, "offset");
AssertAmountIsValid (amount, "amount");
return (long) locator.Erase ((uint) offset + 1, (uint) amount);
}
public override void Flush ()
{
// No-op
}
public override int Read (byte[] buffer, int offset, int count)
{
if (buffer == null)
throw new ArgumentNullException ();
AssertAmountIsValid (offset, "offset");
AssertAmountIsValid (count, "count");
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
int bytesRead;
byte[] output = new byte [count];
position = offset;
bytesRead = locator.Read (output, (uint) Position + 1, (uint) count, LobType == OracleType.Blob);
output.CopyTo (buffer, offset);
position += bytesRead;
return bytesRead;
}
[MonoTODO]
public override long Seek (long offset, SeekOrigin origin)
{
long newPosition = position;
switch (origin) {
case SeekOrigin.Begin:
newPosition = offset;
break;
case SeekOrigin.Current:
newPosition += offset;
break;
case SeekOrigin.End:
newPosition = Length + offset;
break;
}
if (newPosition > Length)
throw new ArgumentOutOfRangeException ();
position = newPosition;
return position;
}
[MonoTODO]
public override void SetLength (long value)
{
AssertAmountIsValid (value, "value");
AssertTransactionExists ();
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
locator.Trim ((uint) value);
length = value;
}
public override void Write (byte[] buffer, int offset, int count)
{
if (buffer == null)
throw new ArgumentNullException ("Buffer is null.");
if (offset < 0 || count < 0)
throw new ArgumentOutOfRangeException ("Must be a positive value.");
if (offset + count > buffer.Length)
throw new ArgumentOutOfRangeException ("The offset and count values specified exceed the buffer provided.");
AssertAmountIsValid (offset, "offset");
AssertAmountIsValid (count, "count");
AssertTransactionExists ();
AssertConnectionIsOpen ();
AssertObjectNotDisposed ();
byte[] value = null;
if (offset + count == buffer.Length && offset == 0)
value = buffer;
else {
value = new byte[count];
Array.Copy (buffer, offset, value, 0, count);
}
position += locator.Write (value, (uint) Position + 1, (uint) value.Length, LobType);
}
#endregion // Methods
}
}

View File

@ -0,0 +1,28 @@
//
// OracleLobOpenMode.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
//
// Author: Tim Coleman <tim@timcoleman.com>
//
// Copyright (C) Tim Coleman, 2003
//
// Licensed under the MIT/X11 License.
//
using System;
namespace System.Data.OracleClient {
#if !NET_2_0
[Serializable]
#endif
public enum OracleLobOpenMode
{
ReadOnly = 0x01,
ReadWrite = 0x02
}
}

Some files were not shown because too many files have changed in this diff Show More