+2002-07-09 Tim Coleman <tim@timcoleman.com>
+ * OleDbCommand.cs: Style changes, added new methods
+ * OleDbConnection.cs: Style changes, added new methods
+ * OleDbDataAdapter.cs: Implementation
+ * OleDbDataReader.cs: Added stubbs
+ * OleDbErrorCollection.cs: Added stubbs, some implementation
+ * OleDbParameter.cs: Style changes, added new methods
+ * OleDbParameterCollection.cs: Style changes, added new methods
+ * OleDbPermissionAttribute.cs: Style changes, added new methods
+ * OleDbRowUpdatedEventArgs.cs: Added stubbs
+ * OleDbRowUpdatingEventArgs.cs: Added stubbs
+ * OleDbTransaction.cs: Style changes, added new methods
+ * OleDbType.cs: Fixed two typos
+ * libgda.cs: Style changes, added new methods
+
+
2002-06-03 Rodrigo Moya <rodrigo@ximian.com>
* OleDbParameterCollection.cs (GetEnumerator, SyncRoot,
//
// System.Data.OleDb.OleDbCommand
//
-// Author:
+// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.ComponentModel;
using System.Data;
using System.Data.Common;
+using System.Collections;
namespace System.Data.OleDb
{
/// </summary>
public sealed class OleDbCommand : Component, ICloneable, IDbCommand
{
- private string m_command_string = null;
- private OleDbConnection m_connection = null;
- private OleDbTransaction m_transaction = null;
- private int m_timeout = 30; // 30 is the default, as per .NET docs
- private CommandType m_type = CommandType.Text;
- private OleDbParameterCollection m_parameters;
-
- /*
- * Constructors
- */
-
+ #region Fields
+
+ string commandText;
+ int timeout;
+ CommandType commandType;
+ OleDbConnection connection;
+ OleDbParameterCollection parameters;
+ OleDbTransaction transaction;
+ bool designTimeVisible;
+ OleDbDataReader dataReader;
+ CommandBehavior behavior;
+ ArrayList gdaCommands;
+ ArrayList gdaResults;
+
+ #endregion // Fields
+
+ #region Constructors
+
public OleDbCommand ()
{
- m_parameters = new OleDbParameterCollection ();
+ commandText = String.Empty;
+ timeout = 30; // default timeout per .NET
+ commandType = CommandType.Text;
+ connection = null;
+ parameters = new OleDbParameterCollection ();
+ transaction = null;
+ designTimeVisible = false;
+ dataReader = null;
+ behavior = CommandBehavior.Default;
+ gdaCommands = new ArrayList ();
+ gdaResults = new ArrayList ();
}
- public OleDbCommand (string s) : this ()
+ public OleDbCommand (string cmdText)
+ : this ()
{
- m_command_string = s;
+ CommandText = cmdText;
}
- public OleDbCommand (string s, OleDbConnection cnc) : this ()
+ public OleDbCommand (string cmdText, OleDbConnection connection)
+ : this (cmdText)
{
- m_command_string = s;
- m_connection = cnc;
+ Connection = connection;
}
- public OleDbCommand (string s,
- OleDbConnection cnc,
- OleDbTransaction xtrans) : this ()
+ public OleDbCommand (string cmdText, OleDbConnection connection, OleDbTransaction transaction)
+ : this (cmdText, connection)
{
- m_command_string = s;
- m_connection = cnc;
- m_transaction = xtrans;
+ this.transaction = transaction;
}
- /*
- * Properties
- */
-
- string IDbCommand.CommandText
+ #endregion // Constructors
+
+ #region Properties
+
+ public string CommandText
{
- get {
- return m_command_string;
- }
- set {
- m_command_string = value;
+ get { return commandText; }
+ set {
+ string[] queries = value.Split (new Char[] {';'});
+ gdaCommands.Clear ();
+
+ foreach (string query in queries)
+ gdaCommands.Add (libgda.gda_command_new (query, 0, 0));
+
+ commandText = value;
}
}
- int IDbCommand.CommandTimeout
- {
- get {
- return m_timeout;
- }
- set {
- m_timeout = value;
- }
+ public int CommandTimeout {
+ get { return timeout; }
+ set { timeout = value; }
}
- CommandType IDbCommand.CommandType
- {
- get {
- return m_type;
- }
- set {
- m_type = value;
- }
+ public CommandType CommandType {
+ get { return commandType; }
+ set { commandType = value; }
}
- IDbConnection IDbCommand.Connection
- {
- get {
- return m_connection;
- }
- set {
- m_connection = (OleDbConnection) value;
- }
+ public OleDbConnection Connection {
+ get { return connection; }
+ set { connection = value; }
}
- public bool DesignTimeVisible
- {
- [MonoTODO]
- get {
- throw new NotImplementedException ();
- }
- [MonoTODO]
- set {
- throw new NotImplementedException ();
- }
+ public bool DesignTimeVisible {
+ get { return designTimeVisible; }
+ set { designTimeVisible = value; }
}
- IDataParameterCollection IDbCommand.Parameters
- {
- get {
- return m_parameters;
- }
+ public OleDbParameterCollection Parameters {
+ get { return parameters; }
+ set { parameters = value; }
}
- IDbTransaction IDbCommand.Transaction
- {
- get {
- return m_transaction;
- }
- set {
- m_transaction = (OleDbTransaction) value;
- }
+ public OleDbTransaction Transaction {
+ get { return transaction; }
+ set { transaction = value; }
}
- UpdateRowSource IDbCommand.UpdatedRowSource
- {
+ public UpdateRowSource UpdatedRowSource {
[MonoTODO]
- get {
- throw new NotImplementedException ();
- }
+ get { throw new NotImplementedException (); }
[MonoTODO]
- set {
- throw new NotImplementedException ();
- }
+ set { throw new NotImplementedException (); }
+ }
+
+ IDbConnection IDbCommand.Connection {
+ get { return Connection; }
+ set { Connection = (OleDbConnection) value; }
+ }
+
+ IDataParameterCollection IDbCommand.Parameters {
+ get { return Parameters; }
+ }
+
+ IDbTransaction IDbCommand.Transaction {
+ get { return Transaction; }
+ set { Transaction = (OleDbTransaction) value; }
}
- /*
- * Methods
- */
-
+ internal ArrayList GdaResults {
+ get { return gdaResults; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
[MonoTODO]
- void IDbCommand.Cancel ()
+ public void Cancel ()
{
throw new NotImplementedException ();
}
+ public OleDbParameter CreateParameter ()
+ {
+ return new OleDbParameter ();
+ }
+
[MonoTODO]
- object ICloneable.Clone ()
+ protected override void Dispose (bool disposing)
{
throw new NotImplementedException ();
}
-
- IDbDataParameter IDbCommand.CreateParameter ()
+
+ public int ExecuteNonQuery ()
{
- return new OleDbParameter ();
+ if (connection == null)
+ throw new InvalidOperationException ();
+ if (connection.State == ConnectionState.Closed)
+ throw new InvalidOperationException ();
+ // FIXME: a third check is mentioned in .NET docs
+
+ IntPtr gdaConnection = connection.GdaConnection;
+ IntPtr gdaParameterList = parameters.GdaParameterList;
+
+ return libgda.gda_connection_execute_non_query (gdaConnection, (IntPtr) gdaCommands[0], gdaParameterList);
}
-
- int IDbCommand.ExecuteNonQuery ()
+ public OleDbDataReader ExecuteReader ()
{
- if (m_command_string == null)
- return -1;
+ return ExecuteReader (CommandBehavior.Default);
+ }
- // FIXME
- return 0;
+ public OleDbDataReader ExecuteReader (CommandBehavior behavior)
+ {
+ if (connection.State != ConnectionState.Open)
+ throw new InvalidOperationException ();
+
+ this.behavior = behavior;
+
+ IntPtr gdaConnection = connection.GdaConnection;
+ IntPtr gdaParameterList = parameters.GdaParameterList;
+
+ foreach (IntPtr gdaCommand in gdaCommands)
+ GdaResults.Add (libgda.gda_connection_execute_single_command (gdaConnection, gdaCommand, gdaParameterList));
+
+ dataReader = new OleDbDataReader (this);
+
+ dataReader.NextResult ();
+
+ return dataReader;
+ }
+
+ [MonoTODO]
+ public object ExecuteScalar ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ object ICloneable.Clone ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ IDbDataParameter IDbCommand.CreateParameter ()
+ {
+ throw new NotImplementedException ();
}
[MonoTODO]
IDataReader IDbCommand.ExecuteReader ()
{
- throw new NotImplementedException ();
+ throw new NotImplementedException ();
}
[MonoTODO]
IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
{
- throw new NotImplementedException ();
+ throw new NotImplementedException ();
}
-
+
[MonoTODO]
- object IDbCommand.ExecuteScalar ()
+ public void Prepare ()
{
- throw new NotImplementedException ();
+ throw new NotImplementedException ();
}
- void IDbCommand.Prepare ()
+ public void ResetCommandTimeout ()
{
- // FIXME: prepare string with parameters
+ timeout = 30;
}
- public void ResetCommandTimeout ()
+ #endregion
+
+ #region Internal Methods
+
+ // only meant to be used between OleDbConnectioin,
+ // OleDbCommand, and OleDbDataReader
+ internal void OpenReader (OleDbDataReader reader)
{
- m_timeout = 30;
+ connection.OpenReader (reader);
}
+
+ #endregion
+
}
}
//
// System.Data.OleDb.OleDbConnection
//
-// Author:
+// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.ComponentModel;
using System.Data;
using System.Data.Common;
-using System.Exception;
namespace System.Data.OleDb
{
public sealed class OleDbConnection : Component, ICloneable, IDbConnection
{
- private IntPtr m_gdaConnection = IntPtr.Zero;
- private string m_string = "";
- private int m_timeout = 15; // default is 15 seconds
+ #region Fields
- /*
- * Constructors
- */
+ string connectionString;
+ int connectionTimeout = 15;
+ OleDbDataReader dataReader;
+ bool dataReaderOpen;
+
+ IntPtr gdaConnection = IntPtr.Zero;
+
+ #endregion
+
+ #region Constructors
public OleDbConnection ()
{
}
- /*
- * Properties
- */
-
- public OleDbConnection (string cnc_string) : this ()
+ public OleDbConnection (string connectionString)
+ : this ()
{
- m_string = cnc_string;
+ this.connectionString = connectionString;
}
- string IDbConnection.ConnectionString
- {
- get {
- return m_string;
- }
- set {
- m_string = value;
- }
+ #endregion // Constructors
+
+ #region Properties
+
+ public string ConnectionString {
+ get { return connectionString; }
+ set { connectionString = value; }
}
- int IDbConnection.ConnectionTimeout
- {
- get {
- return m_timeout;
- }
+ public int ConnectionTimeout {
+ get { return connectionTimeout; }
}
- string IDbConnection.Database
- {
+ public string Database {
get {
- if (m_gdaConnection != IntPtr.Zero
- && libgda.gda_connection_is_open (m_gdaConnection)) {
- return libgda.gda_connection_get_database (m_gdaConnection);
+ if (gdaConnection != IntPtr.Zero && libgda.gda_connection_is_open (gdaConnection)) {
+ return libgda.gda_connection_get_database (gdaConnection);
}
return null;
}
}
- public string DataSource
- {
+ public string DataSource {
[MonoTODO]
get {
throw new NotImplementedException ();
}
}
- public string Provider
- {
+ public string Provider {
get {
- if (m_gdaConnection != IntPtr.Zero
- && libgda.gda_connection_is_open (m_gdaConnection)) {
- return libgda.gda_connection_get_provider (m_gdaConnection);
+ if (gdaConnection != IntPtr.Zero && libgda.gda_connection_is_open (gdaConnection)) {
+ return libgda.gda_connection_get_provider (gdaConnection);
}
return null;
}
}
- public string ServerVersion
- {
+ public string ServerVersion {
[MonoTODO]
- get {
- throw new NotImplementedException ();
- }
+ get { throw new NotImplementedException (); }
}
- ConnectionState IDbConnection.State
+ public ConnectionState State
{
get {
- if (m_gdaConnection != IntPtr.Zero) {
- if (libgda.gda_connection_is_open (m_gdaConnection))
+ if (gdaConnection != IntPtr.Zero) {
+ if (libgda.gda_connection_is_open (gdaConnection))
return ConnectionState.Open;
}
internal IntPtr GdaConnection
{
- get {
- return m_gdaConnection;
- }
+ get { return gdaConnection; }
}
-
- /*
- * Methods
- */
-
- IDbTransaction IDbConnection.BeginTransaction ()
+
+ #endregion // Properties
+
+ #region Methods
+
+ public OleDbTransaction BeginTransaction ()
{
- if (m_gdaConnection != IntPtr.Zero)
+ if (gdaConnection != IntPtr.Zero)
return new OleDbTransaction (this);
return null;
}
- IDbTransaction IDbConnection.BeginTransaction (IsolationLevel level)
+ public OleDbTransaction BeginTransaction (IsolationLevel level)
{
- if (m_gdaConnection != IntPtr.Zero)
+ if (gdaConnection != IntPtr.Zero)
return new OleDbTransaction (this, level);
return null;
}
- void IDbConnection.ChangeDatabase (string name)
+ public void ChangeDatabase (string name)
{
// FIXME: see http://bugzilla.gnome.org/show_bug.cgi?id=83315
}
+ public void Close ()
+ {
+ if (gdaConnection != IntPtr.Zero) {
+ libgda.gda_connection_close (gdaConnection);
+ gdaConnection = IntPtr.Zero;
+ }
+ }
+
+ public OleDbCommand CreateCommand ()
+ {
+ if (gdaConnection != IntPtr.Zero && libgda.gda_connection_is_open (gdaConnection))
+ return new OleDbCommand ();
+
+ return null;
+ }
+
+ [MonoTODO]
+ protected override void Dispose (bool disposing)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable GetOleDbSchemaTable (Guid schema, object[] restrictions)
+ {
+ throw new NotImplementedException ();
+ }
+
[MonoTODO]
object ICloneable.Clone ()
{
throw new NotImplementedException();
}
-
- void IDbConnection.Close ()
+
+ [MonoTODO]
+ IDbTransaction IDbConnection.BeginTransaction ()
{
- if (m_gdaConnection != IntPtr.Zero) {
- libgda.gda_connection_close (m_gdaConnection);
- m_gdaConnection = IntPtr.Zero;
- }
+ throw new NotImplementedException ();
}
- IDbCommand IDbConnection.CreateCommand ()
+ [MonoTODO]
+ IDbTransaction IDbConnection.BeginTransaction (IsolationLevel level)
{
- if (m_gdaConnection != IntPtr.Zero
- && libgda.gda_connection_is_open (m_gdaConnection)) {
- return new OleDbCommand ();
- }
-
- return null;
+ throw new NotImplementedException ();
}
[MonoTODO]
- public DataTable GetOleDbSchemaTable (Guid schema,
- object[] restrictions)
+ IDbCommand IDbConnection.CreateCommand ()
{
throw new NotImplementedException ();
}
- void IDbConnection.Open ()
+ public void Open ()
{
- if (m_gdaConnection != IntPtr.Zero ||
- libgda.gda_connection_is_open (m_gdaConnection))
+ if (gdaConnection != IntPtr.Zero || libgda.gda_connection_is_open (gdaConnection))
throw new InvalidOperationException ();
- m_gdaConnection = libgda.gda_client_open_connection (
- libgda.GdaClient,
- m_string,
- "", "");
+ gdaConnection = libgda.gda_client_open_connection (libgda.GdaClient, connectionString, "", "");
}
- /*
- * Events
- */
-
+ [MonoTODO]
+ public static void ReleaseObjectPool ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Internal Methods
+
+ // Used to prevent OleDbConnection
+ // from doing anything while
+ // OleDbDataReader is open.
+ // Open the Reader. (called from OleDbCommand)
+ internal void OpenReader(OleDbDataReader reader)
+ {
+ if(dataReaderOpen == true) {
+ // TODO: throw exception here?
+ // because a reader
+ // is already open
+ }
+ else {
+ dataReader = reader;
+ dataReaderOpen = true;
+ }
+ }
+
+
+ #endregion
+
+ #region Events and Delegates
+
public event OleDbInfoMessageEventHandler InfoMessage;
public event StateChangeEventHandler StateChange;
+
+ #endregion
}
}
//
// System.Data.OleDb.OleDbDataAdapter
//
-// Author:
+// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
+using System;
+using System.ComponentModel;
using System.Data;
using System.Data.Common;
{
public sealed class OleDbDataAdapter : DbDataAdapter, IDbDataAdapter
{
+ #region Fields
+
+ OleDbCommand deleteCommand;
+ OleDbCommand insertCommand;
+ OleDbCommand selectCommand;
+ OleDbCommand updateCommand;
+
+ static readonly object EventRowUpdated = new object ();
+ static readonly object EventRowUpdating = new object ();
+
+ #endregion
+
+ #region Constructors
+
+ public OleDbDataAdapter ()
+ : this (new OleDbCommand ())
+ {
+ }
+
+ public OleDbDataAdapter (OleDbCommand selectCommand)
+ {
+ DeleteCommand = new OleDbCommand ();
+ InsertCommand = new OleDbCommand ();
+ SelectCommand = selectCommand;
+ UpdateCommand = new OleDbCommand ();
+ }
+
+ public OleDbDataAdapter (string selectCommandText, OleDbConnection selectConnection)
+ : this (new OleDbCommand (selectCommandText, selectConnection))
+ {
+ }
+
+ public OleDbDataAdapter (string selectCommandText, string selectConnectionString)
+ : this (selectCommandText, new OleDbConnection (selectConnectionString))
+ {
+ }
+
+ #endregion // Fields
+
+ #region Properties
+
+ public new OleDbCommand DeleteCommand {
+ get { return deleteCommand; }
+ set { deleteCommand = value; }
+ }
+
+ public new OleDbCommand InsertCommand {
+ get { return insertCommand; }
+ set { insertCommand = value; }
+ }
+
+ public new OleDbCommand SelectCommand {
+ get { return selectCommand; }
+ set { selectCommand = value; }
+ }
+
+ public new OleDbCommand UpdateCommand {
+ get { return updateCommand; }
+ set { updateCommand = value; }
+ }
+
+ IDbCommand IDbDataAdapter.DeleteCommand {
+ get { return DeleteCommand; }
+ set {
+ if (!(value is OleDbCommand))
+ throw new ArgumentException ();
+ DeleteCommand = (OleDbCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.InsertCommand {
+ get { return InsertCommand; }
+ set {
+ if (!(value is OleDbCommand))
+ throw new ArgumentException ();
+ InsertCommand = (OleDbCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.SelectCommand {
+ get { return SelectCommand; }
+ set {
+ if (!(value is OleDbCommand))
+ throw new ArgumentException ();
+ SelectCommand = (OleDbCommand)value;
+ }
+ }
+
+ IDbCommand IDbDataAdapter.UpdateCommand {
+ get { return UpdateCommand; }
+ set {
+ if (!(value is OleDbCommand))
+ throw new ArgumentException ();
+ UpdateCommand = (OleDbCommand)value;
+ }
+ }
+
+ ITableMappingCollection IDataAdapter.TableMappings {
+ get { return TableMappings; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ protected override RowUpdatedEventArgs CreateRowUpdatedEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new OleDbRowUpdatedEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+ protected override RowUpdatingEventArgs CreateRowUpdatingEvent (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ {
+ return new OleDbRowUpdatingEventArgs (dataRow, command, statementType, tableMapping);
+ }
+
+ protected override void OnRowUpdated (RowUpdatedEventArgs value)
+ {
+ OleDbRowUpdatedEventHandler handler = (OleDbRowUpdatedEventHandler) Events[EventRowUpdated];
+ if ((handler != null) && (value is OleDbRowUpdatedEventArgs))
+ handler (this, (OleDbRowUpdatedEventArgs) value);
+ }
+
+ protected override void OnRowUpdating (RowUpdatingEventArgs value)
+ {
+ OleDbRowUpdatingEventHandler handler = (OleDbRowUpdatingEventHandler) Events[EventRowUpdated];
+ if ((handler != null) && (value is OleDbRowUpdatingEventArgs))
+ handler (this, (OleDbRowUpdatingEventArgs) value);
+ }
+
+ #endregion // Methods
+
+ #region Events and Delegates
+
+ public event OleDbRowUpdatedEventHandler RowUpdated {
+ add { Events.AddHandler (EventRowUpdated, value); }
+ remove { Events.RemoveHandler (EventRowUpdated, value); }
+ }
+
+ public event OleDbRowUpdatedEventHandler RowUpdating {
+ add { Events.AddHandler (EventRowUpdating, value); }
+ remove { Events.RemoveHandler (EventRowUpdating, value); }
+ }
+
+ #endregion // Events and Delegates
+
}
}
//
// Author:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.Collections;
namespace System.Data.OleDb
{
- public sealed class OleDbDataReader : MarshalByRefObject,
- IDataReader, IDisposable, IDataRecord, IEnumerable
+ public sealed class OleDbDataReader : MarshalByRefObject, IDataReader, IDisposable, IDataRecord, IEnumerable
{
+ #region Fields
+
+ OleDbCommand command;
+ bool open;
+
+ #endregion
+
+ #region Constructors
+
+ internal OleDbDataReader (OleDbCommand command)
+ {
+ this.command = command;
+ open = true;
+ command.OpenReader(this);
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int Depth {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public int FieldCount {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public bool IsClosed {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public object this[string name] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public object this[int index] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ public int RecordsAffected {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public void Close ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ ~OleDbDataReader ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool GetBoolean (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public byte GetByte (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetBytes (int ordinal, long dataIndex, byte[] buffer, int bufferIndex, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public char GetChar (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetChars (int ordinal, long dataIndex, char[] buffer, int bufferIndex, int length)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public OleDbDataReader GetData (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetDataTypeName (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DateTime GetDateTime (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public decimal GetDecimal (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public double GetDouble (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Type GetFieldType (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public float GetFloat (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public Guid GetGuid (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public short GetInt16 (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetInt32 (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public long GetInt64 (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetName (int index)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetOrdinal (string name)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public DataTable GetSchemaTable ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public string GetString (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public TimeSpan GetTimeSpan (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public object GetValue (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public int GetValues (object[] values)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ IDataReader IDataRecord.GetData (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ void IDisposable.Dispose ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool IsDBNull (int ordinal)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool NextResult ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public bool Read ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ #endregion
}
}
//
// System.Data.OleDb.OleDbErrorCollection
//
-// Author:
+// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.Collections;
{
public sealed class OleDbErrorCollection : ICollection, IEnumerable
{
+ #region Fields
+
+ ArrayList list;
+
+ #endregion // Fields
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public OleDbError this[int index] {
+ get { return (OleDbError) list[index]; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return list.SyncRoot; }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ [MonoTODO]
+ public void CopyTo (Array array, int index)
+ {
+ ((OleDbError[])(list.ToArray ())).CopyTo (array, index);
+ throw new NotImplementedException ();
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ #endregion // Methods
}
}
//
// System.Data.OleDb.OleDbParameter
//
-// Author:
+// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.Data;
namespace System.Data.OleDb
{
- public sealed class OleDbParameter : MarshalByRefObject,
- IDbDataParameter, IDataParameter, ICloneable
+ public sealed class OleDbParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
{
- private string m_name = null;
- private object m_value = null;
- private int m_size = 0;
- private bool m_isNullable = true;
- private byte m_precision = 0;
- private byte m_scale = 0;
- private DataRowVersion m_sourceVersion;
- private string m_sourceColumn = null;
- private ParameterDirection m_direction;
- private DbType m_type;
-
- /*
- * Constructors
- */
+ #region Fields
+
+ string name;
+ object value;
+ int size;
+ bool isNullable;
+ byte precision;
+ byte scale;
+ DataRowVersion sourceVersion;
+ string sourceColumn;
+ ParameterDirection direction;
+ OleDbType oleDbType;
+ DbType dbType;
+
+ #endregion
+
+ #region Constructors
public OleDbParameter ()
{
+ name = String.Empty;
+ value = null;
+ size = 0;
+ isNullable = true;
+ precision = 0;
+ scale = 0;
+ sourceColumn = String.Empty;
}
- public OleDbParameter (string name, object value) : this ()
+ public OleDbParameter (string name, object value)
+ : this ()
{
- m_name = name;
- m_value = value;
+ this.name = name;
+ this.value = value;
}
- public OleDbParameter (string name, OleDbType type) : this ()
+ public OleDbParameter (string name, OleDbType dataType)
+ : this ()
{
- m_name = name;
- m_type = (DbType) type;
+ this.name = name;
+ this.oleDbType = dataType;
}
- public OleDbParameter (string name, OleDbType type, int width)
- : this (name, type)
+ public OleDbParameter (string name, OleDbType dataType, int size)
+ : this (name, dataType)
{
- m_size = width;
+ this.size = size;
}
- public OleDbParameter (string name, OleDbType type,
- int width, string src_col)
- : this (name, type, width)
+ public OleDbParameter (string name, OleDbType dataType, int size, string srcColumn)
+ : this (name, dataType, size)
{
- m_name = name;
- m_type = (DbType) type;
- m_size = width;
- m_sourceColumn = src_col;
- }
-
- public OleDbParameter(string name, OleDbType type,
- int width, ParameterDirection direction,
- bool is_nullable, byte precision,
- byte scale, string src_col,
- DataRowVersion src_version, object value)
- : this (name, type, width, src_col)
+ this.sourceColumn = srcColumn;
+ }
+
+ public OleDbParameter(string name, OleDbType dataType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string srcColumn, DataRowVersion srcVersion, object value)
+ : this (name, dataType, size, srcColumn)
{
- m_direction = direction;
- m_isNullable = is_nullable;
- m_precision = precision;
- m_scale = scale;
- m_sourceVersion = src_version;
- m_value = value;
+ this.direction = direction;
+ this.isNullable = isNullable;
+ this.precision = precision;
+ this.scale = scale;
+ this.sourceVersion = srcVersion;
+ this.value = value;
}
- /*
- * Properties
- */
+ #endregion
- DbType IDataParameter.DbType
- {
- get {
- return m_type;
- }
- set {
- m_type = value;
+ #region Properties
+
+ public DbType DbType {
+ get { return dbType; }
+ set {
+ dbType = value;
+ oleDbType = DbTypeToOleDbType (value);
}
}
- ParameterDirection IDataParameter.Direction
- {
- get {
- return m_direction;
- }
- set {
- m_direction = value;
- }
+ public ParameterDirection Direction {
+ get { return direction; }
+ set { direction = value; }
}
- bool IDataParameter.IsNullable
- {
- get {
- return m_isNullable;
- }
+ public bool IsNullable {
+ get { return isNullable; }
+ set { isNullable = value; }
+ }
+
+ public OleDbType OleDbType {
+ get { return oleDbType; }
set {
- m_isNullable = value;
+ oleDbType = value;
+ dbType = OleDbTypeToDbType (value);
}
}
- string IDataParameter.ParameterName
- {
- get {
- return m_name;
- }
- set {
- m_name = value;
- }
+ public string ParameterName {
+ get { return name; }
+ set { name = value; }
}
- byte IDbDataParameter.Precision
- {
- get {
- return m_precision;
- }
- set {
- m_precision = value;
- }
+ public byte Precision {
+ get { return precision; }
+ set { precision = value; }
}
- byte IDbDataParameter.Scale
- {
- get {
- return m_scale;
- }
- set {
- m_scale = value;
- }
+ public byte Scale {
+ get { return scale; }
+ set { scale = value; }
}
- int IDbDataParameter.Size
- {
- get {
- return m_size;
- }
- set {
- m_size = value;
- }
+ public int Size {
+ get { return size; }
+ set { size = value; }
}
- string IDataParameter.SourceColumn
- {
- get {
- return m_sourceColumn;
- }
- set {
- m_sourceColumn = value;
- }
+ public string SourceColumn {
+ get { return sourceColumn; }
+ set { sourceColumn = value; }
}
- DataRowVersion IDataParameter.SourceVersion
- {
- get {
- return m_sourceVersion;
- }
- set {
- m_sourceVersion = value;
- }
+ public DataRowVersion SourceVersion {
+ get { return sourceVersion; }
+ set { sourceVersion = value; }
}
- object IDataParameter.Value
- {
- get {
- return m_value;
- }
- set {
- m_value = value;
- }
+ public object Value {
+ get { return value; }
+ set { value = value; }
}
- /*
- * Methods
- */
+ #endregion // Properties
+
+ #region Methods
[MonoTODO]
object ICloneable.Clone ()
{
throw new NotImplementedException ();
}
+
+ public override string ToString ()
+ {
+ return ParameterName;
+ }
+
+ private OleDbType DbTypeToOleDbType (DbType dbType)
+ {
+ switch (dbType) {
+ case DbType.AnsiString :
+ return OleDbType.VarChar;
+ case DbType.AnsiStringFixedLength :
+ return OleDbType.Char;
+ case DbType.Binary :
+ return OleDbType.Binary;
+ case DbType.Boolean :
+ return OleDbType.Boolean;
+ case DbType.Byte :
+ return OleDbType.UnsignedTinyInt;
+ case DbType.Currency :
+ return OleDbType.Currency;
+ case DbType.Date :
+ return OleDbType.Date;
+ case DbType.DateTime :
+ throw new NotImplementedException ();
+ case DbType.Decimal :
+ return OleDbType.Decimal;
+ case DbType.Double :
+ return OleDbType.Double;
+ case DbType.Guid :
+ return OleDbType.Guid;
+ case DbType.Int16 :
+ return OleDbType.SmallInt;
+ case DbType.Int32 :
+ return OleDbType.Integer;
+ case DbType.Int64 :
+ return OleDbType.BigInt;
+ case DbType.Object :
+ return OleDbType.Variant;
+ case DbType.SByte :
+ return OleDbType.TinyInt;
+ case DbType.Single :
+ return OleDbType.Single;
+ case DbType.String :
+ return OleDbType.WChar;
+ case DbType.StringFixedLength :
+ return OleDbType.VarWChar;
+ case DbType.Time :
+ throw new NotImplementedException ();
+ case DbType.UInt16 :
+ return OleDbType.UnsignedSmallInt;
+ case DbType.UInt32 :
+ return OleDbType.UnsignedInt;
+ case DbType.UInt64 :
+ return OleDbType.UnsignedBigInt;
+ case DbType.VarNumeric :
+ return OleDbType.VarNumeric;
+ }
+ return OleDbType.Variant;
+ }
+
+ private DbType OleDbTypeToDbType (OleDbType oleDbType)
+ {
+ switch (oleDbType) {
+ case OleDbType.BigInt :
+ return DbType.Int64;
+ case OleDbType.Binary :
+ return DbType.Binary;
+ case OleDbType.Boolean :
+ return DbType.Boolean;
+ case OleDbType.BSTR :
+ return DbType.AnsiString;
+ case OleDbType.Char :
+ return DbType.AnsiStringFixedLength;
+ case OleDbType.Currency :
+ return DbType.Currency;
+ case OleDbType.Date :
+ return DbType.DateTime;
+ case OleDbType.DBDate :
+ return DbType.DateTime;
+ case OleDbType.DBTime :
+ throw new NotImplementedException ();
+ case OleDbType.DBTimeStamp :
+ return DbType.DateTime;
+ case OleDbType.Decimal :
+ return DbType.Decimal;
+ case OleDbType.Double :
+ return DbType.Double;
+ case OleDbType.Empty :
+ throw new NotImplementedException ();
+ case OleDbType.Error :
+ throw new NotImplementedException ();
+ case OleDbType.Filetime :
+ return DbType.DateTime;
+ case OleDbType.Guid :
+ return DbType.Guid;
+ case OleDbType.IDispatch :
+ return DbType.Object;
+ case OleDbType.Integer :
+ return DbType.Int32;
+ case OleDbType.IUnknown :
+ return DbType.Object;
+ case OleDbType.LongVarBinary :
+ return DbType.Binary;
+ case OleDbType.LongVarChar :
+ return DbType.AnsiString;
+ case OleDbType.LongVarWChar :
+ return DbType.String;
+ case OleDbType.Numeric :
+ return DbType.Decimal;
+ case OleDbType.PropVariant :
+ return DbType.Object;
+ case OleDbType.Single :
+ return DbType.Single;
+ case OleDbType.SmallInt :
+ return DbType.Int16;
+ case OleDbType.TinyInt :
+ return DbType.SByte;
+ case OleDbType.UnsignedBigInt :
+ return DbType.UInt64;
+ case OleDbType.UnsignedInt :
+ return DbType.UInt32;
+ case OleDbType.UnsignedSmallInt :
+ return DbType.UInt16;
+ case OleDbType.UnsignedTinyInt :
+ return DbType.Byte;
+ case OleDbType.VarBinary :
+ return DbType.Binary;
+ case OleDbType.VarChar :
+ return DbType.AnsiString;
+ case OleDbType.Variant :
+ return DbType.Object;
+ case OleDbType.VarNumeric :
+ return DbType.VarNumeric;
+ case OleDbType.VarWChar :
+ return DbType.StringFixedLength;
+ case OleDbType.WChar :
+ return DbType.String;
+ }
+ return DbType.Object;
+ }
+
+ #endregion
}
}
//
// Author:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.Collections;
public sealed class OleDbParameterCollection : MarshalByRefObject,
IDataParameterCollection, IList, ICollection, IEnumerable
{
- private ArrayList m_list = new ArrayList ();
+ #region Fields
- /*
- * Properties
- */
+ ArrayList list = new ArrayList ();
+
+ #endregion // Fields
+
+ #region Properties
+
+ public int Count {
+ get { return list.Count; }
+ }
+
+ public OleDbParameter this[int index] {
+ get { return (OleDbParameter) list[index]; }
+ set { list[index] = value; }
+ }
+
+ public OleDbParameter this[string parameterName] {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ [MonoTODO]
+ set { throw new NotImplementedException (); }
+ }
int ICollection.Count {
- get {
- return m_list.Count;
- }
+ get { return list.Count; }
}
- bool IList.IsFixedSize
- {
- get {
- return false;
- }
+ bool IList.IsFixedSize {
+ get { return false; }
}
- bool IList.IsReadOnly
- {
- get {
- return false;
- }
+ bool IList.IsReadOnly {
+ get { return false; }
}
- bool ICollection.IsSynchronized
- {
- get {
- return m_list.IsSynchronized;
- }
+ bool ICollection.IsSynchronized {
+ get { return list.IsSynchronized; }
}
- object ICollection.SyncRoot
- {
- get {
- return m_list.SyncRoot;
- }
+ object ICollection.SyncRoot {
+ get { return list.SyncRoot; }
}
- object IList.this[int index]
- {
- get {
- return m_list[index];
- }
- set {
- m_list[index] = value;
- }
+ object IList.this[int index] {
+ get { return list[index]; }
+ set { list[index] = value; }
}
- object IDataParameterCollection.this[string name]
- {
+ object IDataParameterCollection.this[string name] {
[MonoTODO]
- get {
- throw new NotImplementedException ();
- }
+ get { throw new NotImplementedException (); }
[MonoTODO]
- set {
- throw new NotImplementedException ();
- }
+ set { throw new NotImplementedException (); }
}
- /*
- * Methods
- */
+ internal IntPtr GdaParameterList {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
- int IList.Add (object value)
- {
- if (!(value is IDataParameter))
- throw new InvalidCastException ();
+ #endregion // Properties
+
+ #region Methods
- m_list.Add (value);
- return m_list.IndexOf (value);
- }
public OleDbParameter Add (OleDbParameter parameter)
{
- m_list.Add (parameter);
+ list.Add (parameter);
return parameter;
}
public OleDbParameter Add (string name, object value)
{
OleDbParameter parameter = new OleDbParameter (name, value);
- m_list.Add (parameter);
+ list.Add (parameter);
return parameter;
}
public OleDbParameter Add (string name, OleDbType type)
{
OleDbParameter parameter = new OleDbParameter (name, type);
- m_list.Add (parameter);
+ list.Add (parameter);
return parameter;
}
public OleDbParameter Add (string name, OleDbType type, int width)
{
OleDbParameter parameter = new OleDbParameter (name, type, width);
- m_list.Add (parameter);
+ list.Add (parameter);
return parameter;
}
int width, string src_col)
{
OleDbParameter parameter = new OleDbParameter (name, type, width, src_col);
- m_list.Add (parameter);
+ list.Add (parameter);
return parameter;
}
+ int IList.Add (object value)
+ {
+ if (!(value is IDataParameter))
+ throw new InvalidCastException ();
+
+ list.Add (value);
+ return list.IndexOf (value);
+ }
+
void IList.Clear ()
{
- m_list.Clear ();
+ list.Clear ();
}
bool IList.Contains (object value)
{
- return m_list.Contains (value);
+ return list.Contains (value);
}
bool IDataParameterCollection.Contains (string value)
{
- for (int i = 0; i < m_list.Count; i++) {
+ for (int i = 0; i < list.Count; i++) {
IDataParameter parameter;
- parameter = (IDataParameter) m_list[i];
+ parameter = (IDataParameter) list[i];
if (parameter.ParameterName == value)
return true;
}
void ICollection.CopyTo (Array array, int index)
{
- ((OleDbParameter[])(m_list.ToArray ())).CopyTo (array, index);
+ ((OleDbParameter[])(list.ToArray ())).CopyTo (array, index);
}
IEnumerator IEnumerable.GetEnumerator ()
{
- return m_list.GetEnumerator ();
+ return list.GetEnumerator ();
}
int IList.IndexOf (object value)
{
- return m_list.IndexOf (value);
+ return list.IndexOf (value);
}
int IDataParameterCollection.IndexOf (string name)
{
- return m_list.IndexOf (((IDataParameterCollection) this)[name]);
+ return list.IndexOf (((IDataParameterCollection) this)[name]);
}
void IList.Insert (int index, object value)
{
- m_list.Insert (index, value);
+ list.Insert (index, value);
}
void IList.Remove (object value)
{
- m_list.Remove (value);
+ list.Remove (value);
}
void IList.RemoveAt (int index)
{
- m_list.Remove ((object) m_list[index]);
+ list.Remove ((object) list[index]);
}
void IDataParameterCollection.RemoveAt (string name)
{
- m_list.Remove (((IDataParameterCollection) this)[name]);
+ list.Remove (((IDataParameterCollection) this)[name]);
}
+
+ #endregion // Methods
}
}
//
// System.Data.OleDb.OleDbPermissionAttribute
//
-// Author:
+// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.Data;
using System.Data.Common;
using System.Security;
+using System.Security.Permissions;
namespace System.Data.OleDb
{
[Serializable]
public sealed class OleDbPermissionAttribute : DBDataPermissionAttribute
{
+
+ #region Constructors
+
+ [MonoTODO]
+ OleDbPermissionAttribute (SecurityAction action)
+ : base (action)
+ {
+ }
+
+ #endregion
+
+ #region Properties
+
[MonoTODO]
- [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
- | AttributeTargets.Struct | AttributeTargets.Constructor |
- AttributeTargets.Method)]
- [Serializable]
- public override IPermission CreatePermission () {
+ public string Provider {
+ [MonoTODO]
+ get {
+ throw new NotImplementedException ();
+ }
+ [MonoTODO]
+ set {
+ throw new NotImplementedException ();
+ }
+ }
+
+ #endregion
+
+ #region Methods
+
+ [MonoTODO]
+ public override IPermission CreatePermission ()
+ {
throw new NotImplementedException ();
}
+
+ #endregion
}
}
//
// System.Data.OleDb.OleDbRowUpdatedEventArgs
//
-// Author:
+// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.Data;
{
public sealed class OleDbRowUpdatedEventArgs : RowUpdatedEventArgs
{
+ #region Fields
+
+ OleDbCommand command;
+
+ #endregion // Fields
+
+ #region Constructors
+
+ [MonoTODO]
+ public OleDbRowUpdatedEventArgs (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (dataRow, command, statementType, tableMapping)
+
+ {
+ this.command = (OleDbCommand) command;
+ throw new NotImplementedException ();
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public new OleDbCommand Command {
+ get { return command; }
+ }
+
+ #endregion // Properties
}
}
//
// System.Data.OleDb.OleDbRowUpdatingEventArgs
//
-// Author:
+// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.Data;
{
public sealed class OleDbRowUpdatingEventArgs : RowUpdatingEventArgs
{
+
+ #region Fields
+
+ OleDbCommand command = null;
+
+ #endregion
+
+ #region Constructors
+
+ [MonoTODO]
+ public OleDbRowUpdatingEventArgs (DataRow dataRow, IDbCommand command, StatementType statementType, DataTableMapping tableMapping)
+ : base (dataRow, command, statementType, tableMapping)
+
+ {
+ this.command = (OleDbCommand) command;
+ throw new NotImplementedException ();
+ }
+
+ #endregion
+
+ #region Properties
+
+ public new OleDbCommand Command {
+ get { return command; }
+ set { command = value; }
+ }
+
+ #endregion
}
}
//
// System.Data.OleDb.OleDbTransaction
//
-// Author:
+// Authors:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.Data;
using System.Data.Common;
-using System.Exception;
namespace System.Data.OleDb
{
- public sealed class OleDbTransaction : MarshalByRefObject,
- IDbTransaction, IDisposable
+ public sealed class OleDbTransaction : MarshalByRefObject, IDbTransaction, IDisposable
{
- private OleDbConnection m_connection = null;
- private IsolationLevel m_level = IsolationLevel.ReadCommitted;
- /*
- * Constructors
- */
+ #region Fields
+
+ OleDbConnection connection = null;
+ IsolationLevel isolationLevel = IsolationLevel.ReadCommitted;
+
+ #endregion // Fields
+
+ #region Constructors
- protected OleDbTransaction (OleDbConnection cnc)
+ internal OleDbTransaction (OleDbConnection connection)
{
- m_connection = cnc;
- libgda.gda_connection_begin_transaction (m_connection.GdaConnection,
- null);
+ this.connection = connection;
+ libgda.gda_connection_begin_transaction (connection.GdaConnection, IntPtr.Zero);
}
- protected OleDbTransaction (OleDbConnection cnc,
- IsolationLevel level) : this (cnc)
+ internal OleDbTransaction (OleDbConnection connection, IsolationLevel isolevel)
+ : this (connection)
{
- m_level = level;
+ isolationLevel = isolevel;
}
- /*
- * Properties
- */
+ #endregion // Constructors
- IDbConnection IDbTransaction.Connection
- {
- get {
- return m_connection;
- }
+ #region Properties
+
+ public OleDbConnection Connection {
+ get { return connection; }
}
- IsolationLevel IDbTransaction.IsolationLevel
+ public IsolationLevel IsolationLevel
{
- get {
- return m_level;
- }
+ get { return isolationLevel; }
}
- /*
- * Methods
- */
+ IDbConnection IDbTransaction.Connection {
+ [MonoTODO]
+ get { throw new NotImplementedException (); }
+ }
+
+ #endregion // Properties
+
+ #region Methods
public OleDbTransaction Begin ()
{
- return new OleDbTransaction (m_connection);
+ return new OleDbTransaction (connection);
}
- public OleDbTransaction Begin (IsolationLevel level)
+ public OleDbTransaction Begin (IsolationLevel isolevel)
{
- return new OleDbTransaction (m_connection, level);
+ return new OleDbTransaction (connection, isolevel);
}
- void IDbTransaction.Commit ()
+ public void Commit ()
{
- if (!libgda.gda_connection_commit_transaction (
- m_connection.GdaConnection,
- null))
+ if (!libgda.gda_connection_commit_transaction (connection.GdaConnection, IntPtr.Zero))
throw new InvalidOperationException ();
}
- void IDbTransaction.Rollback ()
- {
- if (!libgda.gda_connection_rollback_transaction (
- m_connection.GdaConnection,
- null))
- throw new InvalidOperationException ();
+ [MonoTODO]
+ ~OleDbTransaction ()
+ {
}
[MonoTODO]
{
throw new NotImplementedException ();
}
+
+ public void Rollback ()
+ {
+ if (!libgda.gda_connection_rollback_transaction (connection.GdaConnection, IntPtr.Zero))
+ throw new InvalidOperationException ();
+ }
+
+ #endregion // Methods
}
}
//
// Author:
// Rodrigo Moya (rodrigo@ximian.com)
+// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Rodrigo Moya, 2002
+// Copyright (C) Tim Coleman, 2002
//
using System.Data;
PropVariant,
Single,
SmallInt,
- Tinyint,
+ TinyInt,
UnsignedBigInt,
UnsignedInt,
UnsignedSmallInt,
- UnisgnedTinyInt,
+ UnsignedTinyInt,
VarBinary,
VarChar,
Variant,
}
[DllImport("gda-2")]
- public static extern void gda_init (string app_id,
- string version,
- int nargs,
- string[] args);
+ public static extern void gda_init (string app_id, string version, int nargs, string[] args);
[DllImport("gda-2")]
public static extern IntPtr gda_client_new ();
[DllImport("gda-2")]
- public static extern IntPtr gda_client_open_connection (IntPtr client,
- string dsn,
- string username,
- string password);
+ public static extern IntPtr gda_client_open_connection (IntPtr client, string dsn, string username, string password);
[DllImport("gda-2")]
public static extern bool gda_connection_is_open (IntPtr cnc);
public static extern string gda_connection_get_password (IntPtr cnc);
[DllImport("gda-2")]
- public static extern bool gda_connection_begin_transaction (IntPtr cnc,
- string name);
+ public static extern IntPtr gda_transaction_new (string name);
[DllImport("gda-2")]
- public static extern bool gda_connection_commit_transaction (IntPtr cnc,
- string name);
+ public static extern IntPtr gda_transaction_get_name (IntPtr xaction);
[DllImport("gda-2")]
- public static extern bool gda_connection_rollback_transaction (IntPtr cnc,
- string name);
+ public static extern IntPtr gda_transaction_set_name (IntPtr xaction, string name);
+ [DllImport("gda-2")]
+ public static extern bool gda_connection_begin_transaction (IntPtr cnc, IntPtr xaction);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_connection_commit_transaction (IntPtr cnc, IntPtr xaction);
+
+ [DllImport("gda-2")]
+ public static extern bool gda_connection_rollback_transaction (IntPtr cnc, IntPtr xaction);
+
+ [DllImport("gda-2")]
+ public static extern int gda_connection_execute_non_query (IntPtr cnc, IntPtr command, IntPtr parameterList);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_connection_execute_single_command (IntPtr cnc, IntPtr command, IntPtr parameterList);
+
+ [DllImport("gda-2")]
+ public static extern IntPtr gda_command_new (string text, int type, int options);
}
}