コード例 #1
0
        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]);
                }
            }
        }
コード例 #2
0
 public OdbcCommand()
 {
     timeout           = DEFAULT_COMMAND_TIMEOUT;
     commandType       = CommandType.Text;
     _parameters       = new OdbcParameterCollection();
     designTimeVisible = true;
     updateRowSource   = UpdateRowSource.Both;
 }
コード例 #3
0
ファイル: OdbcCommand.cs プロジェクト: ngraziano/mono
		public OdbcCommand ()
		{
			timeout = DEFAULT_COMMAND_TIMEOUT;
			commandType = CommandType.Text;
			_parameters = new OdbcParameterCollection ();
			designTimeVisible = true;
			updateRowSource = UpdateRowSource.Both;
		}
コード例 #4
0
		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;
		}
コード例 #5
0
 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);
 }
コード例 #6
0
        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]);
                }
            }
        }
コード例 #7
0
        /// <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
        }
コード例 #8
0
ファイル: OdbcCommand.cs プロジェクト: yuyixiaoxiang/runtime
        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
        }
コード例 #9
0
ファイル: OdbcCommand.cs プロジェクト: zdbobi/runtime
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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
        }
コード例 #12
0
 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);
 }