- Main Page
- Related Pages
- Modules
- Classes
- Files

# ICommand.h

Go to the documentation of this file.

    00001 #ifndef _ICOMMAND_H_
    00002 #define _ICOMMAND_H_
    00003 //
    00004
    00005 //
    00006 // Copyright (C) 2004-2006  Autodesk, Inc.
    00007 //
    00008 // This library is free software; you can redistribute it and/or
    00009 // modify it under the terms of version 2.1 of the GNU Lesser
    00010 // General Public License as published by the Free Software Foundation.
    00011 //
    00012 // This library is distributed in the hope that it will be useful,
    00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015 // Lesser General Public License for more details.
    00016 //
    00017 // You should have received a copy of the GNU Lesser General Public
    00018 // License along with this library; if not, write to the Free Software
    00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    00020 //
    00021
    00022 #ifdef _WIN32
    00023 #pragma once
    00024 #endif
    00025
    00026 #include <FdoStd.h>
    00027 #include <Fdo/Connections/IConnection.h>
    00028 #include <Fdo/Connections/ITransaction.h>
    00029 #include <Fdo/Commands/ParameterValueCollection.h>
    00030
    00031 class FdoIConnection;
    00032 class FdoITransaction;
    00033
    00034 /// \brief
    00035 /// The FdoICommand interface defines behavior common to all commands in FDO. In
    00036 /// order to be executed, commands must have an association to a connection.
    00037 /// Commands can also be optionally associated with a transaction if the
    00038 /// connection supports transactions. The parameter values collection allows
    00039 /// values to be specified for commands that support expressions and/or filters.
    00040 class FdoICommand : public FdoIDisposable
    00041 {
    00042     friend class FdoIConnection;
    00043
    00044 public:
    00045     /// \brief
    00046     /// Gets the FdoIConnection that this command will operate on.
    00047     ///
    00048     /// \return
    00049     /// Returns the connection object
    00050     ///
    00051     FDO_API virtual FdoIConnection* GetConnection() = 0;
    00052
    00053     /// \brief
    00054     /// Gets the transaction in which the command executes.
    00055     ///
    00056     /// \return
    00057     /// Returns the transaction object
    00058     ///
    00059     FDO_API virtual FdoITransaction* GetTransaction() = 0;
    00060
    00061     /// \brief
    00062     /// Sets the transaction in which the command executes.
    00063     ///
    00064     /// \param value
    00065     /// Input the transaction object
    00066     ///
    00067     /// \return
    00068     /// Returns nothing
    00069     ///
    00070     FDO_API virtual void SetTransaction(FdoITransaction* value) = 0;
    00071
    00072     /// \brief
    00073     /// Gets the number of milliseconds to wait before terminating the attempt
    00074     /// to execute a command and generating an error. If the provider does not
    00075     /// support the timeout capability, 0 is returned.
    00076     ///
    00077     /// \return
    00078     /// Returns the time (in milliseconds)
    00079     ///
    00080     FDO_API virtual FdoInt32 GetCommandTimeout() = 0;
    00081
    00082     /// \brief
    00083     /// Sets the number of milliseconds to wait before terminating the attempt
    00084     /// to execute a command and generating an error. If the provider does not
    00085     /// support the timeout capability, then attempting to set a timeout will
    00086     /// result in an exception.
    00087     ///
    00088     /// \param value
    00089     /// Input the time (in milliseconds)
    00090     ///
    00091     /// \return
    00092     /// Returns nothing
    00093     ///
    00094     FDO_API virtual void SetCommandTimeout(FdoInt32 value) = 0;
    00095
    00096     /// \brief
    00097     /// Returns an FdoParameterValueCollection. If the command requires parameters, the
    00098     /// literal values to bind to each of those named parameters must be added to
    00099     /// this collection.
    00100     ///
    00101     /// \return
    00102     /// Returns the list of parameters and their respective values
    00103     ///
    00104     FDO_API virtual FdoParameterValueCollection* GetParameterValues() = 0;
    00105
    00106     /// \brief
    00107     /// Validates and optimizes the command for execution. Calling this method is
    00108     /// optional, but recommended if bound to different sets of parameters and
    00109     /// executed multiple times.
    00110     ///
    00111     /// \return
    00112     /// Returns nothing
    00113     ///
    00114     FDO_API virtual void Prepare() = 0;
    00115
    00116     /// \brief
    00117     /// Attempts to cancel command execution. Cancel may be called on a separate
    00118     /// thread after the commands Execute method has been called and before
    00119     /// Execute has returned. If successful, an exception is thrown from the
    00120     /// Execute method. If there is nothing to cancel, nothing happens. If
    00121     /// command execution is in process, and the attempt to cancel fails or is
    00122     /// not supported, an exception is thrown.
    00123     ///
    00124     /// \return
    00125     /// Returns nothing
    00126     ///
    00127     FDO_API virtual void Cancel() = 0;
    00128
    00129 };
    00130 #endif
    00131
    00132

Please send us your comment about this page