Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -44,12 +44,8 @@ namespace System.Data.Odbc
/// </summary>
[DesignerAttribute ("Microsoft.VSDesigner.Data.VS.OdbcCommandDesigner, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.ComponentModel.Design.IDesigner")]
[ToolboxItemAttribute ("System.Drawing.Design.ToolboxItem, "+ Consts.AssemblySystem_Drawing)]
#if NET_2_0
[DefaultEvent ("RecordsAffected")]
public sealed class OdbcCommand : DbCommand, ICloneable
#else
public sealed class OdbcCommand : Component, ICloneable, IDbCommand
#endif //NET_2_0
{
#region Fields
@@ -115,9 +111,7 @@ namespace System.Data.Odbc
[EditorAttribute ("Microsoft.VSDesigner.Data.Odbc.Design.OdbcCommandTextEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
[RefreshPropertiesAttribute (RefreshProperties.All)]
public
#if NET_2_0
override
#endif
string CommandText {
get {
if (commandText == null)
@@ -125,9 +119,7 @@ namespace System.Data.Odbc
return commandText;
}
set {
#if NET_2_0
prepared = false;
#endif
commandText = value;
}
}
@@ -149,9 +141,7 @@ namespace System.Data.Odbc
[OdbcDescriptionAttribute ("How to interpret the CommandText")]
[RefreshPropertiesAttribute (RefreshProperties.All)]
public
#if NET_2_0
override
#endif
CommandType CommandType {
get { return commandType; }
set {
@@ -160,36 +150,20 @@ namespace System.Data.Odbc
}
}
#if ONLY_1_1
[OdbcCategory ("Behavior")]
[OdbcDescriptionAttribute ("Connection used by the command")]
[DefaultValue (null)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
public OdbcConnection Connection {
get { return connection; }
set { connection = value; }
}
#endif // ONLY_1_1
#if NET_2_0
[DefaultValue (null)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
public new OdbcConnection Connection {
get { return DbConnection as OdbcConnection; }
set { DbConnection = value; }
}
#endif // NET_2_0
[BrowsableAttribute (false)]
[DesignOnlyAttribute (true)]
[DefaultValue (true)]
#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Never)]
#endif
public
#if NET_2_0
override
#endif
bool DesignTimeVisible {
get { return designTimeVisible; }
set { designTimeVisible = value; }
@@ -199,16 +173,10 @@ namespace System.Data.Odbc
[OdbcDescriptionAttribute ("The parameters collection")]
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Content)]
public
#if NET_2_0
new
#endif // NET_2_0
OdbcParameterCollection Parameters {
get {
#if ONLY_1_1
return _parameters;
#else
return base.Parameters as OdbcParameterCollection;
#endif // ONLY_1_1
}
}
@@ -216,9 +184,7 @@ namespace System.Data.Odbc
[OdbcDescriptionAttribute ("The transaction used by the command")]
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
public
#if NET_2_0
new
#endif // NET_2_0
OdbcTransaction Transaction {
get { return transaction; }
set { transaction = value; }
@@ -228,9 +194,7 @@ namespace System.Data.Odbc
[DefaultValue (UpdateRowSource.Both)]
[OdbcDescriptionAttribute ("When used by a DataAdapter.Update, how command results are applied to the current DataRow")]
public
#if NET_2_0
override
#endif
UpdateRowSource UpdatedRowSource {
get { return updateRowSource; }
set {
@@ -239,55 +203,27 @@ namespace System.Data.Odbc
}
}
#if NET_2_0
protected override DbConnection DbConnection {
get { return connection; }
set { connection = (OdbcConnection) value;}
}
#endif // NET_2_0
#if ONLY_1_1
IDbConnection IDbCommand.Connection {
get { return Connection; }
set { Connection = (OdbcConnection) value; }
}
IDataParameterCollection IDbCommand.Parameters {
get { return Parameters; }
}
#else
protected override DbParameterCollection DbParameterCollection {
get { return _parameters as DbParameterCollection;}
}
#endif // NET_2_0
#if ONLY_1_1
IDbTransaction IDbCommand.Transaction {
get { return (IDbTransaction) Transaction; }
set {
if (value is OdbcTransaction) {
Transaction = (OdbcTransaction) value;
} else {
throw new ArgumentException ();
}
}
}
#else
protected override DbTransaction DbTransaction {
get { return transaction; }
set { transaction = (OdbcTransaction) value; }
}
#endif // ONLY_1_1
#endregion // Properties
#region Methods
public
#if NET_2_0
override
#endif // NET_2_0
void Cancel ()
{
if (hstmt != IntPtr.Zero) {
@@ -298,18 +234,10 @@ namespace System.Data.Odbc
throw new InvalidOperationException ();
}
#if ONLY_1_1
IDbDataParameter IDbCommand.CreateParameter ()
{
return CreateParameter ();
}
#else
protected override DbParameter CreateDbParameter ()
{
return CreateParameter ();
}
#endif // ONLY_1_1
public new OdbcParameter CreateParameter ()
{
@@ -330,9 +258,7 @@ namespace System.Data.Odbc
return;
FreeStatement (); // free handles
#if NET_2_0
CommandText = null;
#endif
Connection = null;
Transaction = null;
Parameters.Clear ();
@@ -422,9 +348,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
int ExecuteNonQuery ()
{
return ExecuteNonQuery ("ExecuteNonQuery", CommandBehavior.Default, false);
@@ -464,9 +388,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
void Prepare()
{
ReAllocStatment ();
@@ -489,30 +411,19 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
new
#endif // NET_2_0
OdbcDataReader ExecuteReader ()
{
return ExecuteReader (CommandBehavior.Default);
}
#if ONLY_1_1
IDataReader IDbCommand.ExecuteReader ()
{
return ExecuteReader ();
}
#else
protected override DbDataReader ExecuteDbDataReader (CommandBehavior behavior)
{
return ExecuteReader (behavior);
}
#endif // ONLY_1_1
public
#if NET_2_0
new
#endif // NET_2_0
OdbcDataReader ExecuteReader (CommandBehavior behavior)
{
return ExecuteReader ("ExecuteReader", behavior);
@@ -525,17 +436,9 @@ namespace System.Data.Odbc
return dataReader;
}
#if ONLY_1_1
IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
{
return ExecuteReader (behavior);
}
#endif // ONLY_1_1
public
#if NET_2_0
override
#endif
object ExecuteScalar ()
{
object val = null;

View File

@@ -42,19 +42,11 @@ namespace System.Data.Odbc
/// 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>
#if NET_2_0
public sealed class OdbcCommandBuilder : DbCommandBuilder
#else // 1_1
public sealed class OdbcCommandBuilder : Component
#endif // NET_2_0
{
#region Fields
private OdbcDataAdapter _adapter;
#if ONLY_1_1
private string _quotePrefix;
private string _quoteSuffix;
#endif
private DataTable _schema;
private string _tableName;
@@ -87,9 +79,7 @@ namespace System.Data.Odbc
[OdbcDescriptionAttribute ("The DataAdapter for which to automatically generate OdbcCommands")]
[DefaultValue (null)]
public
#if NET_2_0
new
#endif // NET_2_0
OdbcDataAdapter DataAdapter {
get {
return _adapter;
@@ -145,45 +135,6 @@ namespace System.Data.Odbc
}
}
#if ONLY_1_1
[BrowsableAttribute (false)]
[OdbcDescriptionAttribute ("The prefix string wrapped around sql objects")]
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
public string QuotePrefix {
get {
if (_quotePrefix == null)
return string.Empty;
return _quotePrefix;
}
set {
if (IsCommandGenerated)
throw new InvalidOperationException (
"QuotePrefix cannot be set after " +
"an Insert, Update or Delete command " +
"has been generated.");
_quotePrefix = value;
}
}
[BrowsableAttribute (false)]
[OdbcDescriptionAttribute ("The suffix string wrapped around sql objects")]
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
public string QuoteSuffix {
get {
if (_quoteSuffix == null)
return string.Empty;
return _quoteSuffix;
}
set {
if (IsCommandGenerated)
throw new InvalidOperationException (
"QuoteSuffix cannot be set after " +
"an Insert, Update or Delete command " +
"has been generated.");
_quoteSuffix = value;
}
}
#endif
#endregion // Properties
@@ -195,11 +146,7 @@ namespace System.Data.Odbc
throw new NotImplementedException ();
}
#if ONLY_1_1
protected override
#else
new
#endif
void Dispose (bool disposing)
{
if (_disposed)
@@ -285,11 +232,7 @@ namespace System.Data.Odbc
GetParameterName (++paramCount),
OdbcType.Int,
length,
#if NET_2_0
columnName,
#else
string.Empty,
#endif
DataRowVersion.Original);
nullParam.Value = 1;
AddParameter (command, GetParameterName (++paramCount),
@@ -353,27 +296,16 @@ namespace System.Data.Odbc
}
query = String.Format (
#if NET_2_0
"{0} ({1}) VALUES ({2})",
#else
"{0}( {1} ) VALUES ( {2} )",
#endif
query,
#if NET_2_0
String.Join (", ", columns, 0, count),
String.Join (", ", values, 0, count));
#else
String.Join (" , ", columns, 0, count),
String.Join (" , ", values, 0, count));
#endif
_insertCommand.CommandText = query;
return _insertCommand;
}
public
#if NET_2_0
new
#endif // NET_2_0
OdbcCommand GetInsertCommand ()
{
// FIXME: check validity of adapter
@@ -386,7 +318,6 @@ namespace System.Data.Odbc
return CreateInsertCommand (false);
}
#if NET_2_0
public new OdbcCommand GetInsertCommand (bool useColumnsForParameterNames)
{
// FIXME: check validity of adapter
@@ -398,7 +329,6 @@ namespace System.Data.Odbc
return CreateInsertCommand (useColumnsForParameterNames);
}
#endif // NET_2_0
private OdbcCommand CreateUpdateCommand (bool option)
{
@@ -432,26 +362,16 @@ namespace System.Data.Odbc
string whereClause = CreateOptWhereClause (_updateCommand, count);
query = String.Format (
#if NET_2_0
"{0} {1} WHERE ({2})",
#else
"{0} {1} WHERE ( {2} )",
#endif
query,
#if NET_2_0
String.Join (", ", setClause, 0, count),
#else
String.Join (" , ", setClause, 0, count),
#endif
whereClause);
_updateCommand.CommandText = query;
return _updateCommand;
}
public
#if NET_2_0
new
#endif // NET_2_0
OdbcCommand GetUpdateCommand ()
{
// FIXME: check validity of adapter
@@ -464,7 +384,6 @@ namespace System.Data.Odbc
return CreateUpdateCommand (false);
}
#if NET_2_0
public new OdbcCommand GetUpdateCommand (bool useColumnsForParameterNames)
{
// FIXME: check validity of adapter
@@ -476,27 +395,18 @@ namespace System.Data.Odbc
return CreateUpdateCommand (useColumnsForParameterNames);
}
#endif // NET_2_0
private OdbcCommand CreateDeleteCommand (bool option)
{
CreateNewCommand (ref _deleteCommand);
string query = String.Format (
#if NET_2_0
"DELETE FROM {0}",
#else
"DELETE FROM {0}",
#endif
GetQuotedString (TableName));
string whereClause = CreateOptWhereClause (_deleteCommand, 0);
query = String.Format (
#if NET_2_0
"{0} WHERE ({1})",
#else
"{0} WHERE ( {1} )",
#endif
query,
whereClause);
_deleteCommand.CommandText = query;
@@ -504,9 +414,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
new
#endif // NET_2_0
OdbcCommand GetDeleteCommand ()
{
// FIXME: check validity of adapter
@@ -519,7 +427,6 @@ namespace System.Data.Odbc
return CreateDeleteCommand (false);
}
#if NET_2_0
public new OdbcCommand GetDeleteCommand (bool useColumnsForParameterNames)
{
// FIXME: check validity of adapter
@@ -531,13 +438,8 @@ namespace System.Data.Odbc
return CreateDeleteCommand (useColumnsForParameterNames);
}
#endif // NET_2_0
#if ONLY_1_1
public
#else
new
#endif // NET_2_0
void RefreshSchema ()
{
// creates metadata
@@ -563,20 +465,13 @@ namespace System.Data.Odbc
_tableName = String.Empty;
}
#if NET_2_0
protected override
#endif
string GetParameterName (int parameterOrdinal)
{
#if NET_2_0
return String.Format ("p{0}", parameterOrdinal);
#else
return String.Format ("@p{0}", parameterOrdinal);
#endif
}
#if NET_2_0
protected override void ApplyParameterInfo (DbParameter parameter,
DataRow datarow,
StatementType statementType,
@@ -666,7 +561,6 @@ namespace System.Data.Odbc
sb.Remove (sb.Length - QuoteSuffix.Length, QuoteSuffix.Length );
return sb.ToString ();
}
#endif
private void OnRowUpdating (object sender, OdbcRowUpdatingEventArgs args)
{
@@ -708,12 +602,10 @@ namespace System.Data.Odbc
}
}
#if NET_2_0
string GetQuoteCharacter (OdbcConnection conn)
{
return conn.GetInfo (OdbcInfo.IdentifierQuoteChar);
}
#endif
#endregion // Methods
}

View File

@@ -37,18 +37,12 @@ using System.Data.Common;
using System.EnterpriseServices;
using System.Runtime.InteropServices;
using System.Text;
#if NET_2_0
using System.Transactions;
#endif
namespace System.Data.Odbc
{
[DefaultEvent ("InfoMessage")]
#if NET_2_0
public sealed class OdbcConnection : DbConnection, ICloneable
#else
public sealed class OdbcConnection : Component, ICloneable, IDbConnection
#endif //NET_2_0
{
#region Fields
@@ -97,9 +91,7 @@ namespace System.Data.Odbc
[EditorAttribute ("Microsoft.VSDesigner.Data.Odbc.Design.OdbcConnectionStringEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
[RecommendedAsConfigurableAttribute (true)]
public
#if NET_2_0
override
#endif
string ConnectionString {
get {
if (connectionString == null)
@@ -111,13 +103,9 @@ namespace System.Data.Odbc
[OdbcDescriptionAttribute ("Current connection timeout value, not settable in the ConnectionString")]
[DefaultValue (15)]
#if NET_2_0
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
#endif
public
#if NET_2_0
new
#endif // NET_2_0
int ConnectionTimeout {
get {
return connectionTimeout;
@@ -132,9 +120,7 @@ namespace System.Data.Odbc
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
[OdbcDescriptionAttribute ("Current data source Catlog value, 'Database=X' in the ConnectionString")]
public
#if NET_2_0
override
#endif // NET_2_0
string Database {
get {
if (State == ConnectionState.Closed)
@@ -147,9 +133,7 @@ namespace System.Data.Odbc
[OdbcDescriptionAttribute ("The ConnectionState indicating whether the connection is open or closed")]
[BrowsableAttribute (false)]
public
#if NET_2_0
override
#endif // NET_2_0
ConnectionState State {
get {
if (hdbc != IntPtr.Zero)
@@ -160,13 +144,9 @@ namespace System.Data.Odbc
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
[OdbcDescriptionAttribute ("Current data source, 'Server=X' in the ConnectionString")]
#if NET_2_0
[Browsable (false)]
#endif
public
#if NET_2_0
override
#endif // NET_2_0
string DataSource {
get {
if (State == ConnectionState.Closed)
@@ -175,9 +155,7 @@ namespace System.Data.Odbc
}
}
#if NET_2_0
[Browsable (false)]
#endif
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
[OdbcDescriptionAttribute ("Current ODBC Driver")]
public string Driver {
@@ -193,9 +171,7 @@ namespace System.Data.Odbc
[OdbcDescriptionAttribute ("Version of the product accessed by the ODBC Driver")]
[BrowsableAttribute (false)]
public
#if NET_2_0
override
#endif // NET_2_0
string ServerVersion {
get {
return GetInfo (OdbcInfo.DbmsVersion);
@@ -216,32 +192,20 @@ namespace System.Data.Odbc
#region Methods
public
#if NET_2_0
new
#endif // NET_2_0
OdbcTransaction BeginTransaction ()
{
return BeginTransaction (IsolationLevel.Unspecified);
}
#if ONLY_1_1
IDbTransaction IDbConnection.BeginTransaction ()
{
return (IDbTransaction) BeginTransaction ();
}
#endif // ONLY_1_1
#if NET_2_0
protected override DbTransaction BeginDbTransaction (IsolationLevel isolationLevel)
{
return BeginTransaction (isolationLevel);
}
#endif
public
#if NET_2_0
new
#endif // NET_2_0
OdbcTransaction BeginTransaction (IsolationLevel isolevel)
{
if (State == ConnectionState.Closed)
@@ -254,17 +218,9 @@ namespace System.Data.Odbc
throw new InvalidOperationException ();
}
#if ONLY_1_1
IDbTransaction IDbConnection.BeginTransaction (IsolationLevel isolevel)
{
return (IDbTransaction) BeginTransaction (isolevel);
}
#endif // ONLY_1_1
public
#if NET_2_0
override
#endif // NET_2_0
void Close ()
{
OdbcReturn ret = OdbcReturn.Error;
@@ -304,18 +260,14 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
new
#endif // NET_2_0
OdbcCommand CreateCommand ()
{
return new OdbcCommand (string.Empty, this, transaction);
}
public
#if NET_2_0
override
#endif // NET_2_0
void ChangeDatabase (string value)
{
IntPtr ptr = IntPtr.Zero;
@@ -353,24 +305,14 @@ namespace System.Data.Odbc
throw new NotImplementedException ();
}
#if ONLY_1_1
IDbCommand IDbConnection.CreateCommand ()
{
return (IDbCommand) CreateCommand ();
}
#endif //ONLY_1_1
#if NET_2_0
protected override DbCommand CreateDbCommand ()
{
return CreateCommand ();
}
#endif
public
#if NET_2_0
override
#endif // NET_2_0
void Open ()
{
if (State == ConnectionState.Open)
@@ -384,7 +326,7 @@ namespace System.Data.Odbc
ret = libodbc.SQLAllocHandle (OdbcHandleType.Env, IntPtr.Zero, ref henv);
if ((ret != OdbcReturn.Success) && (ret != OdbcReturn.SuccessWithInfo)) {
OdbcErrorCollection errors = new OdbcErrorCollection ();
errors.Add (new OdbcError (this));
errors.Add (new OdbcError (SafeDriver, "Error in " + SafeDriver, "", 1));
e = new OdbcException (errors);
MessageHandler (e);
throw e;
@@ -464,7 +406,6 @@ namespace System.Data.Odbc
henv = IntPtr.Zero;
}
#if NET_2_0
public override DataTable GetSchema ()
{
if (State == ConnectionState.Closed)
@@ -489,7 +430,6 @@ namespace System.Data.Odbc
{
throw new NotImplementedException ();
}
#endif
[MonoTODO]
public void EnlistDistributedTransaction (ITransaction transaction)
@@ -531,12 +471,7 @@ namespace System.Data.Odbc
private void RaiseStateChange (ConnectionState from, ConnectionState to)
{
#if ONLY_1_1
if (StateChange != null)
StateChange (this, new StateChangeEventArgs (from, to));
#else
base.OnStateChange (new StateChangeEventArgs (from, to));
#endif
}
private OdbcInfoMessageEventArgs CreateOdbcInfoMessageEvent (OdbcErrorCollection errors)
@@ -584,7 +519,7 @@ namespace System.Data.Odbc
string state = RemoveTrailingNullChar (Encoding.Unicode.GetString (buf_SqlState));
string message = Encoding.Unicode.GetString (buf_MsgText, 0, txtlen * 2);
errors.Add (new OdbcError (message, state, nativeerror));
errors.Add (new OdbcError (SafeDriver, message, state, nativeerror));
}
string source = SafeDriver;
@@ -632,11 +567,6 @@ namespace System.Data.Odbc
#region Events and Delegates
#if ONLY_1_1
[OdbcDescription ("DbConnection_StateChange")]
[OdbcCategory ("DataCategory_StateChange")]
public event StateChangeEventHandler StateChange;
#endif // ONLY_1_1
[OdbcDescription ("DbConnection_InfoMessage")]
[OdbcCategory ("DataCategory_InfoMessage")]

View File

@@ -1,219 +0,0 @@
//
// System.Data.Odbc.OdbcConnectionStringBuilder
//
// Authors:
// Nidhi Rawal (rawalnidhi_rawal@yahoo.com)
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.Odbc;
using System.Reflection;
using System.Text;
namespace System.Data.Odbc
{
[DefaultProperty ("Driver")]
[TypeConverter ("System.Data.Odbc.OdbcConnectionStringBuilder+OdbcConnectionStringBuilderConverter, " + Consts.AssemblySystem_Data)]
public sealed class OdbcConnectionStringBuilder : DbConnectionStringBuilder
{
#region Fields
string driver;
string dsn;
#endregion //Fields
#region Constructors
public OdbcConnectionStringBuilder () : base (true)
{
}
public OdbcConnectionStringBuilder (string connectionString) : base (true)
{
if (connectionString == null) {
base.ConnectionString = string.Empty;
return;
}
base.ConnectionString = connectionString;
}
#endregion // Constructors
#region Properties
public override Object this [string keyword] {
get {
if (keyword == null)
throw new ArgumentNullException ("keyword");
if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0)
return Driver;
if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0)
return Dsn;
return base [keyword];
}
set {
if (value == null) {
Remove (keyword);
return;
}
if (keyword == null)
throw new ArgumentNullException ("keyword");
string text_value = value.ToString ();
if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) {
Driver = text_value;
return;
} else if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) {
dsn = text_value;
} else if (value.ToString ().IndexOf (';') != -1) {
text_value = "{" + text_value + "}";
}
base [keyword] = value;
}
}
public override ICollection Keys {
get {
List<string> keys = new List<string> ();
keys.Add ("Dsn");
keys.Add ("Driver");
ICollection base_keys = base.Keys;
foreach (string keyword in base_keys) {
if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0)
continue;
if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0)
continue;
keys.Add (keyword);
}
string [] final = new string [keys.Count];
keys.CopyTo (final);
return final;
}
}
[DisplayName ("Driver")]
[RefreshProperties (RefreshProperties.All)]
public string Driver {
get {
if (driver == null)
return string.Empty;
return driver;
}
set {
if (value == null)
throw new ArgumentNullException ("Driver");
driver = value;
if (value.Length > 0) {
int startBrace = value.IndexOf ('{');
int endBrace = value.IndexOf ('}');
if (startBrace == -1 || endBrace == -1)
value = "{" + value + "}";
else if (startBrace > 0 || endBrace < (value.Length - 1))
value = "{" + value + "}";
}
base ["Driver"] = value;
}
}
[DisplayName ("Dsn")]
[RefreshProperties (RefreshProperties.All)]
public string Dsn {
get {
if (dsn == null)
return string.Empty;
return dsn;
}
set {
if (value == null)
throw new ArgumentNullException ("Dsn");
dsn = value;
base ["Dsn"] = dsn;
}
}
#endregion // Properties
#region Methods
public override bool ContainsKey (string keyword)
{
if (keyword == null)
throw new ArgumentNullException ("keyword");
if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0)
return true;
if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0)
return true;
return base.ContainsKey (keyword);
}
public override bool Remove (string keyword)
{
if (keyword == null)
throw new ArgumentNullException ("keyword");
if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0)
driver = string.Empty;
else if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0)
dsn = string.Empty;
return base.Remove (keyword);
}
public override void Clear ()
{
driver = null;
dsn = null;
base.Clear ();
}
public override bool TryGetValue (string keyword, out Object value)
{
if (keyword == null )
throw new ArgumentNullException ("keyword");
bool found = base.TryGetValue (keyword, out value);
if (found)
return found;
if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) {
value = string.Empty;
return true;
} else if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) {
value = string.Empty;
return true;
}
return false;
}
#endregion // Methods
}
}
#endif // NET_2_0 using

View File

@@ -47,9 +47,6 @@ namespace System.Data.Odbc
{
#region Fields
#if ONLY_1_1
bool disposed;
#endif
OdbcCommand deleteCommand;
OdbcCommand insertCommand;
OdbcCommand selectCommand;
@@ -153,19 +150,6 @@ namespace System.Data.Odbc
return new OdbcRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
}
#if ONLY_1_1
protected override void Dispose (bool disposing)
{
if (!disposed) {
if (disposing) {
// Release managed resources
}
// Release unmanaged resources
disposed = true;
}
base.Dispose (true);
}
#endif
protected override void OnRowUpdated (RowUpdatedEventArgs value)
{

View File

@@ -42,11 +42,7 @@ using System.Text;
namespace System.Data.Odbc
{
#if NET_2_0
public sealed class OdbcDataReader : DbDataReader
#else
public sealed class OdbcDataReader : MarshalByRefObject, IDataReader, IDisposable, IDataRecord, IEnumerable
#endif
{
#region Fields
@@ -95,9 +91,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
int Depth {
get {
return 0; // no nested selects supported
@@ -105,9 +99,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
int FieldCount {
get {
if (IsClosed)
@@ -117,9 +109,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
bool IsClosed {
get {
return !open;
@@ -127,9 +117,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
object this [string value] {
get {
int pos = GetOrdinal (value);
@@ -138,9 +126,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
object this [int i] {
get {
return GetValue (i);
@@ -148,9 +134,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
int RecordsAffected {
get {
return _recordsAffected;
@@ -159,9 +143,7 @@ namespace System.Data.Odbc
[MonoTODO]
public
#if NET_2_0
override
#endif // NET_2_0
bool HasRows {
get { throw new NotImplementedException(); }
}
@@ -227,9 +209,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
void Close ()
{
// FIXME : have to implement output parameter binding
@@ -242,35 +222,23 @@ namespace System.Data.Odbc
this.command.Connection.Close ();
}
#if ONLY_1_1
~OdbcDataReader ()
{
this.Dispose (false);
}
#endif
public
#if NET_2_0
override
#endif // NET_2_0
bool GetBoolean (int i)
{
return (bool) GetValue (i);
}
public
#if NET_2_0
override
#endif // NET_2_0
byte GetByte (int i)
{
return Convert.ToByte (GetValue (i));
}
public
#if NET_2_0
override
#endif // NET_2_0
long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
{
if (IsClosed)
@@ -340,9 +308,7 @@ namespace System.Data.Odbc
[MonoTODO]
public
#if NET_2_0
override
#endif // NET_2_0
char GetChar (int i)
{
throw new NotImplementedException ();
@@ -350,9 +316,7 @@ namespace System.Data.Odbc
[MonoTODO]
public
#if NET_2_0
override
#endif // NET_2_0
long GetChars (int i, long dataIndex, char[] buffer, int bufferIndex, int length)
{
if (IsClosed)
@@ -366,21 +330,14 @@ namespace System.Data.Odbc
[MonoTODO]
[EditorBrowsableAttribute (EditorBrowsableState.Never)]
#if ONLY_1_1
public
#endif
#if NET_2_0
new
#endif
IDataReader GetData (int i)
{
throw new NotImplementedException ();
}
public
#if NET_2_0
override
#endif // NET_2_0
string GetDataTypeName (int i)
{
if (IsClosed)
@@ -396,36 +353,28 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
DateTime GetDateTime (int i)
{
return (DateTime) GetValue (i);
}
public
#if NET_2_0
override
#endif // NET_2_0
decimal GetDecimal (int i)
{
return (decimal) GetValue (i);
}
public
#if NET_2_0
override
#endif // NET_2_0
double GetDouble (int i)
{
return (double) GetValue (i);
}
public
#if NET_2_0
override
#endif // NET_2_0
Type GetFieldType (int i)
{
if (IsClosed)
@@ -434,9 +383,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
float GetFloat (int i)
{
return (float) GetValue (i);
@@ -444,45 +391,35 @@ namespace System.Data.Odbc
[MonoTODO]
public
#if NET_2_0
override
#endif // NET_2_0
Guid GetGuid (int i)
{
throw new NotImplementedException ();
}
public
#if NET_2_0
override
#endif // NET_2_0
short GetInt16 (int i)
{
return (short) GetValue (i);
}
public
#if NET_2_0
override
#endif // NET_2_0
int GetInt32 (int i)
{
return (int) GetValue (i);
}
public
#if NET_2_0
override
#endif // NET_2_0
long GetInt64 (int i)
{
return (long) GetValue (i);
}
public
#if NET_2_0
override
#endif // NET_2_0
string GetName (int i)
{
if (IsClosed)
@@ -491,9 +428,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
int GetOrdinal (string value)
{
if (IsClosed)
@@ -509,9 +444,7 @@ namespace System.Data.Odbc
[MonoTODO]
public
#if NET_2_0
override
#endif // NET_2_0
DataTable GetSchemaTable ()
{
if (IsClosed)
@@ -632,9 +565,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
string GetString (int i)
{
object ret = GetValue (i);
@@ -652,9 +583,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
object GetValue (int i)
{
if (IsClosed)
@@ -861,9 +790,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
int GetValues (object [] values)
{
int numValues = 0;
@@ -893,29 +820,13 @@ namespace System.Data.Odbc
return numValues;
}
#if ONLY_1_1
void IDisposable.Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
IEnumerator IEnumerable.GetEnumerator ()
{
return new DbEnumerator (this);
}
#endif // ONLY_1_1
#if NET_2_0
public override IEnumerator GetEnumerator ()
{
return new DbEnumerator (this);
}
#endif
#if NET_2_0
protected override
#endif
void Dispose (bool disposing)
{
if (disposed)
@@ -933,9 +844,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
bool IsDBNull (int i)
{
return (GetValue (i) is DBNull);
@@ -945,9 +854,7 @@ namespace System.Data.Odbc
/// Move to the next result set.
/// </remarks>
public
#if NET_2_0
override
#endif // NET_2_0
bool NextResult ()
{
OdbcReturn ret = OdbcReturn.Success;
@@ -1138,9 +1045,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
bool Read ()
{
return NextRow ();

View File

@@ -1,104 +0,0 @@
//
// System.Data.Odbc.OdbcError
//
// Author:
// Brian Ritchie (brianlritchie@hotmail.com)
//
// Copyright (C) Brian Ritchie, 2002
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Text;
namespace System.Data.Odbc
{
[Serializable]
public sealed class OdbcError
{
readonly string _message;
string _source;
readonly string _state;
readonly int _nativeerror;
#region Constructors
internal OdbcError (OdbcConnection connection)
{
_nativeerror = 1;
_source = connection.SafeDriver;
_message = "Error in " + _source;
_state = string.Empty;
}
internal OdbcError (string message, string state, int nativeerror)
{
_message = message;
_state = state;
_nativeerror = nativeerror;
}
#endregion // Constructors
#region Properties
public string Message {
get { return _message; }
}
public int NativeError {
get { return _nativeerror; }
}
public string Source {
get { return _source; }
}
public string SQLState {
get { return _state; }
}
#endregion // Properties
#region methods
public override string ToString ()
{
return Message;
}
internal void SetSource (string source)
{
_source = source;
}
#endregion
}
}

View File

@@ -109,7 +109,6 @@ namespace System.Data.Odbc
return _items.GetEnumerator ();
}
#if NET_2_0
public void CopyTo (OdbcError [] array, int i)
{
if (array == null)
@@ -119,7 +118,6 @@ namespace System.Data.Odbc
throw new ArgumentOutOfRangeException ("index");
((OdbcError[]) (_items.ToArray ())).CopyTo (array, i);
}
#endif
#endregion // Methods
}

View File

@@ -42,11 +42,7 @@ using System.Text;
namespace System.Data.Odbc
{
[Serializable]
#if NET_2_0
public sealed class OdbcException : DbException
#else
public sealed class OdbcException : SystemException
#endif
{
OdbcErrorCollection odbcErrors;
@@ -68,13 +64,6 @@ namespace System.Data.Odbc
}
}
#if !NET_2_0
public override string Message {
get {
return base.Message;
}
}
#endif
private OdbcException (SerializationInfo si, StreamingContext sc) : base(si, sc)
{

View File

@@ -27,7 +27,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
#region Using Directives
using System;
@@ -116,4 +115,3 @@ namespace System.Data.Odbc
#endregion //Methods
}
}
#endif // NET_2_0

View File

@@ -27,7 +27,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
namespace System.Data.Odbc
{
@@ -45,4 +44,3 @@ namespace System.Data.Odbc
}
}
#endif

View File

@@ -27,7 +27,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
namespace System.Data.Odbc
{
@@ -41,4 +40,3 @@ namespace System.Data.Odbc
}
}
#endif

View File

@@ -41,17 +41,9 @@ using System.ComponentModel;
namespace System.Data.Odbc
{
#if NET_2_0
[TypeConverterAttribute ("System.Data.Odbc.OdbcParameter+OdbcParameterConverter, " + Consts.AssemblySystem_Data)]
#else
[TypeConverterAttribute (typeof (OdbcParameterConverter))]
#endif
public sealed class OdbcParameter :
#if NET_2_0
DbParameter,
#else
MarshalByRefObject,
#endif // NET_2_0
ICloneable, IDbDataParameter, IDataParameter
{
#region Fields
@@ -144,17 +136,10 @@ namespace System.Data.Odbc
set { container = value; }
}
#if ONLY_1_1
[BrowsableAttribute (false)]
[RefreshPropertiesAttribute (RefreshProperties.All)]
[DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility.Hidden)]
#endif
[OdbcCategory ("Data")]
[OdbcDescriptionAttribute ("The parameter generic type")]
public
#if NET_2_0
override
#endif
DbType DbType {
get { return _typeMap.DbType; }
set {
@@ -167,31 +152,17 @@ namespace System.Data.Odbc
[OdbcCategory ("Data")]
[OdbcDescriptionAttribute ("Input, output, or bidirectional parameter")]
#if NET_2_0
[RefreshPropertiesAttribute (RefreshProperties.All)]
#else
[DefaultValue (ParameterDirection.Input)]
#endif
public
#if NET_2_0
override
#endif
ParameterDirection Direction {
get { return direction; }
set { direction = value; }
}
#if ONLY_1_1
[BrowsableAttribute (false)]
[DesignOnlyAttribute (true)]
[EditorBrowsableAttribute (EditorBrowsableState.Advanced)]
[DefaultValue (false)]
#endif
[OdbcDescriptionAttribute ("A design-time property used for strongly typed code generation")]
public
#if NET_2_0
override
#endif
bool IsNullable {
get { return isNullable; }
set { isNullable = value; }
@@ -201,9 +172,7 @@ namespace System.Data.Odbc
[OdbcDescriptionAttribute ("The parameter native type")]
[RefreshPropertiesAttribute (RefreshProperties.All)]
[OdbcCategory ("Data")]
#if NET_2_0
[DbProviderSpecificTypeProperty (true)]
#endif
public OdbcType OdbcType {
get { return _typeMap.OdbcType; }
set {
@@ -215,13 +184,8 @@ namespace System.Data.Odbc
}
[OdbcDescription ("DataParameter_ParameterName")]
#if ONLY_1_1
[DefaultValue ("")]
#endif
public
#if NET_2_0
override
#endif
string ParameterName {
get { return name; }
set { name = value; }
@@ -245,13 +209,8 @@ namespace System.Data.Odbc
[OdbcDescription ("DbDataParameter_Size")]
[OdbcCategory ("DataCategory_Data")]
#if ONLY_1_1
[DefaultValue (0)]
#endif
public
#if NET_2_0
override
#endif
int Size {
get { return size; }
set { size = value; }
@@ -259,13 +218,8 @@ namespace System.Data.Odbc
[OdbcDescription ("DataParameter_SourceColumn")]
[OdbcCategory ("DataCategory_Data")]
#if ONLY_1_1
[DefaultValue ("")]
#endif
public
#if NET_2_0
override
#endif
string SourceColumn {
get { return sourceColumn; }
set { sourceColumn = value; }
@@ -273,13 +227,8 @@ namespace System.Data.Odbc
[OdbcDescription ("DataParameter_SourceVersion")]
[OdbcCategory ("DataCategory_Data")]
#if ONLY_1_1
[DefaultValue ("Current")]
#endif
public
#if NET_2_0
override
#endif
DataRowVersion SourceVersion {
get { return sourceVersion; }
set { sourceVersion = value; }
@@ -288,15 +237,9 @@ namespace System.Data.Odbc
[TypeConverter (typeof(StringConverter))]
[OdbcDescription ("DataParameter_Value")]
[OdbcCategory ("DataCategory_Data")]
#if ONLY_1_1
[DefaultValue (null)]
#else
[RefreshPropertiesAttribute (RefreshProperties.All)]
#endif
public
#if NET_2_0
override
#endif
object Value {
get { return _value; }
set { _value = value; }
@@ -528,7 +471,6 @@ namespace System.Data.Odbc
throw new ArgumentException ("Unsupported Native Type!");
}
#if NET_2_0
public override bool SourceColumnNullMapping {
get { return false; }
set { }
@@ -543,7 +485,6 @@ namespace System.Data.Odbc
{
_typeMap = OdbcTypeConverter.GetTypeMap (OdbcType.NVarChar);
}
#endif
#endregion
}

View File

@@ -42,12 +42,7 @@ namespace System.Data.Odbc
{
[ListBindable (false)]
[EditorAttribute ("Microsoft.VSDesigner.Data.Design.DBParametersEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )]
#if NET_2_0
public sealed class OdbcParameterCollection : DbParameterCollection
#else
public sealed class OdbcParameterCollection : MarshalByRefObject,
IDataParameterCollection, IList, ICollection, IEnumerable
#endif // NET_2_0
{
#region Fields
@@ -66,14 +61,8 @@ namespace System.Data.Odbc
#region Properties
#if ONLY_1_1
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
#endif
public
#if NET_2_0
override
#endif
int Count {
get { return list.Count; }
}
@@ -101,66 +90,30 @@ namespace System.Data.Odbc
}
}
#if ONLY_1_1
bool IList.IsFixedSize {
#else
public override bool IsFixedSize {
#endif
get { return false; }
}
#if ONLY_1_1
bool IList.IsReadOnly {
#else
public override bool IsReadOnly {
#endif
get { return false; }
}
#if ONLY_1_1
bool ICollection.IsSynchronized {
#else
public override bool IsSynchronized {
#endif
get { return list.IsSynchronized; }
}
#if ONLY_1_1
object ICollection.SyncRoot {
#else
public override object SyncRoot {
#endif
get { return list.SyncRoot; }
}
#if ONLY_1_1
object IList.this [int index] {
get { return list [index]; }
set { list [index] = value; }
}
object IDataParameterCollection.this [string index]
{
get { return this [index]; }
set {
if (!(value is OdbcParameter))
throw new InvalidCastException ("Only OdbcParameter objects can be used.");
this [index] = (OdbcParameter) value;
}
}
#endif // ONLY_1_1
#endregion // Properties
#region Methods
#if NET_2_0
[EditorBrowsableAttribute (EditorBrowsableState.Never)]
#endif
public
#if NET_2_0
override
#endif
int Add (object value)
{
if (!(value is OdbcParameter))
@@ -184,10 +137,8 @@ namespace System.Data.Odbc
return value;
}
#if NET_2_0
[EditorBrowsableAttribute (EditorBrowsableState.Never)]
[Obsolete ("Add(String parameterName, Object value) has been deprecated. Use AddWithValue(String parameterName, Object value).")]
#endif
public OdbcParameter Add (string parameterName, object value)
{
return Add (new OdbcParameter (parameterName, value));
@@ -211,9 +162,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif
void Clear()
{
foreach (OdbcParameter p in list)
@@ -222,9 +171,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
bool Contains (object value)
{
if (value == null)
@@ -236,9 +183,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
bool Contains (string value)
{
if (value == null || value.Length == 0)
@@ -252,27 +197,21 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
void CopyTo (Array array, int index)
{
list.CopyTo (array, index);
}
public
#if NET_2_0
override
#endif // NET_2_0
IEnumerator GetEnumerator()
{
return list.GetEnumerator ();
}
public
#if NET_2_0
override
#endif // NET_2_0
int IndexOf (object value)
{
if (value == null)
@@ -283,9 +222,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
int IndexOf (string parameterName)
{
if (parameterName == null || parameterName.Length == 0)
@@ -298,9 +235,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
void Insert (int index, object value)
{
if (value == null)
@@ -311,9 +246,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
void Remove (object value)
{
if (value == null)
@@ -324,9 +257,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
void RemoveAt (int index)
{
if (index >= list.Count || index < 0)
@@ -336,15 +267,12 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif // NET_2_0
void RemoveAt (string parameterName)
{
RemoveAt (IndexOf (parameterName));
}
#if NET_2_0
protected override DbParameter GetParameter (string parameterName)
{
return this [parameterName];
@@ -438,7 +366,6 @@ namespace System.Data.Odbc
{
list.CopyTo (array, index);
}
#endif
#endregion // Methods
}

View File

@@ -1,87 +0,0 @@
//
// System.Data.Odbc.OdbcPermission
//
// Authors:
// Umadevi S (sumadevi@novell.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Data.Common;
using System.Security;
using System.Security.Permissions;
namespace System.Data.Odbc
{
[Serializable]
public sealed class OdbcPermission : DBDataPermission
{
#region Constructors
[Obsolete ("use OdbcPermission(PermissionState.None)", true)]
public OdbcPermission ()
: base (PermissionState.None)
{
}
public OdbcPermission (PermissionState state)
: base (state)
{
}
[Obsolete ("use OdbcPermission(PermissionState.None)", true)]
public OdbcPermission (PermissionState state, bool allowBlankPassword)
: base (state)
{
AllowBlankPassword = allowBlankPassword;
}
// required for Copy method
internal OdbcPermission (DBDataPermission permission)
: base (permission)
{
}
// easier (and common) permission creation from attribute class
internal OdbcPermission (DBDataPermissionAttribute attribute)
: base (attribute)
{
}
#endregion
#region Methods
public override IPermission Copy ()
{
return new OdbcPermission (this);
}
public override void Add (string connectionString, string restrictions, KeyRestrictionBehavior behavior)
{
base.Add (connectionString, restrictions, behavior);
}
#endregion
}
}

View File

@@ -1,64 +0,0 @@
//
// System.Data.Odbc.OdbcPermissionAttribute
//
// Authors:
// Umadevi S (sumadevi@novell.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Data.Common;
using System.Security;
using System.Security.Permissions;
namespace System.Data.Odbc {
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class |
AttributeTargets.Struct | AttributeTargets.Constructor |
AttributeTargets.Method, AllowMultiple=true,
Inherited=false)]
[Serializable]
public sealed class OdbcPermissionAttribute : DBDataPermissionAttribute {
#region Constructors
public OdbcPermissionAttribute (SecurityAction action)
: base (action)
{
}
#endregion
#region Properties
#endregion
#region Methods
public override IPermission CreatePermission ()
{
return new OdbcPermission (this);
}
#endregion
}
}

View File

@@ -56,13 +56,11 @@ namespace System.Data.Odbc {
set { base.Command = value; }
}
#if NET_2_0
protected override IDbCommand BaseCommand {
get { return base.Command; }
set { base.Command = value; }
}
#endif
#endregion // Properties
}

View File

@@ -34,11 +34,7 @@ using System.Globalization;
namespace System.Data.Odbc
{
#if NET_2_0
public sealed class OdbcTransaction : DbTransaction, IDisposable
#else
public sealed class OdbcTransaction : MarshalByRefObject, IDbTransaction
#endif
{
private bool disposed;
private OdbcConnection connection;
@@ -65,7 +61,6 @@ namespace System.Data.Odbc
case IsolationLevel.Serializable:
lev = OdbcIsolationLevel.Serializable;
break;
#if NET_2_0
case IsolationLevel.Snapshot:
// badly broken on MS:
// https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=305736
@@ -81,13 +76,11 @@ namespace System.Data.Odbc
// http://msdn2.microsoft.com/en-us/library/ms131709.aspx
attr = OdbcConnectionAttribute.CoptTransactionIsolation;
break;
#endif
case IsolationLevel.Unspecified:
// when isolationlevel is not specified, then use
// default isolation level of the driver and
// lazy initialize it in the IsolationLevel property
break;
#if NET_2_0
case IsolationLevel.Chaos:
throw new ArgumentOutOfRangeException ("IsolationLevel",
string.Format (CultureInfo.CurrentCulture,
@@ -95,19 +88,11 @@ namespace System.Data.Odbc
"value, {0}, is not supported by " +
"the .Net Framework Odbc Data " +
"Provider.", (int) isolationlevel));
#endif
default:
#if NET_2_0
throw new ArgumentOutOfRangeException ("IsolationLevel",
string.Format (CultureInfo.CurrentCulture,
"The IsolationLevel enumeration value, {0}, is invalid.",
(int) isolationlevel));
#else
throw new ArgumentException (string.Format (
CultureInfo.InvariantCulture,
"Not supported isolationlevel - {0}",
isolationlevel));
#endif
}
// only change isolation level if it was explictly set
@@ -163,26 +148,16 @@ namespace System.Data.Odbc
case OdbcIsolationLevel.Serializable:
isoLevel = IsolationLevel.Serializable;
break;
#if NET_2_0
case OdbcIsolationLevel.Snapshot:
isoLevel = IsolationLevel.Snapshot;
break;
#else
default:
throw new NotSupportedException (string.Format (
CultureInfo.InvariantCulture,
"Isolation level {0} is not supported.",
odbcLevel));
#endif
}
return isoLevel;
}
#region Implementation of IDisposable
#if NET_2_0
protected override
#endif
void Dispose (bool disposing)
{
if (!disposed) {
@@ -203,9 +178,7 @@ namespace System.Data.Odbc
#region Implementation of IDbTransaction
public
#if NET_2_0
override
#endif //NET_2_0
void Commit ()
{
if (!isOpen)
@@ -224,9 +197,7 @@ namespace System.Data.Odbc
}
public
#if NET_2_0
override
#endif //NET_2_0
void Rollback()
{
if (!isOpen)
@@ -244,25 +215,14 @@ namespace System.Data.Odbc
throw new InvalidOperationException ();
}
#if NET_2_0
protected override DbConnection DbConnection {
get {
return Connection;
}
}
#else
IDbConnection IDbTransaction.Connection {
get {
return Connection;
}
}
#endif
public
#if NET_2_0
override
#endif
IsolationLevel IsolationLevel {
get {
if (!isOpen)

View File

@@ -66,9 +66,7 @@ namespace System.Data.Odbc
AutoCommit = 102,
TransactionIsolation = 108,
CurrentCatalog = 109,
#if NET_2_0
CoptTransactionIsolation = 1227 /* SQL_COPT_SS_TXN_ISOLATION */
#endif
}
internal enum OdbcInfo : ushort