You've already forked linux-packaging-mono
Imported Upstream version 3.10.0
Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
@@ -32,11 +32,9 @@ using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: ComVisible (false)]
|
||||
|
||||
#if !TARGET_JVM
|
||||
[assembly: CLSCompliant (true)]
|
||||
[assembly: AssemblyDelaySign (true)]
|
||||
[assembly: AssemblyKeyFile ("../ecma.pub")]
|
||||
#endif
|
||||
|
||||
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
|
||||
[assembly: AllowPartiallyTrustedCallers]
|
||||
|
@@ -1,205 +0,0 @@
|
||||
//
|
||||
// Mainsoft.Data.Jdbc.Providers.OracleProvider
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
// Boris Kirzner <borisk@mainsoft.com>
|
||||
//
|
||||
// (C) 2006 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Mainsoft.Data.Configuration;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Mainsoft.Data.Jdbc.Providers
|
||||
{
|
||||
public class OracleProvider : GenericProvider
|
||||
{
|
||||
#region Consts
|
||||
|
||||
private const string Port = "Port";
|
||||
|
||||
#endregion //Consts
|
||||
|
||||
#region Fields
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
public OracleProvider (IDictionary providerInfo) : base (providerInfo)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
public override IConnectionStringDictionary GetConnectionStringBuilder (string connectionString)
|
||||
{
|
||||
IConnectionStringDictionary conectionStringBuilder = base.GetConnectionStringBuilder (connectionString);
|
||||
|
||||
string port = (string) conectionStringBuilder [Port];
|
||||
if (port == null || port.Length == 0) {
|
||||
port = (string) ProviderInfo [Port];
|
||||
conectionStringBuilder.Add (Port, port);
|
||||
}
|
||||
|
||||
return conectionStringBuilder;
|
||||
}
|
||||
|
||||
public override java.sql.Connection GetConnection(IConnectionStringDictionary conectionStringBuilder) {
|
||||
return new OracleConnection(base.GetConnection (conectionStringBuilder));
|
||||
}
|
||||
|
||||
|
||||
#endregion //Methods
|
||||
|
||||
#region OracleConnection
|
||||
|
||||
sealed class OracleConnection : Connection {
|
||||
|
||||
public OracleConnection(java.sql.Connection connection)
|
||||
: base(connection) {}
|
||||
|
||||
public override java.sql.CallableStatement prepareCall(string arg_0) {
|
||||
return base.prepareCall (arg_0);
|
||||
}
|
||||
|
||||
public override java.sql.CallableStatement prepareCall(string arg_0, int arg_1, int arg_2) {
|
||||
return new OracleCallableStatement(base.prepareCall (arg_0, arg_1, arg_2));
|
||||
}
|
||||
|
||||
public override java.sql.CallableStatement prepareCall(string arg_0, int arg_1, int arg_2, int arg_3) {
|
||||
return new OracleCallableStatement(base.prepareCall (arg_0, arg_1, arg_2, arg_3));
|
||||
}
|
||||
|
||||
public override java.sql.PreparedStatement prepareStatement(string arg_0) {
|
||||
return new OraclePreparedStatement(base.prepareStatement (arg_0));
|
||||
}
|
||||
|
||||
public override java.sql.PreparedStatement prepareStatement(string arg_0, int arg_1) {
|
||||
return new OraclePreparedStatement(base.prepareStatement (arg_0, arg_1));
|
||||
}
|
||||
|
||||
public override java.sql.PreparedStatement prepareStatement(string arg_0, int arg_1, int arg_2) {
|
||||
return new OraclePreparedStatement(base.prepareStatement (arg_0, arg_1, arg_2));
|
||||
}
|
||||
|
||||
public override java.sql.PreparedStatement prepareStatement(string arg_0, int arg_1, int arg_2, int arg_3) {
|
||||
return new OraclePreparedStatement(base.prepareStatement (arg_0, arg_1, arg_2, arg_3));
|
||||
}
|
||||
|
||||
public override java.sql.PreparedStatement prepareStatement(string arg_0, int[] arg_1) {
|
||||
return new OraclePreparedStatement(base.prepareStatement (arg_0, arg_1));
|
||||
}
|
||||
|
||||
public override java.sql.PreparedStatement prepareStatement(string arg_0, string[] arg_1) {
|
||||
return new OraclePreparedStatement(base.prepareStatement (arg_0, arg_1));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
sealed class OraclePreparedStatement : PreparedStatement, IPreparedStatement {
|
||||
readonly MethodInfo _info;
|
||||
|
||||
public OraclePreparedStatement(java.sql.PreparedStatement statement)
|
||||
: base(statement) {
|
||||
_info = Wrapped.GetType().GetMethod("setFixedCHAR");
|
||||
}
|
||||
|
||||
#region IPreparedStatement Members
|
||||
|
||||
public void setBit(int parameterIndex, int value) {
|
||||
base.setInt(parameterIndex, value);
|
||||
}
|
||||
|
||||
public void setChar(int parameterIndex, string value) {
|
||||
if (_info == null) {
|
||||
base.setString(parameterIndex, value);
|
||||
return;
|
||||
}
|
||||
|
||||
_info.Invoke(Wrapped, new object[] {
|
||||
new java.lang.Integer(parameterIndex),
|
||||
value});
|
||||
}
|
||||
|
||||
public void setNumeric(int parameterIndex, java.math.BigDecimal value) {
|
||||
base.setBigDecimal(parameterIndex, value);
|
||||
}
|
||||
|
||||
public void setReal(int parameterIndex, double value) {
|
||||
base.setDouble(parameterIndex, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
sealed class OracleCallableStatement : CallableStatement, IPreparedStatement {
|
||||
readonly MethodInfo _info;
|
||||
|
||||
public OracleCallableStatement(java.sql.CallableStatement statement)
|
||||
: base(statement) {
|
||||
_info = Wrapped.GetType().GetMethod("setFixedCHAR");
|
||||
}
|
||||
|
||||
#region IPreparedStatement Members
|
||||
|
||||
public void setBit(int parameterIndex, int value) {
|
||||
base.setInt(parameterIndex, value);
|
||||
}
|
||||
|
||||
public void setChar(int parameterIndex, string value) {
|
||||
if (_info == null) {
|
||||
base.setString(parameterIndex, value);
|
||||
return;
|
||||
}
|
||||
|
||||
_info.Invoke(Wrapped, new object[] {
|
||||
new java.lang.Integer(parameterIndex),
|
||||
value});
|
||||
}
|
||||
|
||||
public void setNumeric(int parameterIndex, java.math.BigDecimal value) {
|
||||
base.setBigDecimal(parameterIndex, value);
|
||||
}
|
||||
|
||||
public void setReal(int parameterIndex, double value) {
|
||||
base.setDouble(parameterIndex, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -3,23 +3,10 @@ SUBDIRS =
|
||||
include ../../build/rules.make
|
||||
|
||||
LIBRARY = System.Data.OracleClient.dll
|
||||
ifeq (net_1_1_java, $(PROFILE))
|
||||
LIB_MCS_FLAGS = \
|
||||
-r:rt.dll \
|
||||
-r:J2SE.Helpers.dll \
|
||||
/r:System.dll \
|
||||
/r:System.Xml.dll /r:../../class/lib/net_1_1_java/System.Data.dll \
|
||||
-nowarn:649 -nowarn:169 -nowarn:219 -nowarn:168 -nowarn:1595 \
|
||||
-r:$(corlib) \
|
||||
-r:System.Xml.dll \
|
||||
/r:System.Drawing.dll
|
||||
|
||||
else
|
||||
LIB_MCS_FLAGS = /r:$(corlib) /r:System.dll \
|
||||
/r:System.Xml.dll /r:System.Data.dll \
|
||||
/r:System.EnterpriseServices.dll \
|
||||
/r:System.Drawing.dll
|
||||
endif
|
||||
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) /nowarn:618
|
||||
|
||||
|
@@ -1,20 +0,0 @@
|
||||
2006-04-26 Konstantin Triger <kostat@mainsoft.com>
|
||||
|
||||
* OracleParameter.cs: map NCHAR to VARCHAR type.
|
||||
|
||||
2006-03-05 Konstantin Triger <kostat@mainsoft.com>
|
||||
|
||||
* OracleDataReader.cs, OracleConvert.cs: correct handling of Oracle specific types.
|
||||
|
||||
2006-02-26 Konstantin Triger <kostat@mainsoft.com>
|
||||
|
||||
* OracleDataReader.cs: Added GetOracleXXX stubs.
|
||||
* OracleCommand.cs: Added ExecuteOracleXXX stubs.
|
||||
|
||||
2006-02-26 Konstantin Triger <kostat@mainsoft.com>
|
||||
|
||||
* Regex.cs: Added.
|
||||
|
||||
2006-02-19 Konstantin Triger <kostat@mainsoft.com>
|
||||
|
||||
* OracleConnection.cs: follow JDBC provider generic adapter mechanism.
|
@@ -1,207 +0,0 @@
|
||||
//
|
||||
// System.Data.Common.ExceptionHelper
|
||||
//
|
||||
// Author:
|
||||
// Boris Kirzner (borisk@mainsoft.com)
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace System.Data.OracleClient
|
||||
{
|
||||
sealed class ExceptionHelper
|
||||
{
|
||||
internal static ArgumentException InvalidSizeValue (int value)
|
||||
{
|
||||
string [] args = new string [] {value.ToString ()};
|
||||
return new ArgumentException (GetExceptionMessage ("Invalid parameter Size value '{0}'. The value must be greater than or equal to 0.",args));
|
||||
}
|
||||
|
||||
internal static ArgumentOutOfRangeException InvalidDataRowVersion (DataRowVersion value)
|
||||
{
|
||||
object [] args = new object [] { "DataRowVersion", value.ToString () } ;
|
||||
return new ArgumentOutOfRangeException (GetExceptionMessage ("{0}: Invalid DataRow Version enumeration value: {1}",args));
|
||||
}
|
||||
|
||||
internal static ArgumentOutOfRangeException InvalidParameterDirection (ParameterDirection value)
|
||||
{
|
||||
object [] args = new object [] { "ParameterDirection", value.ToString () } ;
|
||||
return new ArgumentOutOfRangeException (GetExceptionMessage ("Invalid direction '{0}' for '{1}' parameter.",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException NoStoredProcedureExists (string procedureName) {
|
||||
object [] args = new object [1] { procedureName } ;
|
||||
return new InvalidOperationException (GetExceptionMessage ("The stored procedure '{0}' doesn't exist.", args));
|
||||
}
|
||||
|
||||
internal static ArgumentNullException ArgumentNull (string parameter)
|
||||
{
|
||||
return new ArgumentNullException (parameter);
|
||||
}
|
||||
|
||||
internal static InvalidOperationException TransactionRequired ()
|
||||
{
|
||||
return new InvalidOperationException (GetExceptionMessage ("Execute requires the command to have a transaction object when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized."));
|
||||
}
|
||||
|
||||
internal static ArgumentOutOfRangeException InvalidOleDbType (int value)
|
||||
{
|
||||
string [] args = new string [] { value.ToString() };
|
||||
return new ArgumentOutOfRangeException (GetExceptionMessage ("Invalid OleDbType enumeration value: {0}",args));
|
||||
}
|
||||
|
||||
internal static ArgumentException InvalidDbType(int value)
|
||||
{
|
||||
string [] args = new string [] { value.ToString () };
|
||||
return new ArgumentException (GetExceptionMessage ("No mapping exists from DbType {0} to a known {1}.",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException DeriveParametersNotSupported(Type type,CommandType commandType)
|
||||
{
|
||||
string [] args = new string [] { type.ToString(),commandType.ToString() };
|
||||
return new InvalidOperationException (GetExceptionMessage ("{0} DeriveParameters only supports CommandType.StoredProcedure, not CommandType.{1}.",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException ReaderClosed (string mehodName)
|
||||
{
|
||||
string [] args = new string [] { mehodName };
|
||||
return new InvalidOperationException (GetExceptionMessage ("Invalid attempt to {0} when reader is closed.",args));
|
||||
}
|
||||
|
||||
internal static ArgumentOutOfRangeException InvalidSqlDbType (int value)
|
||||
{
|
||||
string [] args = new string [] { value.ToString () };
|
||||
return new ArgumentOutOfRangeException (GetExceptionMessage ("{0}: Invalid SqlDbType enumeration value: {1}.",args));
|
||||
}
|
||||
|
||||
internal static ArgumentException UnknownDataType (string type1, string type2)
|
||||
{
|
||||
string [] args = new string [] { type1, type2 };
|
||||
return new ArgumentException (GetExceptionMessage ("No mapping exists from DbType {0} to a known {1}.",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException TransactionNotInitialized ()
|
||||
{
|
||||
return new InvalidOperationException (GetExceptionMessage ("Execute requires the command to have a transaction object when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized."));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException ParametersNotInitialized (int parameterPosition,string parameterName,string parameterType)
|
||||
{
|
||||
object [] args = new object [] { parameterPosition, parameterName, parameterType };
|
||||
return new InvalidOperationException (GetExceptionMessage ("Parameter {0}: '{1}', the property DbType is uninitialized: OleDbType.{2}.",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException WrongParameterSize(string provider)
|
||||
{
|
||||
string [] args = new string [] { provider };
|
||||
return new InvalidOperationException (GetExceptionMessage ("{0}.Prepare method requires all variable length parameters to have an explicitly set non-zero Size.",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException ConnectionNotOpened (string operationName, string connectionState)
|
||||
{
|
||||
object [] args = new object [] { operationName, connectionState };
|
||||
return new InvalidOperationException (GetExceptionMessage ("{0} requires an open and available Connection. The connection's current state is {1}.",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException ConnectionNotInitialized (string methodName)
|
||||
{
|
||||
object [] args = new object [] { methodName };
|
||||
return new InvalidOperationException (GetExceptionMessage ("{0}: Connection property has not been initialized.",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException OpenConnectionRequired (string methodName, object connectionState)
|
||||
{
|
||||
object [] args = new object [] { methodName, connectionState };
|
||||
return new InvalidOperationException (GetExceptionMessage ("{0} requires an open and available Connection. The connection's current state is {1}.",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException OpenedReaderExists ()
|
||||
{
|
||||
return new InvalidOperationException (GetExceptionMessage ("There is already an open DataReader associated with this Connection which must be closed first."));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException ConnectionAlreadyOpen (object connectionState)
|
||||
{
|
||||
object [] args = new object [] { connectionState };
|
||||
return new InvalidOperationException (GetExceptionMessage ("The connection is already Open (state={0}).",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException ConnectionStringNotInitialized ()
|
||||
{
|
||||
return new InvalidOperationException (GetExceptionMessage ("The ConnectionString property has not been initialized."));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException ConnectionIsBusy (object commandType,object connectionState)
|
||||
{
|
||||
object [] args = new object [] { commandType.ToString (), connectionState.ToString () };
|
||||
return new InvalidOperationException (GetExceptionMessage ("The {0} is currently busy {1}.",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException NotAllowedWhileConnectionOpen (string propertyName, object connectionState)
|
||||
{
|
||||
object [] args = new object [] { propertyName, connectionState };
|
||||
return new InvalidOperationException (GetExceptionMessage ("Not allowed to change the '{0}' property while the connection (state={1}).",args));
|
||||
}
|
||||
|
||||
internal static ArgumentException OleDbNoProviderSpecified ()
|
||||
{
|
||||
return new ArgumentException (GetExceptionMessage ("An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'."));
|
||||
}
|
||||
|
||||
internal static ArgumentException InvalidValueForKey (string key)
|
||||
{
|
||||
string [] args = new string [] { key };
|
||||
return new ArgumentException (String.Format ("Invalid value for key {0}",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException ParameterSizeNotInitialized( int parameterIndex, string parameterName,string parameterType,int parameterSize)
|
||||
{
|
||||
object [] args = new object [] { parameterIndex.ToString (), parameterName, parameterType, parameterSize.ToString () };
|
||||
return new InvalidOperationException (GetExceptionMessage ("Parameter {0}: '{1}' of type: {2}, the property Size has an invalid size: {3}",args));
|
||||
}
|
||||
|
||||
internal static ArgumentException InvalidUpdateStatus (UpdateStatus status)
|
||||
{
|
||||
object [] args = new object [] { status };
|
||||
return new ArgumentException (GetExceptionMessage ("Invalid UpdateStatus: {0}",args));
|
||||
}
|
||||
|
||||
internal static InvalidOperationException UpdateRequiresCommand (string command)
|
||||
{
|
||||
object [] args = new object [] { command };
|
||||
return new InvalidOperationException (GetExceptionMessage ("Auto SQL generation during {0} requires a valid SelectCommand.",args));
|
||||
}
|
||||
|
||||
internal static DataException RowUpdatedError ()
|
||||
{
|
||||
return new DataException (GetExceptionMessage ("RowUpdatedEvent: Errors occurred; no additional is information available."));
|
||||
}
|
||||
|
||||
internal static ArgumentNullException CollectionNoNullsAllowed (object collection, object objectsType)
|
||||
{
|
||||
object [] args = new object [] {collection.GetType ().ToString (), objectsType.ToString ()};
|
||||
return new ArgumentNullException (GetExceptionMessage ("The {0} only accepts non-null {1} type objects."));
|
||||
}
|
||||
|
||||
internal static ArgumentException CollectionAlreadyContains(object objectType,string propertyName, object propertyValue, object collection)
|
||||
{
|
||||
object [] args = new object [] {objectType.ToString (), propertyName, propertyValue, collection.GetType ().ToString ()};
|
||||
return new ArgumentException (GetExceptionMessage ("The {0} with {1} '{2}' is already contained by this {3}.",args));
|
||||
}
|
||||
|
||||
internal static string GetExceptionMessage (string exceptionMessage,object [] args)
|
||||
{
|
||||
if ((args == null) || (args.Length == 0)) {
|
||||
return exceptionMessage;
|
||||
}
|
||||
else {
|
||||
return String.Format (exceptionMessage,args);
|
||||
}
|
||||
}
|
||||
|
||||
internal static string GetExceptionMessage (string exceptionMessage)
|
||||
{
|
||||
return GetExceptionMessage (exceptionMessage,null);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,187 +0,0 @@
|
||||
//
|
||||
// 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, INullable {
|
||||
#region Fields
|
||||
|
||||
public static readonly new OracleBFile Null = new OracleBFile ();
|
||||
|
||||
OracleConnection connection;
|
||||
bool isOpen = true;
|
||||
bool notNull = false;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
internal OracleBFile () {
|
||||
}
|
||||
|
||||
#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 false; }
|
||||
}
|
||||
|
||||
public OracleConnection Connection {
|
||||
get { return connection; }
|
||||
}
|
||||
|
||||
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; }
|
||||
}
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public void Dispose () {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[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
|
||||
}
|
||||
}
|
@@ -1,183 +0,0 @@
|
||||
//
|
||||
// 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
|
||||
}
|
||||
}
|
@@ -1,284 +0,0 @@
|
||||
//
|
||||
// System.Data.OracleClient.OracleCommand
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
// Boris Kirzner <borisk@mainsoft.com>
|
||||
//
|
||||
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Data.ProviderBase;
|
||||
using System.Globalization;
|
||||
|
||||
using java.sql;
|
||||
// Cannot use this because it makes ArrayList ambiguous reference
|
||||
//using java.util;
|
||||
#if !USE_DOTNET_REGEXP
|
||||
using java.util.regex;
|
||||
#endif
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
public sealed class OracleCommand : AbstractDbCommand {
|
||||
|
||||
#region Fields
|
||||
#if USE_DOTNET_REGEXP
|
||||
internal static readonly Regex NamedParameterStoredProcedureRegExp = new Regex(@"^\s*{?\s*((?<RETVAL>\:\w+)\s*=\s*)?call\s+(?<PROCNAME>(((\[[^\]]*\])|([^\.\(])*)\s*\.\s*){0,2}(\[[^\]]*\]|((\s*[^\.\(\)\{\}\s])+)))\s*(\(\s*(?<USERPARAM>((""([^""]|(""""))*"")|('([^']|(''))*')|[^,])*)?\s*(,\s*(?<USERPARAM>((""([^""]|(""""))*"")|('([^']|(''))*')|[^,])*)\s*)*\))?\s*}?\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
|
||||
#else
|
||||
internal static readonly Pattern NamedParameterStoredProcedureRegExp = Pattern.compile(@"^\s*\{?\s*(?:(\:\w+)\s*=\s*)?call\s+((?:(?:(?:\[[^\]]*\])|(?:[^\.\(\)\{\}\[\]])*)\s*\.\s*){0,2}(?:\[[^\]]*\]|(?:(?:\s*[^\.\(\)\{\}\[\]])+)))\s*(?:\((.*)\))?\s*\}?\s*$", Pattern.CASE_INSENSITIVE);
|
||||
#endif
|
||||
internal static readonly SimpleRegex NamedParameterRegExp = new OracleParamsRegex();
|
||||
|
||||
// internal static readonly int oracleTypeRefCursor = java.sql.Types.OTHER;
|
||||
|
||||
private int _currentParameterIndex = 0;
|
||||
private ResultSet _currentRefCursor;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the OracleCommand class.
|
||||
* The base constructor initializes all fields to their default values.
|
||||
* The following table shows initial property values for an instance of SqlCommand.
|
||||
*/
|
||||
public OracleCommand() : this(null, null, null) {
|
||||
}
|
||||
|
||||
public OracleCommand(OracleConnection connection) : this(null, connection, null) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the OracleCommand class with the text of the query.
|
||||
* @param cmdText The text of the query.
|
||||
*/
|
||||
public OracleCommand(String cmdText) : this(cmdText, null, null) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the OracleCommand class with the text of the query and a SqlConnection.
|
||||
* @param cmdText The text of the query.
|
||||
* @param connection A SqlConnection that represents the connection to an instance of SQL Server.
|
||||
*/
|
||||
public OracleCommand(String cmdText, OracleConnection connection) : this(cmdText, connection, null) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the OracleCommand class with the text of the query, a SqlConnection, and the Transaction.
|
||||
* @param cmdText The text of the query.
|
||||
* @param connection A SqlConnection that represents the connection to an instance of SQL Server.
|
||||
* @param transaction The SqlTransaction in which the OracleCommand executes.
|
||||
*/
|
||||
public OracleCommand(
|
||||
String cmdText,
|
||||
OracleConnection connection,
|
||||
OracleTransaction transaction)
|
||||
: base(cmdText, connection, transaction) {
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
public new OracleConnection Connection {
|
||||
get { return (OracleConnection)base.Connection; }
|
||||
set { base.Connection = (AbstractDBConnection)value; }
|
||||
}
|
||||
|
||||
public new OracleParameterCollection Parameters {
|
||||
get {
|
||||
return (OracleParameterCollection)base.Parameters;
|
||||
}
|
||||
}
|
||||
|
||||
public new OracleTransaction Transaction {
|
||||
get { return (OracleTransaction)base.Transaction; }
|
||||
set { base.Transaction = (DbTransaction)value; }
|
||||
}
|
||||
|
||||
protected override bool SkipParameter(DbParameter parameter) {
|
||||
return ((OracleParameter)parameter).OracleType == OracleType.Cursor;
|
||||
}
|
||||
|
||||
protected sealed override ResultSet CurrentResultSet {
|
||||
get {
|
||||
try {
|
||||
ResultSet resultSet = base.CurrentResultSet;
|
||||
|
||||
if (resultSet != null) {
|
||||
return resultSet;
|
||||
}
|
||||
return CurrentRefCursor;
|
||||
}
|
||||
catch(SQLException e) {
|
||||
throw CreateException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ResultSet CurrentRefCursor {
|
||||
get {
|
||||
if (_currentParameterIndex < 0) {
|
||||
NextRefCursor();
|
||||
}
|
||||
if (_currentRefCursor == null && _currentParameterIndex < InternalParameters.Count) {
|
||||
_currentRefCursor = (ResultSet)((CallableStatement)Statement).getObject(_currentParameterIndex + 1);
|
||||
}
|
||||
return _currentRefCursor;
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_DOTNET_REGEX
|
||||
protected override Regex StoredProcedureRegExp
|
||||
#else
|
||||
protected override java.util.regex.Pattern StoredProcedureRegExp {
|
||||
#endif
|
||||
get { return NamedParameterStoredProcedureRegExp; }
|
||||
}
|
||||
|
||||
protected override SimpleRegex ParameterRegExp {
|
||||
get { return NamedParameterRegExp; }
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override bool NextResultSet() {
|
||||
try {
|
||||
bool hasMoreResults = base.NextResultSet();
|
||||
|
||||
if (hasMoreResults) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return NextRefCursor();
|
||||
}
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw CreateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private bool NextRefCursor() {
|
||||
_currentRefCursor = null;
|
||||
for (_currentParameterIndex++;InternalParameters.Count > _currentParameterIndex;_currentParameterIndex++) {
|
||||
OracleParameter param = (OracleParameter)InternalParameters[_currentParameterIndex];
|
||||
if (param.OracleType == OracleType.Cursor && ((param.Direction & ParameterDirection.Output) == ParameterDirection.Output))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public new OracleDataReader ExecuteReader() {
|
||||
return (OracleDataReader)ExecuteReader(CommandBehavior.Default);
|
||||
}
|
||||
|
||||
public new OracleDataReader ExecuteReader(CommandBehavior behavior) {
|
||||
return (OracleDataReader)base.ExecuteReader(behavior);
|
||||
}
|
||||
|
||||
public new OracleParameter CreateParameter() {
|
||||
return (OracleParameter)CreateParameterInternal();
|
||||
}
|
||||
|
||||
protected sealed override void CheckParameters() {
|
||||
//TBD
|
||||
}
|
||||
|
||||
protected override AbstractDbParameter GetUserParameter(string parameterName, IList userParametersList, int userParametersListPosition) {
|
||||
for(int i=0; i < userParametersList.Count; i++) {
|
||||
OracleParameter userParameter = (OracleParameter)userParametersList[i];
|
||||
if (String.Compare(parameterName, userParameter.InternalPlaceholder.Trim(), true, CultureInfo.InvariantCulture) == 0) {
|
||||
return userParameter;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override AbstractDbParameter GetReturnParameter (IList userParametersList) {
|
||||
for(int i=0; i < userParametersList.Count; i++) {
|
||||
AbstractDbParameter userParameter = (AbstractDbParameter)userParametersList[i];
|
||||
if (userParameter.Direction == ParameterDirection.ReturnValue) {
|
||||
return userParameter;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected sealed override DbParameter CreateParameterInternal() {
|
||||
return new OracleParameter();
|
||||
}
|
||||
|
||||
protected sealed override DbParameterCollection CreateParameterCollection(AbstractDbCommand parent) {
|
||||
return new OracleParameterCollection((OracleCommand)parent);
|
||||
}
|
||||
|
||||
public override object Clone() {
|
||||
OracleCommand clone = (OracleCommand)base.Clone();
|
||||
clone._currentParameterIndex = 0;
|
||||
clone._currentRefCursor = null;
|
||||
return clone;
|
||||
}
|
||||
|
||||
protected override void PrepareInternalParameters() {
|
||||
InternalParameters.Clear();
|
||||
_currentParameterIndex = -1;
|
||||
}
|
||||
|
||||
|
||||
protected sealed override DbDataReader CreateReader() {
|
||||
return new OracleDataReader(this);
|
||||
}
|
||||
|
||||
protected sealed override SystemException CreateException(SQLException e) {
|
||||
return new OracleException(e,Connection);
|
||||
}
|
||||
|
||||
public object ExecuteOracleScalar() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#if SUPPORT_ORACLE_TYPES
|
||||
public int ExecuteOracleNonQuery(
|
||||
out OracleString rowid
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion // Methods
|
||||
|
||||
}
|
||||
}
|
@@ -1,129 +0,0 @@
|
||||
//
|
||||
// System.Data.OracleClient.OracleCommandBuilder
|
||||
//
|
||||
// Author:
|
||||
// Rodrigo Moya (rodrigo@ximian.com)
|
||||
// Tim Coleman (tim@timcoleman.com)
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
// Boris Kirzner <borisk@mainsoft.com>
|
||||
//
|
||||
// Copyright (C) Rodrigo Moya, 2002
|
||||
// Copyright (C) Tim Coleman, 2002
|
||||
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Data.ProviderBase;
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
/// <summary>
|
||||
/// Provides a means of automatically generating single-table commands used to reconcile changes made to a DataSet with the associated database. This class cannot be inherited.
|
||||
/// </summary>
|
||||
public sealed class OracleCommandBuilder : AbstractDbCommandBuilder {
|
||||
#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
|
||||
|
||||
public new OracleDataAdapter DataAdapter {
|
||||
get {
|
||||
return adapter;
|
||||
}
|
||||
set {
|
||||
adapter = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override string QuotePrefix {
|
||||
get {
|
||||
return quotePrefix;
|
||||
}
|
||||
set {
|
||||
quotePrefix = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override string QuoteSuffix {
|
||||
get {
|
||||
return quoteSuffix;
|
||||
}
|
||||
set {
|
||||
quoteSuffix = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
public static void DeriveParameters (OracleCommand command) {
|
||||
DeriveParameters((AbstractDbCommand)command);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
protected override void Dispose (bool disposing) {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public new OracleCommand GetDeleteCommand () {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public new OracleCommand GetInsertCommand () {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public OracleCommand GetUpdateCommand () {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
@@ -1,116 +0,0 @@
|
||||
//
|
||||
// System.Data.OracleClient.OracleConnection
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
// Boris Kirzner <borisk@mainsoft.com>
|
||||
//
|
||||
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
|
||||
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Data.ProviderBase;
|
||||
using System.Collections;
|
||||
|
||||
using java.sql;
|
||||
|
||||
using System.Configuration;
|
||||
using Mainsoft.Data.Configuration;
|
||||
using Mainsoft.Data.Jdbc.Providers;
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
public sealed class OracleConnection : AbstractDBConnection, System.ICloneable {
|
||||
#region Events
|
||||
|
||||
public event OracleInfoMessageEventHandler InfoMessage;
|
||||
|
||||
#endregion // Events
|
||||
|
||||
#region Constructors
|
||||
|
||||
public OracleConnection() : this(null) {
|
||||
}
|
||||
|
||||
public OracleConnection(String connectionString) : base(connectionString) {
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override IConnectionProvider GetConnectionProvider() {
|
||||
IDictionary conProviderDict = ConnectionStringDictionary.Parse(ConnectionString);
|
||||
string provider = (string)conProviderDict["Provider"];
|
||||
if (provider == null)
|
||||
provider = "ORACLECLIENT";
|
||||
|
||||
return GetConnectionProvider("Mainsoft.Data.Configuration/OracleClientProviders", provider);
|
||||
}
|
||||
|
||||
public new OracleTransaction BeginTransaction(IsolationLevel level) {
|
||||
return new OracleTransaction(level, this);
|
||||
}
|
||||
|
||||
public new OracleTransaction BeginTransaction() {
|
||||
return BeginTransaction(IsolationLevel.ReadCommitted);
|
||||
}
|
||||
|
||||
public new OracleCommand CreateCommand() {
|
||||
return new OracleCommand(this);
|
||||
}
|
||||
|
||||
protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel) {
|
||||
return BeginTransaction();
|
||||
}
|
||||
|
||||
protected override DbCommand CreateDbCommand() {
|
||||
return CreateCommand();
|
||||
}
|
||||
|
||||
protected sealed override SystemException CreateException(SQLException e) {
|
||||
return new OracleException(e,this);
|
||||
}
|
||||
|
||||
protected sealed override SystemException CreateException(string message) {
|
||||
return new OracleException(message, null, this);
|
||||
}
|
||||
|
||||
protected sealed override void OnSqlWarning(SQLWarning warning) {
|
||||
OracleErrorCollection col = new OracleErrorCollection(warning, this);
|
||||
OnOracleInfoMessage(new OracleInfoMessageEventArgs(col));
|
||||
}
|
||||
|
||||
private void OnOracleInfoMessage (OracleInfoMessageEventArgs value) {
|
||||
if (InfoMessage != null) {
|
||||
InfoMessage (this, value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
|
||||
}
|
||||
}
|
@@ -1,453 +0,0 @@
|
||||
//
|
||||
// System.Data.Oracle.OracleConvert
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
//
|
||||
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Data.Common;
|
||||
using System.Data.ProviderBase;
|
||||
|
||||
using java.sql;
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
#region oracle.sql.Types constants
|
||||
|
||||
internal enum JavaSqlTypes {
|
||||
ARRAY = 2003 ,
|
||||
BIGINT = -5,
|
||||
BINARY = -2 ,
|
||||
BIT = -7 ,
|
||||
BLOB = 2004,
|
||||
BOOLEAN = 16,
|
||||
CHAR = 1,
|
||||
CLOB = 2005,
|
||||
DATALINK = 70,
|
||||
DATE = 91,
|
||||
DECIMAL = 3,
|
||||
DISTINCT = 2001,
|
||||
DOUBLE = 8,
|
||||
FLOAT = 6,
|
||||
INTEGER = 4,
|
||||
JAVA_OBJECT = 2000,
|
||||
LONGVARBINARY = -4,
|
||||
LONGVARCHAR = -1,
|
||||
NULL = 0,
|
||||
NUMERIC = 2 ,
|
||||
OTHER = 1111 ,
|
||||
REAL = 7 ,
|
||||
REF = 2006 ,
|
||||
SMALLINT = 5,
|
||||
STRUCT = 2002,
|
||||
TIME = 92,
|
||||
TIMESTAMP = 93,
|
||||
TINYINT = -6,
|
||||
VARBINARY = -3,
|
||||
VARCHAR = 12,
|
||||
|
||||
//ORACLE types, see oracle.jdbc.OracleTypes
|
||||
BINARY_FLOAT = 100,
|
||||
BINARY_DOUBLE = 101,
|
||||
ROWID = -8,
|
||||
CURSOR = -10,
|
||||
TIMESTAMPNS = -100,
|
||||
TIMESTAMPTZ = -101,
|
||||
TIMESTAMPLTZ = -102,
|
||||
INTERVALYM = -103,
|
||||
INTERVALDS = -104,
|
||||
}
|
||||
|
||||
#endregion
|
||||
sealed class OracleConvert : DbConvert {
|
||||
|
||||
#region .Net types constants
|
||||
|
||||
internal static readonly Type TypeOfBoolean = typeof(Boolean);
|
||||
internal static readonly Type TypeOfSByte = typeof(SByte);
|
||||
internal static readonly Type TypeOfChar = typeof(Char);
|
||||
internal static readonly Type TypeOfInt16 = typeof(Int16);
|
||||
internal static readonly Type TypeOfInt32 = typeof(Int32);
|
||||
internal static readonly Type TypeOfInt64 = typeof(Int64);
|
||||
internal static readonly Type TypeOfByte = typeof(Byte);
|
||||
internal static readonly Type TypeOfUInt16 = typeof(UInt16);
|
||||
internal static readonly Type TypeOfUInt32 = typeof(UInt32);
|
||||
internal static readonly Type TypeOfUInt64 = typeof(UInt64);
|
||||
internal static readonly Type TypeOfDouble = typeof(Double);
|
||||
internal static readonly Type TypeOfSingle = typeof(Single);
|
||||
internal static readonly Type TypeOfDecimal = typeof(Decimal);
|
||||
internal static readonly Type TypeOfString = typeof(String);
|
||||
internal static readonly Type TypeOfDateTime = typeof(DateTime);
|
||||
internal static readonly Type TypeOfObject = typeof(object);
|
||||
internal static readonly Type TypeOfGuid = typeof(Guid);
|
||||
internal static readonly Type TypeOfType = typeof(Type);
|
||||
|
||||
// additional types
|
||||
internal static readonly Type TypeOfByteArray = typeof(Byte[]);
|
||||
internal static readonly Type TypeOfCharArray = typeof(Char[]);
|
||||
internal static readonly Type TypeOfFloat = typeof (float);
|
||||
internal static readonly Type TypeOfTimespan = typeof (TimeSpan);
|
||||
static readonly Type TypeOfIDataReader = typeof(IDataReader);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
internal static String JdbcTypeNameToDbTypeName(string jdbcTypeName) {
|
||||
return jdbcTypeName.Trim();;
|
||||
}
|
||||
|
||||
internal static OracleType JdbcTypeToOracleType(int jdbcType) {
|
||||
switch ((JavaSqlTypes)jdbcType) {
|
||||
case JavaSqlTypes.ARRAY: return OracleType.Blob;
|
||||
case JavaSqlTypes.BIGINT: return OracleType.Number;
|
||||
case JavaSqlTypes.BINARY: return OracleType.Blob;
|
||||
case JavaSqlTypes.BIT: return OracleType.Byte;
|
||||
case JavaSqlTypes.BLOB: return OracleType.Blob;
|
||||
case JavaSqlTypes.BOOLEAN: return OracleType.Byte;
|
||||
case JavaSqlTypes.CHAR: return OracleType.Char;
|
||||
case JavaSqlTypes.CLOB: return OracleType.Clob;
|
||||
// case JavaSqlTypes.DATALINK: return OracleType.IUnknown;
|
||||
case JavaSqlTypes.DATE: return OracleType.DateTime;
|
||||
case JavaSqlTypes.DECIMAL: return OracleType.Number;
|
||||
// case JavaSqlTypes.DISTINCT: return OracleType.IUnknown;
|
||||
case JavaSqlTypes.DOUBLE: return OracleType.Double;
|
||||
case JavaSqlTypes.FLOAT: return OracleType.Float;
|
||||
case JavaSqlTypes.INTEGER: return OracleType.Int32;
|
||||
// case JavaSqlTypes.JAVA_OBJECT: return OracleType.IUnknown;
|
||||
case JavaSqlTypes.LONGVARBINARY: return OracleType.LongRaw;
|
||||
case JavaSqlTypes.LONGVARCHAR: return OracleType.LongVarChar;
|
||||
// case JavaSqlTypes.NULL: return OracleType.Empty;
|
||||
case JavaSqlTypes.NUMERIC: return OracleType.Number;
|
||||
// case JavaSqlTypes.OTHER: return OracleType.IUnknown;
|
||||
// case JavaSqlTypes.REAL: return OracleType.Single;
|
||||
// case JavaSqlTypes.REF: return OracleType.IUnknown;
|
||||
case JavaSqlTypes.SMALLINT: return OracleType.Int16;
|
||||
// case JavaSqlTypes.STRUCT: return OracleType.IUnknown;
|
||||
case JavaSqlTypes.TIME: return OracleType.TimestampLocal;
|
||||
case JavaSqlTypes.TIMESTAMP: return OracleType.Timestamp;
|
||||
case JavaSqlTypes.TINYINT: return OracleType.Byte;
|
||||
case JavaSqlTypes.VARBINARY: return OracleType.LongVarChar;
|
||||
default:
|
||||
case JavaSqlTypes.VARCHAR: return OracleType.VarChar;
|
||||
|
||||
case JavaSqlTypes.BINARY_FLOAT: return OracleType.Float;
|
||||
case JavaSqlTypes.BINARY_DOUBLE: return OracleType.Double;
|
||||
case JavaSqlTypes.ROWID: return OracleType.RowId;
|
||||
case JavaSqlTypes.CURSOR: return OracleType.Cursor;
|
||||
case JavaSqlTypes.TIMESTAMPNS: return OracleType.Timestamp;
|
||||
case JavaSqlTypes.TIMESTAMPTZ: return OracleType.TimestampWithTZ;
|
||||
case JavaSqlTypes.TIMESTAMPLTZ: return OracleType.TimestampLocal;
|
||||
case JavaSqlTypes.INTERVALYM: return OracleType.IntervalYearToMonth;
|
||||
case JavaSqlTypes.INTERVALDS: return OracleType.IntervalDayToSecond;
|
||||
}
|
||||
}
|
||||
|
||||
internal static OracleType ValueTypeToOracleType(Type type) {
|
||||
switch (Type.GetTypeCode(type)) {
|
||||
case TypeCode.Boolean: return OracleType.Byte;
|
||||
case TypeCode.Byte: return OracleType.Byte;
|
||||
case TypeCode.Char: return OracleType.Char;
|
||||
case TypeCode.DateTime: return OracleType.DateTime;
|
||||
// case TypeCode.DBNull: return OracleType.Empty;
|
||||
case TypeCode.Decimal: return OracleType.Number;
|
||||
case TypeCode.Double: return OracleType.Double;
|
||||
// case TypeCode.Empty: return OracleType.Empty;
|
||||
case TypeCode.Int16: return OracleType.Int16;
|
||||
case TypeCode.Int32: return OracleType.Int32;
|
||||
case TypeCode.Int64: return OracleType.Number;
|
||||
default:
|
||||
case TypeCode.Object: {
|
||||
if (type.Equals(TypeOfByteArray)) return OracleType.Blob;
|
||||
if (type.Equals(TypeOfTimespan)) return OracleType.Timestamp;
|
||||
if (type.IsSubclassOf(TypeOfIDataReader)) return OracleType.Cursor;
|
||||
// if (type.Equals(DbTypes.TypeOfGuid)) return OracleType.Guid;
|
||||
//
|
||||
if (type.IsEnum)
|
||||
return ValueTypeToOracleType (Enum.GetUnderlyingType (type));
|
||||
//
|
||||
return OracleType.VarChar;
|
||||
}
|
||||
case TypeCode.SByte: return OracleType.SByte;
|
||||
case TypeCode.Single: return OracleType.Float;
|
||||
case TypeCode.String: return OracleType.VarChar;
|
||||
case TypeCode.UInt16: return OracleType.UInt16;
|
||||
case TypeCode.UInt32: return OracleType.UInt32;
|
||||
case TypeCode.UInt64: return OracleType.Number;
|
||||
}
|
||||
}
|
||||
|
||||
internal static Type OracleTypeToValueType(OracleType oleDbType) {
|
||||
switch (oleDbType) {
|
||||
// case OracleType.BigInt : return DbTypes.TypeOfInt64;// typeof(long);
|
||||
// case OracleType.Binary : return DbTypes.TypeOfByteArray;
|
||||
// case OracleType.Boolean : return DbTypes.TypeOfBoolean;
|
||||
// case OracleType.BSTR : return DbTypes.TypeOfString;
|
||||
case OracleType.BFile : return TypeOfByteArray;
|
||||
case OracleType.Blob : return TypeOfByteArray;
|
||||
case OracleType.Byte : return TypeOfByte;
|
||||
case OracleType.Char : return TypeOfString;
|
||||
case OracleType.Clob : return TypeOfCharArray;
|
||||
case OracleType.Cursor : return TypeOfIDataReader;
|
||||
case OracleType.DateTime : return TypeOfDateTime;
|
||||
// case OracleType.Currency : return TypeOfDecimal;
|
||||
// case OracleType.Date : return TypeOfDateTime;
|
||||
// case OracleType.DBDate : return TypeOfDateTime;
|
||||
// case OracleType.DBTime : return TypeOfTimespan;
|
||||
// case OracleType.DBTimeStamp : return TypeOfDateTime;
|
||||
// case OracleType.Decimal : return TypeOfDecimal;
|
||||
case OracleType.Double : return TypeOfDouble;
|
||||
case OracleType.Float : return TypeOfFloat;
|
||||
case OracleType.Int16 : return TypeOfInt16;
|
||||
case OracleType.Int32 : return TypeOfInt32;
|
||||
case OracleType.IntervalDayToSecond : return TypeOfTimespan;
|
||||
case OracleType.IntervalYearToMonth : return TypeOfInt32;
|
||||
case OracleType.LongRaw : return TypeOfByteArray;
|
||||
// case OracleType.Empty : return null; //typeof(DBNull);
|
||||
// case OracleType.Error : return typeof(Exception);
|
||||
// case OracleType.Filetime : return TypeOfDateTime;
|
||||
// case OracleType.Guid : return TypeOfGuid;
|
||||
// case OracleType.IDispatch : return TypeOfObject;
|
||||
// case OracleType.Integer : return TypeOfInt32;
|
||||
// case OracleType.IUnknown : return TypeOfObject;
|
||||
// case OracleType.LongVarBinary : return TypeOfByteArray;
|
||||
case OracleType.LongVarChar : return TypeOfString;
|
||||
case OracleType.NChar : return TypeOfString;
|
||||
case OracleType.NClob : return TypeOfString;
|
||||
case OracleType.Number : return TypeOfDecimal;
|
||||
case OracleType.NVarChar : return TypeOfString;
|
||||
case OracleType.Raw : return TypeOfByteArray;
|
||||
|
||||
case OracleType.RowId : return TypeOfString;
|
||||
case OracleType.SByte : return TypeOfSByte;
|
||||
case OracleType.Timestamp : return TypeOfTimespan;
|
||||
case OracleType.TimestampLocal : return TypeOfTimespan;
|
||||
case OracleType.TimestampWithTZ : return TypeOfTimespan;
|
||||
case OracleType.UInt16 : return TypeOfUInt16;
|
||||
|
||||
case OracleType.UInt32 : return TypeOfUInt32;
|
||||
case OracleType.VarChar : return TypeOfString;
|
||||
// case OracleType.LongVarWChar : return TypeOfString;
|
||||
// case OracleType.Numeric : return TypeOfDecimal;
|
||||
// case OracleType.PropVariant : return TypeOfObject;
|
||||
// case OracleType.Single : return TypeOfFloat;
|
||||
// case OracleType.SmallInt : return TypeOfInt16;
|
||||
// case OracleType.TinyInt : return TypeOfSByte;
|
||||
// case OracleType.UnsignedBigInt : return TypeOfUInt64;
|
||||
// case OracleType.UnsignedInt : return TypeOfUInt32;
|
||||
// case OracleType.UnsignedSmallInt : return TypeOfUInt16;
|
||||
// case OracleType.UnsignedTinyInt : return TypeOfByte;
|
||||
// case OracleType.VarBinary : return TypeOfByteArray;
|
||||
// case OracleType.VarChar : return TypeOfString;
|
||||
// case OracleType.Variant : return TypeOfObject;
|
||||
// case OracleType.VarNumeric : return TypeOfDecimal;
|
||||
// case OracleType.VarWChar : return TypeOfString;
|
||||
// case OracleType.WChar : return TypeOfString;
|
||||
default : return TypeOfObject;
|
||||
}
|
||||
}
|
||||
|
||||
internal static OracleType DbTypeToOracleType(DbType dbType) {
|
||||
switch (dbType) {
|
||||
case DbType.AnsiString : return OracleType.VarChar;
|
||||
case DbType.Binary : return OracleType.Blob;
|
||||
case DbType.Byte : return OracleType.Byte;
|
||||
case DbType.Boolean : return OracleType.Byte;
|
||||
case DbType.Currency : return OracleType.Number;
|
||||
case DbType.Date : return OracleType.DateTime;
|
||||
case DbType.DateTime : return OracleType.DateTime;
|
||||
case DbType.Decimal : return OracleType.Number;
|
||||
case DbType.Double : return OracleType.Double;
|
||||
case DbType.Guid : return OracleType.Char;
|
||||
case DbType.Int16 : return OracleType.Int16;
|
||||
case DbType.Int32 : return OracleType.Int32;
|
||||
case DbType.Int64 : return OracleType.Number;
|
||||
case DbType.Object : return OracleType.Cursor;
|
||||
case DbType.SByte : return OracleType.SByte;
|
||||
case DbType.Single : return OracleType.Float;
|
||||
case DbType.String : return OracleType.VarChar;
|
||||
case DbType.Time : return OracleType.Timestamp;
|
||||
case DbType.UInt16 : return OracleType.UInt16;
|
||||
case DbType.UInt32 : return OracleType.UInt32;
|
||||
case DbType.UInt64 : return OracleType.Number;
|
||||
case DbType.VarNumeric : return OracleType.Number;
|
||||
case DbType.AnsiStringFixedLength : return OracleType.NChar;
|
||||
case DbType.StringFixedLength : return OracleType.Char;
|
||||
default : throw ExceptionHelper.InvalidDbType((int)dbType);
|
||||
}
|
||||
}
|
||||
|
||||
internal static DbType OracleTypeToDbType(OracleType oleDbType) {
|
||||
switch (oleDbType) {
|
||||
case OracleType.BFile : return DbType.Binary;
|
||||
case OracleType.Blob : return DbType.Binary;
|
||||
case OracleType.Byte : return DbType.Byte;
|
||||
case OracleType.Char : return DbType.StringFixedLength;
|
||||
case OracleType.Clob : return DbType.String;
|
||||
case OracleType.Cursor : return DbType.Object;
|
||||
case OracleType.DateTime : return DbType.DateTime;
|
||||
case OracleType.Double : return DbType.Double;
|
||||
case OracleType.Float : return DbType.Single;
|
||||
case OracleType.Int16 : return DbType.Int16;
|
||||
case OracleType.Int32 : return DbType.Int32;
|
||||
case OracleType.IntervalDayToSecond : return DbType.Time;
|
||||
case OracleType.IntervalYearToMonth : return DbType.Int32;
|
||||
case OracleType.LongRaw : return DbType.Binary;
|
||||
case OracleType.LongVarChar : return DbType.String;
|
||||
case OracleType.NChar : return DbType.AnsiStringFixedLength;
|
||||
case OracleType.NClob : return DbType.AnsiString;
|
||||
case OracleType.Number : return DbType.VarNumeric;
|
||||
case OracleType.NVarChar : return DbType.AnsiString;
|
||||
case OracleType.Raw : return DbType.Binary;
|
||||
|
||||
case OracleType.RowId : return DbType.AnsiStringFixedLength;
|
||||
case OracleType.SByte : return DbType.SByte;
|
||||
case OracleType.Timestamp : return DbType.Time;
|
||||
case OracleType.TimestampLocal : return DbType.Time;
|
||||
case OracleType.TimestampWithTZ : return DbType.Time;
|
||||
case OracleType.UInt16 : return DbType.UInt16;
|
||||
|
||||
case OracleType.UInt32 : return DbType.UInt32;
|
||||
case OracleType.VarChar : return DbType.String;
|
||||
// case OracleType.Empty : return DbType.Object;
|
||||
// case OracleType.SmallInt : return DbType.Int16;
|
||||
// case OracleType.Integer : return DbType.Int32;
|
||||
// case OracleType.Single : return DbType.Single;
|
||||
// case OracleType.Double : return DbType.Double;
|
||||
// case OracleType.Currency : return DbType.Currency;
|
||||
// case OracleType.Date : return DbType.DateTime;
|
||||
// case OracleType.BSTR : return DbType.String;
|
||||
// case OracleType.IDispatch : return DbType.Object;
|
||||
// case OracleType.Error : return DbType.Object;
|
||||
// case OracleType.Boolean : return DbType.Boolean;
|
||||
// case OracleType.Variant : return DbType.Object;
|
||||
// case OracleType.IUnknown : return DbType.Object;
|
||||
// case OracleType.Decimal : return DbType.Decimal;
|
||||
// case OracleType.TinyInt : return DbType.SByte;
|
||||
// case OracleType.UnsignedTinyInt : return DbType.Byte;
|
||||
// case OracleType.UnsignedSmallInt : return DbType.UInt16;
|
||||
// case OracleType.UnsignedInt : return DbType.UInt32;
|
||||
// case OracleType.BigInt : return DbType.Int64;
|
||||
// case OracleType.UnsignedBigInt : return DbType.UInt64;
|
||||
// case OracleType.Filetime : return DbType.DateTime;
|
||||
// case OracleType.Guid : return DbType.Guid;
|
||||
// case OracleType.Binary : return DbType.Binary;
|
||||
// case OracleType.Char : return DbType.AnsiStringFixedLength;
|
||||
// case OracleType.WChar : return DbType.StringFixedLength;
|
||||
// case OracleType.Numeric : return DbType.Decimal;
|
||||
// case OracleType.DBDate : return DbType.Date;
|
||||
// case OracleType.DBTime : return DbType.Time;
|
||||
// case OracleType.DBTimeStamp : return DbType.DateTime;
|
||||
// case OracleType.PropVariant : return DbType.Object;
|
||||
// case OracleType.VarNumeric : return DbType.VarNumeric;
|
||||
// case OracleType.VarChar : return DbType.AnsiString;
|
||||
// case OracleType.LongVarChar : return DbType.AnsiString;
|
||||
// case OracleType.VarWChar : return DbType.String;
|
||||
// case OracleType.LongVarWChar : return DbType.String;
|
||||
// case OracleType.VarBinary : return DbType.Binary;
|
||||
// case OracleType.LongVarBinary : return DbType.Binary;
|
||||
default : throw ExceptionHelper.InvalidOleDbType((int)oleDbType);
|
||||
}
|
||||
}
|
||||
|
||||
internal static int OracleTypeToJdbcType(OracleType oleDbType) {
|
||||
switch(oleDbType) {
|
||||
case OracleType.BFile : return (int)JavaSqlTypes.BINARY;
|
||||
case OracleType.Blob : return (int)JavaSqlTypes.BINARY;
|
||||
case OracleType.Byte : return (int)JavaSqlTypes.TINYINT;
|
||||
case OracleType.Char : return (int)JavaSqlTypes.CHAR;
|
||||
case OracleType.Clob : return (int)JavaSqlTypes.CLOB;
|
||||
case OracleType.Cursor : return (int)JavaSqlTypes.CURSOR;
|
||||
case OracleType.DateTime : return (int)JavaSqlTypes.TIMESTAMP;
|
||||
case OracleType.Double : return (int)JavaSqlTypes.DOUBLE;
|
||||
case OracleType.Float : return (int)JavaSqlTypes.FLOAT;
|
||||
case OracleType.Int16 : return (int)JavaSqlTypes.SMALLINT;
|
||||
case OracleType.Int32 : return (int)JavaSqlTypes.INTEGER;
|
||||
case OracleType.IntervalDayToSecond : return (int)JavaSqlTypes.INTERVALDS;
|
||||
case OracleType.IntervalYearToMonth : return (int)JavaSqlTypes.INTERVALYM;
|
||||
case OracleType.LongRaw : return (int)JavaSqlTypes.LONGVARBINARY;
|
||||
case OracleType.LongVarChar : return (int)JavaSqlTypes.LONGVARCHAR;
|
||||
case OracleType.NChar : return (int)JavaSqlTypes.CHAR;
|
||||
case OracleType.NClob : return (int)JavaSqlTypes.CLOB;
|
||||
case OracleType.Number : return (int)JavaSqlTypes.NUMERIC;
|
||||
case OracleType.NVarChar : return (int)JavaSqlTypes.VARCHAR;
|
||||
case OracleType.Raw : return (int)JavaSqlTypes.BINARY;
|
||||
|
||||
case OracleType.RowId : return (int)JavaSqlTypes.VARCHAR;
|
||||
case OracleType.SByte : return (int)JavaSqlTypes.TINYINT;
|
||||
case OracleType.Timestamp : return (int)JavaSqlTypes.TIMESTAMP;
|
||||
case OracleType.TimestampLocal : return (int)JavaSqlTypes.TIMESTAMP;
|
||||
case OracleType.TimestampWithTZ : return (int)JavaSqlTypes.TIMESTAMP;
|
||||
case OracleType.UInt16 : return (int)JavaSqlTypes.SMALLINT;
|
||||
|
||||
case OracleType.UInt32 : return (int)JavaSqlTypes.INTEGER;
|
||||
case OracleType.VarChar : return (int)JavaSqlTypes.VARCHAR;
|
||||
// case OracleType.BigInt : return Types.BIGINT;
|
||||
// case OracleType.Binary : return Types.BINARY;
|
||||
// case OracleType.Boolean : return Types.BIT;
|
||||
// case OracleType.BSTR : return Types.VARCHAR;
|
||||
// case OracleType.Char : return Types.CHAR;
|
||||
// case OracleType.Currency : return Types.DECIMAL;
|
||||
// case OracleType.Date : return Types.TIMESTAMP;
|
||||
// case OracleType.DBDate : return Types.DATE;
|
||||
// case OracleType.DBTime : return Types.TIME;
|
||||
// case OracleType.DBTimeStamp : return Types.TIMESTAMP;
|
||||
// case OracleType.Decimal : return Types.DECIMAL;
|
||||
// case OracleType.Double : return Types.DOUBLE;
|
||||
// case OracleType.Empty : return Types.NULL;
|
||||
// case OracleType.Error : return Types.OTHER;
|
||||
// case OracleType.Filetime : return Types.TIMESTAMP;
|
||||
// case OracleType.Guid : return Types.CHAR;
|
||||
// case OracleType.IDispatch : return Types.OTHER; //throw new ArgumentException("The " + oleDbType + " OracleType value is not supported.");
|
||||
// case OracleType.Integer : return Types.INTEGER;
|
||||
// case OracleType.IUnknown : return Types.OTHER; //throw new ArgumentException("The " + oleDbType + " OracleType value is not supported.");
|
||||
// case OracleType.LongVarBinary : return Types.LONGVARBINARY;
|
||||
// case OracleType.LongVarChar : return Types.LONGVARCHAR;
|
||||
// case OracleType.LongVarWChar : return Types.LONGVARCHAR;
|
||||
// case OracleType.Numeric : return Types.NUMERIC;
|
||||
// case OracleType.PropVariant : return Types.OTHER;
|
||||
// case OracleType.Single : return Types.FLOAT;
|
||||
// case OracleType.SmallInt : return Types.SMALLINT;
|
||||
// case OracleType.TinyInt : return Types.TINYINT;
|
||||
// case OracleType.UnsignedBigInt : return Types.BIGINT;
|
||||
// case OracleType.UnsignedInt : return Types.INTEGER;
|
||||
// case OracleType.UnsignedSmallInt : return Types.SMALLINT;
|
||||
// case OracleType.UnsignedTinyInt : return Types.TINYINT;
|
||||
// case OracleType.VarBinary : return Types.VARBINARY;
|
||||
// case OracleType.VarChar : return Types.VARCHAR;
|
||||
// case OracleType.Variant : return Types.VARCHAR;
|
||||
// case OracleType.VarNumeric : return Types.DECIMAL;
|
||||
// case OracleType.VarWChar : return Types.VARCHAR;
|
||||
// case OracleType.WChar : return Types.VARCHAR;
|
||||
default : throw ExceptionHelper.InvalidOleDbType((int)oleDbType);
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,276 +0,0 @@
|
||||
//
|
||||
// System.Data.OracleClient.OracleDataReader
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
// Boris Kirzner <borisk@mainsoft.com>
|
||||
//
|
||||
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
using System.Data.Common;
|
||||
using System.Data.ProviderBase;
|
||||
|
||||
using java.sql;
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
public sealed class OracleDataReader : AbstractDataReader {
|
||||
#region Fields
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
internal OracleDataReader(OracleCommand command) : base(command) {
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Methods
|
||||
|
||||
protected sealed override SystemException CreateException(string message, SQLException e) {
|
||||
return new OracleException(message,e, (OracleConnection)_command.Connection);
|
||||
}
|
||||
|
||||
protected sealed override SystemException CreateException(java.io.IOException e) {
|
||||
return new OracleException(e, (OracleConnection)_command.Connection);
|
||||
}
|
||||
|
||||
public override String GetDataTypeName(int columnIndex) {
|
||||
try {
|
||||
string jdbcTypeName = Results.getMetaData().getColumnTypeName(columnIndex + 1);
|
||||
|
||||
return OracleConvert.JdbcTypeNameToDbTypeName(jdbcTypeName);
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw CreateException(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected override int GetProviderType(int jdbcType) {
|
||||
return (int)OracleConvert.JdbcTypeToOracleType(jdbcType);
|
||||
}
|
||||
|
||||
protected override IReaderCacheContainer CreateReaderCacheContainer(int jdbcType, int columnIndex) {
|
||||
switch ((JavaSqlTypes)jdbcType) {
|
||||
case JavaSqlTypes.BINARY_FLOAT:
|
||||
jdbcType = (int)JavaSqlTypes.REAL;
|
||||
break;
|
||||
case JavaSqlTypes.BINARY_DOUBLE:
|
||||
jdbcType = (int)JavaSqlTypes.DOUBLE;
|
||||
break;
|
||||
case JavaSqlTypes.ROWID:
|
||||
jdbcType = (int)JavaSqlTypes.VARCHAR;
|
||||
break;
|
||||
// case JavaSqlTypes.CURSOR:
|
||||
// jdbcType = JavaSqlTypes.OTHER;
|
||||
// break;
|
||||
case JavaSqlTypes.TIMESTAMPNS:
|
||||
jdbcType = (int)JavaSqlTypes.TIMESTAMP;
|
||||
break;
|
||||
case JavaSqlTypes.TIMESTAMPTZ:
|
||||
jdbcType = (int)JavaSqlTypes.TIMESTAMP;
|
||||
break;
|
||||
case JavaSqlTypes.TIMESTAMPLTZ:
|
||||
jdbcType = (int)JavaSqlTypes.TIMESTAMP;
|
||||
break;
|
||||
case JavaSqlTypes.INTERVALYM:
|
||||
jdbcType = (int)JavaSqlTypes.INTEGER;
|
||||
break;
|
||||
case JavaSqlTypes.INTERVALDS:
|
||||
jdbcType = (int)JavaSqlTypes.TIMESTAMP;
|
||||
break;
|
||||
}
|
||||
return base.CreateReaderCacheContainer (jdbcType, columnIndex);
|
||||
}
|
||||
|
||||
|
||||
protected override void SetSchemaType(DataRow schemaRow, ResultSetMetaData metaData, int columnIndex) {
|
||||
JavaSqlTypes columnType = (JavaSqlTypes)metaData.getColumnType(columnIndex);
|
||||
switch (columnType) {
|
||||
case JavaSqlTypes.BINARY_FLOAT:
|
||||
schemaRow [(int)SCHEMA_TABLE.ProviderType] = GetProviderType((int)columnType);
|
||||
schemaRow [(int)SCHEMA_TABLE.DataType] = OracleConvert.TypeOfFloat;
|
||||
schemaRow [(int)SCHEMA_TABLE.IsLong] = false;
|
||||
break;
|
||||
case JavaSqlTypes.BINARY_DOUBLE:
|
||||
schemaRow [(int)SCHEMA_TABLE.ProviderType] = GetProviderType((int)columnType);
|
||||
schemaRow [(int)SCHEMA_TABLE.DataType] = OracleConvert.TypeOfDouble;
|
||||
schemaRow [(int)SCHEMA_TABLE.IsLong] = false;
|
||||
break;
|
||||
case JavaSqlTypes.ROWID:
|
||||
schemaRow [(int)SCHEMA_TABLE.ProviderType] = GetProviderType((int)columnType);
|
||||
schemaRow [(int)SCHEMA_TABLE.DataType] = OracleConvert.TypeOfString;
|
||||
schemaRow [(int)SCHEMA_TABLE.IsLong] = false;
|
||||
break;
|
||||
case JavaSqlTypes.CURSOR:
|
||||
schemaRow [(int)SCHEMA_TABLE.ProviderType] = GetProviderType((int)columnType);
|
||||
schemaRow [(int)SCHEMA_TABLE.DataType] = OracleConvert.TypeOfDouble;
|
||||
schemaRow [(int)SCHEMA_TABLE.IsLong] = false;
|
||||
break;
|
||||
case JavaSqlTypes.TIMESTAMPNS:
|
||||
schemaRow [(int)SCHEMA_TABLE.ProviderType] = GetProviderType((int)columnType);
|
||||
schemaRow [(int)SCHEMA_TABLE.DataType] = OracleConvert.TypeOfTimespan;
|
||||
schemaRow [(int)SCHEMA_TABLE.IsLong] = false;
|
||||
break;
|
||||
case JavaSqlTypes.TIMESTAMPTZ:
|
||||
schemaRow [(int)SCHEMA_TABLE.ProviderType] = GetProviderType((int)columnType);
|
||||
schemaRow [(int)SCHEMA_TABLE.DataType] = OracleConvert.TypeOfTimespan;
|
||||
schemaRow [(int)SCHEMA_TABLE.IsLong] = false;
|
||||
break;
|
||||
case JavaSqlTypes.TIMESTAMPLTZ:
|
||||
schemaRow [(int)SCHEMA_TABLE.ProviderType] = GetProviderType((int)columnType);
|
||||
schemaRow [(int)SCHEMA_TABLE.DataType] = OracleConvert.TypeOfTimespan;
|
||||
schemaRow [(int)SCHEMA_TABLE.IsLong] = false;
|
||||
break;
|
||||
case JavaSqlTypes.INTERVALYM:
|
||||
schemaRow [(int)SCHEMA_TABLE.ProviderType] = GetProviderType((int)columnType);
|
||||
schemaRow [(int)SCHEMA_TABLE.DataType] = OracleConvert.TypeOfUInt32;
|
||||
schemaRow [(int)SCHEMA_TABLE.IsLong] = false;
|
||||
break;
|
||||
case JavaSqlTypes.INTERVALDS:
|
||||
schemaRow [(int)SCHEMA_TABLE.ProviderType] = GetProviderType((int)columnType);
|
||||
schemaRow [(int)SCHEMA_TABLE.DataType] = OracleConvert.TypeOfTimespan;
|
||||
schemaRow [(int)SCHEMA_TABLE.IsLong] = false;
|
||||
break;
|
||||
default:
|
||||
base.SetSchemaType(schemaRow, metaData, columnIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override decimal GetDecimal(int i) {
|
||||
if (IsNumeric(i))
|
||||
return GetDecimalSafe(i);
|
||||
|
||||
return base.GetDecimal(i);
|
||||
}
|
||||
|
||||
public override double GetDouble(int i) {
|
||||
if (IsNumeric(i))
|
||||
return GetDoubleSafe(i);
|
||||
|
||||
return base.GetDouble(i);
|
||||
}
|
||||
|
||||
public override float GetFloat(int i) {
|
||||
if (IsNumeric(i))
|
||||
return GetFloatSafe(i);
|
||||
|
||||
return base.GetFloat(i);
|
||||
}
|
||||
//
|
||||
// OracleClient does not "excuse" for Int16
|
||||
//
|
||||
// public override short GetInt16(int i) {
|
||||
// if (IsNumeric(i))
|
||||
// return GetInt16Safe(i);
|
||||
//
|
||||
// return base.GetInt16(i);
|
||||
// }
|
||||
|
||||
|
||||
public override int GetInt32(int i) {
|
||||
if (IsNumeric(i))
|
||||
return GetInt32Safe(i);
|
||||
|
||||
return base.GetInt32(i);
|
||||
}
|
||||
|
||||
public override long GetInt64(int i) {
|
||||
if (IsNumeric(i))
|
||||
return GetInt64Safe(i);
|
||||
|
||||
return base.GetInt64(i);
|
||||
}
|
||||
|
||||
#if SUPPORT_ORACLE_TYPES
|
||||
#region GetOracleXXX
|
||||
|
||||
public OracleBFile GetOracleBFile(
|
||||
int i
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public OracleBinary GetOracleBinary(
|
||||
int i
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public OracleDateTime GetOracleDateTime(
|
||||
int i
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public OracleLob GetOracleLob(
|
||||
int i
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public OracleMonthSpan GetOracleMonthSpan(
|
||||
int i
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public OracleNumber GetOracleNumber(
|
||||
int i
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public OracleString GetOracleString(
|
||||
int i
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public OracleTimeSpan GetOracleTimeSpan(
|
||||
int i
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public object GetOracleValue(
|
||||
int i
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetOracleValues(
|
||||
object[] values
|
||||
) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endif
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
@@ -1,67 +0,0 @@
|
||||
//
|
||||
// System.Data.OleDb.OleDbError
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
//
|
||||
// (C) 2006 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
using java.sql;
|
||||
using System.Data.Common;
|
||||
using System.Data.ProviderBase;
|
||||
|
||||
[Serializable]
|
||||
internal sealed class OracleError : AbstractDbError {
|
||||
|
||||
internal OracleError(SQLException e, AbstractDBConnection connection) : base(e, connection) {
|
||||
}
|
||||
|
||||
public String Message {
|
||||
get {
|
||||
return DbMessage;
|
||||
}
|
||||
}
|
||||
|
||||
public int NativeError {
|
||||
get {
|
||||
return DbErrorCode;
|
||||
}
|
||||
}
|
||||
|
||||
public String Source {
|
||||
get {
|
||||
return DbSource;
|
||||
}
|
||||
}
|
||||
|
||||
public String SQLState {
|
||||
get {
|
||||
return DbSQLState;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,61 +0,0 @@
|
||||
//
|
||||
// System.Data.OleDb.OleDbErrorCollection
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
//
|
||||
// (C) 2006 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
|
||||
|
||||
using System.Collections;
|
||||
using java.sql;
|
||||
using System.Data.Common;
|
||||
using System.Data.ProviderBase;
|
||||
|
||||
[Serializable]
|
||||
public sealed class OracleErrorCollection : AbstractDbErrorCollection {
|
||||
internal OracleErrorCollection(SQLException e, AbstractDBConnection connection) : base(e, connection) {
|
||||
}
|
||||
/**
|
||||
* Gets the error at the specified index.
|
||||
*
|
||||
* @param index of the error
|
||||
* @return Error on specified index
|
||||
*/
|
||||
internal OracleError this[int index] {
|
||||
get {
|
||||
return (OracleError)GetDbItem(index);
|
||||
}
|
||||
}
|
||||
|
||||
protected override AbstractDbError CreateDbError(SQLException e, AbstractDBConnection connection) {
|
||||
return new OracleError(e, connection);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,153 +0,0 @@
|
||||
//
|
||||
// System.Data.SqlClient.SqlException
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
// Boris Kirzner <borisk@mainsoft.com>
|
||||
//
|
||||
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
|
||||
using java.sql;
|
||||
|
||||
using System;
|
||||
using System.Data.ProviderBase;
|
||||
|
||||
/**
|
||||
* The exception that is thrown when SQL Server returns a warning or error.
|
||||
* This class cannot be inherited.
|
||||
*/
|
||||
|
||||
/*
|
||||
* CURRENT LIMITATIONS
|
||||
* 1. Constructor for serialization SqlException(SerializationInfo info, StreamingContext sc)
|
||||
* is not supported.
|
||||
* 2. Method "void GetObjectData(...,...)" is not supported (serialization)
|
||||
*/
|
||||
|
||||
public sealed class OracleException : AbstractDbException {
|
||||
internal OracleException(Exception cause, OracleConnection connection) : base(cause, connection) {}
|
||||
|
||||
internal OracleException(SQLException cause, OracleConnection connection) : base(cause, connection) {}
|
||||
|
||||
internal OracleException(string message, SQLException cause, OracleConnection connection) : base(message, cause, connection) {}
|
||||
|
||||
protected override AbstractDbErrorCollection DbErrors {
|
||||
get {
|
||||
return Errors;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the severity level of the error returned from the SQL Server .NET
|
||||
* Data Provider.
|
||||
* @return severity level of the first error in the collection.
|
||||
*/
|
||||
// public byte Class {
|
||||
// get {
|
||||
// SqlErrorCollection errors = Errors;
|
||||
// return errors.Count > 0 ? errors[0].Class : (byte)0;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets a collection of one or more SqlError objects that give detailed
|
||||
* information about exceptions generated by the SQL Server .NET Data Provider.
|
||||
* @return collection of SqlError objects
|
||||
*/
|
||||
internal OracleErrorCollection Errors {
|
||||
get {
|
||||
return new OracleErrorCollection(_cause, _connection);
|
||||
}
|
||||
}
|
||||
|
||||
public int Code {
|
||||
get { return DbErrorCode; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the line number within the Transact-SQL command batch or stored
|
||||
* procedure that generated the error.
|
||||
* @return line number of the first error in the collection.
|
||||
*/
|
||||
// public int LineNumber {
|
||||
// get {
|
||||
// SqlErrorCollection errors = Errors;
|
||||
// return errors.Count > 0 ? errors[0].LineNumber : 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets a number that identifies the type of error.
|
||||
* @return number that identifies the type of first error in the collection
|
||||
*/
|
||||
// public int Number {
|
||||
// get {
|
||||
// SqlErrorCollection errors = Errors;
|
||||
// return errors.Count > 0 ? errors[0].Number : 0;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the name of the stored procedure or remote procedure call (RPC)
|
||||
* that generated the error.
|
||||
* @return name of the stored procedure
|
||||
*/
|
||||
// public String Procedure {
|
||||
// get {
|
||||
// SqlErrorCollection errors = Errors;
|
||||
// return errors.Count > 0 ? errors[0].Procedure : null;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the name of the computer running an instance of SQL Server
|
||||
* that generated the error.
|
||||
* @return name of the computer where error generated
|
||||
*/
|
||||
// public String Server {
|
||||
// get {
|
||||
// SqlErrorCollection errors = Errors;
|
||||
// return errors.Count > 0 ? errors[0].Server : null;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Gets a numeric error code from SQL Server that represents an error,
|
||||
* warning or "no data found" message.
|
||||
* @return numeric error code from SQL Server
|
||||
*/
|
||||
// public byte State {
|
||||
// get {
|
||||
// SqlErrorCollection errors = Errors;
|
||||
// return errors.Count > 0 ? errors[0].State : (byte)0;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
@@ -1,77 +0,0 @@
|
||||
//
|
||||
// System.Data.SqlClient.SqlInfoMessageEventArgs
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
//
|
||||
// (C) 2006 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
/// <summary>
|
||||
/// Summary description for SqlInfoMessageEventArgs.
|
||||
/// </summary>
|
||||
public sealed class OracleInfoMessageEventArgs : EventArgs {
|
||||
#region Fields
|
||||
|
||||
readonly OracleErrorCollection errors ;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
internal OracleInfoMessageEventArgs (OracleErrorCollection errors) {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
public OracleErrorCollection Errors {
|
||||
get { return errors; }
|
||||
}
|
||||
|
||||
public string Message {
|
||||
get { return errors[0].Message; }
|
||||
}
|
||||
|
||||
public string Source {
|
||||
get { return errors[0].Source; }
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
public override string ToString() {
|
||||
return Message;
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
@@ -1,329 +0,0 @@
|
||||
|
||||
using System;
|
||||
using System.Data.SqlTypes;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
public sealed class OracleLob : Stream, ICloneable, INullable {
|
||||
#region Fields
|
||||
|
||||
public static readonly new OracleLob Null = new OracleLob ();
|
||||
|
||||
internal OracleConnection connection;
|
||||
bool isBatched = false;
|
||||
bool isOpen = true;
|
||||
bool notNull = false;
|
||||
OracleType type;
|
||||
|
||||
long length = -1;
|
||||
long position = 0;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
internal OracleLob () {
|
||||
}
|
||||
|
||||
|
||||
#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 ();
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
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 ();
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public OracleType LobType {
|
||||
get { return type; }
|
||||
}
|
||||
|
||||
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 "";
|
||||
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.");
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void BeginBatch () {
|
||||
BeginBatch (OracleLobOpenMode.ReadOnly);
|
||||
}
|
||||
|
||||
public void BeginBatch (OracleLobOpenMode mode) {
|
||||
AssertConnectionIsOpen ();
|
||||
AssertObjectNotDisposed ();
|
||||
|
||||
isBatched = true;
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public object Clone () {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override void Close () {
|
||||
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 ();
|
||||
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public void Dispose () {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public void EndBatch () {
|
||||
AssertConnectionIsOpen ();
|
||||
AssertObjectNotDisposed ();
|
||||
|
||||
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");
|
||||
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
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 ();
|
||||
|
||||
throw new NotImplementedException ();
|
||||
|
||||
int bytesRead;
|
||||
byte[] output = new byte[count];
|
||||
|
||||
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 ();
|
||||
|
||||
throw new NotImplementedException ();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
throw new NotImplementedException ();
|
||||
|
||||
// position += locator.Write (value, (uint) Position, (uint) value.Length, LobType);
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
@@ -1,230 +0,0 @@
|
||||
//
|
||||
// System.Data.OracleClient.OracleParameter
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
// Boris Kirzner <borisk@mainsoft.com>
|
||||
//
|
||||
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Data.ProviderBase;
|
||||
using System.Globalization;
|
||||
|
||||
using java.sql;
|
||||
using java.lang;
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
public sealed class OracleParameter : AbstractDbParameter, ICloneable {
|
||||
|
||||
#region Fields
|
||||
|
||||
OracleType _oleDbType = OracleType.VarChar;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
public OracleParameter() {
|
||||
}
|
||||
|
||||
public OracleParameter(String parameterName, Object value)
|
||||
: this (parameterName, OracleType.VarChar, 0, ParameterDirection.Input,
|
||||
false, 0, 0, String.Empty, DataRowVersion.Current, value) {
|
||||
IsDbTypeSet = false;
|
||||
}
|
||||
|
||||
public OracleParameter(String parameterName, OracleType dbType)
|
||||
: this (parameterName, dbType, 0, ParameterDirection.Input,
|
||||
false, 0, 0, String.Empty, DataRowVersion.Current, null) {
|
||||
}
|
||||
|
||||
public OracleParameter(String parameterName, OracleType dbType, int size)
|
||||
: this (parameterName, dbType, size, ParameterDirection.Input,
|
||||
false, 0, 0, String.Empty, DataRowVersion.Current, null) {
|
||||
}
|
||||
|
||||
public OracleParameter(String parameterName, OracleType dbType, int size,
|
||||
String sourceColumn)
|
||||
: this (parameterName, dbType, size, ParameterDirection.Input,
|
||||
false, 0, 0, sourceColumn, DataRowVersion.Current, null) {
|
||||
}
|
||||
|
||||
|
||||
public OracleParameter(String parameterName,
|
||||
OracleType dbType,
|
||||
int size,
|
||||
ParameterDirection direction,
|
||||
bool isNullable,
|
||||
byte precision,
|
||||
byte scale,
|
||||
String sourceColumn,
|
||||
DataRowVersion sourceVersion,
|
||||
Object value) {
|
||||
ParameterName = parameterName;
|
||||
OracleType = dbType;
|
||||
Size = size;
|
||||
Direction = direction;
|
||||
IsNullable = isNullable;
|
||||
Precision = precision;
|
||||
Scale = scale;
|
||||
SourceColumn = sourceColumn;
|
||||
SourceVersion = sourceVersion;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
public override DbType DbType {
|
||||
get { return OracleConvert.OracleTypeToDbType(_oleDbType); }
|
||||
set { OracleType = OracleConvert.DbTypeToOracleType(value); }
|
||||
}
|
||||
|
||||
public OracleType OracleType {
|
||||
get { return _oleDbType; }
|
||||
set {
|
||||
_oleDbType = value;
|
||||
IsDbTypeSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
public new Object Value {
|
||||
get { return base.Value; }
|
||||
set {
|
||||
if (!IsDbTypeSet && (value != null) && (value != DBNull.Value)) {
|
||||
_oleDbType = OracleConvert.ValueTypeToOracleType(value.GetType());
|
||||
}
|
||||
base.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public new byte Precision {
|
||||
get { return base.Precision; }
|
||||
set { base.Precision = value; }
|
||||
}
|
||||
|
||||
public new byte Scale {
|
||||
get { return base.Scale; }
|
||||
set { base.Scale = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
public override String ToString() {
|
||||
return ParameterName;
|
||||
}
|
||||
|
||||
protected override string Placeholder {
|
||||
get {
|
||||
if (ParameterName.Length == 0 || ParameterName[0] == ':')
|
||||
return ParameterName;
|
||||
|
||||
return String.Concat(":", ParameterName);
|
||||
}
|
||||
}
|
||||
|
||||
internal string InternalPlaceholder {
|
||||
get {
|
||||
return Placeholder;
|
||||
}
|
||||
}
|
||||
|
||||
protected sealed override object ConvertValue(object value) {
|
||||
// can not convert null or DbNull to other types
|
||||
if (value == null || value == DBNull.Value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// TBD : some other way to do this?
|
||||
// if (OracleType == OracleType.Binary) {
|
||||
// return value;
|
||||
// }
|
||||
// .NET throws an exception to the user.
|
||||
object convertedValue = value;
|
||||
|
||||
// note : if we set user parameter jdbc type inside prepare interbal, the db type is not set
|
||||
if (value is IConvertible && (IsDbTypeSet || IsJdbcTypeSet)) {
|
||||
OracleType oleDbType = (IsDbTypeSet) ? OracleType : OracleConvert.JdbcTypeToOracleType((int)JdbcType);
|
||||
Type to = OracleConvert.OracleTypeToValueType(oleDbType);
|
||||
if (!(value is DateTime && to == OracleConvert.TypeOfTimespan)) //anyway will go by jdbc type
|
||||
convertedValue = Convert.ChangeType(value,to);
|
||||
}
|
||||
return convertedValue;
|
||||
}
|
||||
|
||||
protected sealed override void SetParameterName(ResultSet res) {
|
||||
ParameterName = res.getString("COLUMN_NAME");
|
||||
}
|
||||
|
||||
protected sealed override void SetParameterDbType(ResultSet res) {
|
||||
int jdbcType = res.getInt("DATA_TYPE");
|
||||
// FIXME : is that correct?
|
||||
if (jdbcType == Types.OTHER) {
|
||||
string typeName = res.getString("TYPE_NAME");
|
||||
if (String.Compare("REF CURSOR", typeName, true, CultureInfo.InvariantCulture) == 0) {
|
||||
jdbcType = (int)JavaSqlTypes.CURSOR;
|
||||
}
|
||||
else if (String.Compare("BLOB",typeName,true, CultureInfo.InvariantCulture) == 0) {
|
||||
jdbcType = (int)JavaSqlTypes.BLOB;
|
||||
}
|
||||
else if (String.Compare("CLOB",typeName,true, CultureInfo.InvariantCulture) == 0) {
|
||||
jdbcType = (int)JavaSqlTypes.CLOB;
|
||||
}
|
||||
else if(String.Compare("FLOAT",typeName,true, CultureInfo.InvariantCulture) == 0) {
|
||||
jdbcType = (int)JavaSqlTypes.FLOAT;
|
||||
}
|
||||
else if(String.Compare("NVARCHAR2",typeName,true, CultureInfo.InvariantCulture) == 0) {
|
||||
jdbcType = (int)JavaSqlTypes.VARCHAR;
|
||||
}
|
||||
else if(String.Compare("NCHAR",typeName,true, CultureInfo.InvariantCulture) == 0) {
|
||||
jdbcType = (int)JavaSqlTypes.VARCHAR;
|
||||
}
|
||||
}
|
||||
OracleType = OracleConvert.JdbcTypeToOracleType(jdbcType);
|
||||
JdbcType = jdbcType;
|
||||
}
|
||||
|
||||
protected sealed override void SetSpecialFeatures(ResultSet res) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
protected sealed override int JdbcTypeFromProviderType() {
|
||||
return OracleConvert.OracleTypeToJdbcType(OracleType);
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
|
||||
}
|
||||
}
|
@@ -1,120 +0,0 @@
|
||||
//
|
||||
// System.Data.Common.OracleParameterCollection
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
// Boris Kirzner <borisk@mainsoft.com>
|
||||
//
|
||||
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
|
||||
using System.Data.ProviderBase;
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
public sealed class OracleParameterCollection : AbstractDbParameterCollection {
|
||||
#region Constructors
|
||||
|
||||
public OracleParameterCollection(OracleCommand parent): base(parent) {
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
public new OracleParameter this[int index] {
|
||||
get { return (OracleParameter)base[index]; }
|
||||
set {
|
||||
OnSchemaChanging();
|
||||
base[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public new OracleParameter this[string parameterName] {
|
||||
get { return (OracleParameter)base[parameterName]; }
|
||||
set {
|
||||
OnSchemaChanging();
|
||||
base[parameterName] = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override Type ItemType {
|
||||
get { return typeof(OracleParameter); }
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
public OracleParameter Add(OracleParameter value) {
|
||||
base.Add(value);
|
||||
return value;
|
||||
}
|
||||
|
||||
public OracleParameter Add(string parameterName, object value) {
|
||||
OracleParameter param = new OracleParameter(parameterName, value);
|
||||
return Add(param);
|
||||
}
|
||||
|
||||
public OracleParameter Add(string parameterName, OracleType sqlDbType) {
|
||||
OracleParameter param = new OracleParameter(parameterName, sqlDbType);
|
||||
return Add(param);
|
||||
}
|
||||
|
||||
public OracleParameter Add(string parameterName, OracleType sqlDbType, int size) {
|
||||
OracleParameter param = new OracleParameter(parameterName, sqlDbType, size);
|
||||
return Add(param);
|
||||
}
|
||||
|
||||
public OracleParameter Add(string parameterName, OracleType sqlDbType, int size, string sourceColumn) {
|
||||
OracleParameter param = new OracleParameter(parameterName, sqlDbType, size, sourceColumn);
|
||||
return Add(param);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
public OracleParameter AddWithValue (string parameterName, object value) {
|
||||
return Add (parameterName, value);
|
||||
}
|
||||
|
||||
public bool Contains (OracleParameter value) {
|
||||
return base.Contains (value);
|
||||
}
|
||||
|
||||
public void CopyTo (OracleParameter [] array, int index) {
|
||||
base.CopyTo (array, index);
|
||||
}
|
||||
|
||||
public void Insert (int index, OracleParameter value) {
|
||||
base.Insert (index, value);
|
||||
}
|
||||
|
||||
public void Remove (OracleParameter value) {
|
||||
base.Remove (value);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion // Methods
|
||||
|
||||
}
|
||||
}
|
@@ -1,65 +0,0 @@
|
||||
//
|
||||
// System.Data.OracleClient.OracleTransaction.cs
|
||||
//
|
||||
// Authors:
|
||||
// Konstantin Triger <kostat@mainsoft.com>
|
||||
// Boris Kirzner <borisk@mainsoft.com>
|
||||
//
|
||||
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.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.
|
||||
//
|
||||
|
||||
|
||||
namespace System.Data.OracleClient {
|
||||
|
||||
using System.Data.Common;
|
||||
using System.Data.ProviderBase;
|
||||
using System.Data;
|
||||
|
||||
public sealed class OracleTransaction : AbstractTransaction {
|
||||
|
||||
internal OracleTransaction(OracleConnection connection) : base(IsolationLevel.ReadCommitted, connection, null) {
|
||||
}
|
||||
|
||||
internal OracleTransaction(OracleConnection connection, String transactionName) : base(IsolationLevel.ReadCommitted, connection, transactionName) {
|
||||
}
|
||||
|
||||
internal OracleTransaction(IsolationLevel isolationLevel, OracleConnection connection) : base(isolationLevel, connection, null) {
|
||||
}
|
||||
|
||||
public new OracleConnection Connection {
|
||||
get {
|
||||
return (OracleConnection)base.Connection;
|
||||
}
|
||||
}
|
||||
|
||||
public OracleTransaction Begin() {
|
||||
return Begin(IsolationLevel.ReadCommitted);
|
||||
}
|
||||
|
||||
public OracleTransaction Begin(IsolationLevel isolationLevetl) {
|
||||
throw new InvalidOperationException("Only one transaction can be active on this session.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user