/// <summary>
        /// Computes and returns the supported command type given a stipulated command type and command object.
        /// </summary>
        /// <remarks>
        /// If the returned type does not match the stipulated type,
        /// a warning event is raised on the given command object. 
        /// </remarks>
        /// <param name="commandType">Type of the command.</param>
        /// <param name="command">The command.</param>
        /// <returns>the supported command type</returns>
        private static CommandType ToSupportedCommandType(CommandType commandType, HsqlCommand command)
        {
            switch (commandType)
            {
                case CommandType.StoredProcedure:
                case CommandType.TableDirect:
                case CommandType.Text:
                    {
                        return commandType;
                    }
                default:
                    {
                        ArgumentException ex = new ArgumentException(
                            "commandType", string.Format(
                            "[{0}] is not a valid command type", commandType));
                        HsqlDataSourceException hex = new HsqlDataSourceException("Warning.", ex);

                        command.OnWarning(new HsqlWarningEventArgs(hex));

                        return CommandType.Text;
                    }
            }
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HsqlWarningEventArgs"/> class.
 /// </summary>
 /// <param name="exception">
 /// The object that directly represents the warning condition.
 /// </param>
 public HsqlWarningEventArgs(HsqlDataSourceException exception)
 {
     m_exception = exception;
 }
 /// <summary>
 /// Adds the specified exception.
 /// </summary>
 /// <param name="ex">The exception to add.</param>
 internal void Add(HsqlDataSourceException ex)
 {
     m_exceptions.Add(ex);
 }
 /// <summary>
 /// Copies the elements of this collection into an array of
 /// <see cref="HsqlDataSourceException"/>, starting at the specified index.
 /// </summary>
 /// <param name="array">
 /// The array of <see cref="HsqlDataSourceException"/> into which to copy the elements.
 /// </param>
 /// <param name="index">
 /// The index into the array at which to start copying.
 /// </param>
 /// <exception cref="System.ArgumentException">
 /// When sum of index and the number of elements in this
 /// collection is greater than the <see cref="System.Array.Length"/>
 /// of the target array.
 /// </exception>
 /// <exception cref="System.ArgumentNullException">
 /// The array is null.
 /// </exception>
 /// <exception cref="System.ArgumentOutOfRangeException">
 /// The index is not valid for array.
 /// </exception>
 public void CopyTo(HsqlDataSourceException[] array, int index)
 {
     m_exceptions.CopyTo(array, index);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="HsqlWarningEventArgs"/> class.
 /// </summary>
 /// <param name="exception">
 /// The object that directly represents the warning condition.
 /// </param>
 public HsqlWarningEventArgs(HsqlDataSourceException exception)
 {
     m_exception = exception;
 }
 /// <summary>
 /// Adds the specified exception.
 /// </summary>
 /// <param name="ex">The exception to add.</param>
 internal void Add(HsqlDataSourceException ex)
 {
     m_exceptions.Add(ex);
 }