static public void DeriveParameters(OdbcCommand command) { // MDAC 65927 OdbcConnection.ExecutePermission.Demand(); if (null == command) { throw ADP.ArgumentNull("command"); } switch (command.CommandType) { case System.Data.CommandType.Text: throw ADP.DeriveParametersNotSupported(command); case System.Data.CommandType.StoredProcedure: break; case System.Data.CommandType.TableDirect: // CommandType.TableDirect - do nothing, parameters are not supported throw ADP.DeriveParametersNotSupported(command); default: throw ADP.InvalidCommandType(command.CommandType); } if (ADP.IsEmpty(command.CommandText)) { throw ADP.CommandTextRequired(ADP.DeriveParameters); } OdbcConnection connection = command.Connection; if (null == connection) { throw ADP.ConnectionRequired(ADP.DeriveParameters); } ConnectionState state = connection.State; if (ConnectionState.Open != state) { throw ADP.OpenConnectionRequired(ADP.DeriveParameters, state); } OdbcParameter[] list = DeriveParametersFromStoredProcedure(connection, command); OdbcParameterCollection parameters = command.Parameters; parameters.Clear(); int count = list.Length; if (0 < count) { for (int i = 0; i < list.Length; ++i) { parameters.Add(list[i]); } } }
public OdbcCommand() { timeout = DEFAULT_COMMAND_TIMEOUT; commandType = CommandType.Text; _parameters = new OdbcParameterCollection(); designTimeVisible = true; updateRowSource = UpdateRowSource.Both; }
public OdbcCommand () { timeout = DEFAULT_COMMAND_TIMEOUT; commandType = CommandType.Text; _parameters = new OdbcParameterCollection (); designTimeVisible = true; updateRowSource = UpdateRowSource.Both; }
public OdbcCommand () { this.CommandText = String.Empty; this.CommandTimeout = 30; // default timeout this.CommandType = CommandType.Text; Connection = null; _parameters = new OdbcParameterCollection (); Transaction = null; designTimeVisible = false; dataReader = null; }
protected override void Dispose(bool disposing) { if (disposing) { this.DisconnectFromDataReaderAndConnection(); this._parameterCollection = null; this.CommandText = null; } this._cmdWrapper = null; this._isPrepared = false; base.Dispose(disposing); }
public static void DeriveParameters(OdbcCommand command) { OdbcConnection.ExecutePermission.Demand(); if (command == null) { throw ADP.ArgumentNull("command"); } CommandType commandType = command.CommandType; if (commandType == CommandType.Text) { throw ADP.DeriveParametersNotSupported(command); } if (commandType != CommandType.StoredProcedure) { if (commandType == CommandType.TableDirect) { throw ADP.DeriveParametersNotSupported(command); } throw ADP.InvalidCommandType(command.CommandType); } if (ADP.IsEmpty(command.CommandText)) { throw ADP.CommandTextRequired("DeriveParameters"); } OdbcConnection connection = command.Connection; if (connection == null) { throw ADP.ConnectionRequired("DeriveParameters"); } ConnectionState state = connection.State; if (ConnectionState.Open != state) { throw ADP.OpenConnectionRequired("DeriveParameters", state); } OdbcParameter[] parameterArray = DeriveParametersFromStoredProcedure(connection, command); OdbcParameterCollection parameters = command.Parameters; parameters.Clear(); int length = parameterArray.Length; if (0 < length) { for (int i = 0; i < parameterArray.Length; i++) { parameters.Add(parameterArray[i]); } } }
/// <include file='doc\OdbcCommand.uex' path='docs/doc[@for="OdbcCommand.Dispose"]/*' /> override protected void Dispose(bool disposing) // MDAC 65459 { if (disposing) { // release mananged objects this.DisconnectFromDataReaderAndConnection(); _parameterCollection = null; } _cmdWrapper = null; // let go of the CommandWrapper _hdesc = IntPtr.Zero; _isPrepared = false; base.Dispose(disposing); // notify base classes }
protected override void Dispose(bool disposing) { // MDAC 65459 if (disposing) { // release mananged objects // in V1.0, V1.1 the Connection,Parameters,CommandText,Transaction where reset this.DisconnectFromDataReaderAndConnection(); _parameterCollection = null; CommandText = null; } _cmdWrapper = null; // let go of the CommandWrapper _isPrepared = false; base.Dispose(disposing); // notify base classes }
object ICloneable.Clone() { OdbcCommand clone = new OdbcCommand(); clone.CommandText = CommandText; clone.CommandTimeout = this.CommandTimeout; clone.CommandType = CommandType; clone.Connection = this.Connection; clone.Transaction = this.Transaction; clone.UpdatedRowSource = UpdatedRowSource; if ((null != _parameterCollection) && (0 < Parameters.Count)) { OdbcParameterCollection parameters = clone.Parameters; foreach (ICloneable parameter in Parameters) { parameters.Add(parameter.Clone()); } } return(clone); }
object ICloneable.Clone() { OdbcCommand command = new OdbcCommand(); Bid.Trace("<odbc.OdbcCommand.Clone|API> %d#, clone=%d#\n", this.ObjectID, command.ObjectID); command.CommandText = this.CommandText; command.CommandTimeout = this.CommandTimeout; command.CommandType = this.CommandType; command.Connection = this.Connection; command.Transaction = this.Transaction; command.UpdatedRowSource = this.UpdatedRowSource; if ((this._parameterCollection != null) && (0 < this.Parameters.Count)) { OdbcParameterCollection parameters = command.Parameters; foreach (ICloneable cloneable in this.Parameters) { parameters.Add(cloneable.Clone()); } } return(command); }
override protected void Dispose(bool disposing) { // MDAC 65459 if (disposing) { // release mananged objects // in V1.0, V1.1 the Connection,Parameters,CommandText,Transaction where reset this.DisconnectFromDataReaderAndConnection (); _parameterCollection = null; CommandText = null; } _cmdWrapper = null; // let go of the CommandWrapper _isPrepared = false; base.Dispose(disposing); // notify base classes }
protected override void Dispose(bool disposing) { if (disposing) { this.DisconnectFromDataReaderAndConnection(); this._parameterCollection = null; this.CommandText = null; } this._cmdWrapper = null; this._isPrepared = false; base.Dispose(disposing); }