Insert.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/dataaccess/query/Insert.h
22 
23  \brief A Insert can be used to add information in a table.
24 */
25 
26 #ifndef __TERRALIB_DATAACCESS_INTERNAL_INSERT_H
27 #define __TERRALIB_DATAACCESS_INTERNAL_INSERT_H
28 
29 // TerraLib
30 #include "DataSetName.h"
31 #include "Field.h"
32 #include "Fields.h"
33 #include "Select.h"
34 #include "Query.h"
35 
36 // STL
37 #include <memory>
38 
39 namespace te
40 {
41  namespace da
42  {
43  /*!
44  \class Insert
45 
46  \brief The Insert object can add the return of a select object.
47 
48  \sa Select, Field, Fields, DataSet, DataSetName
49  */
51  {
52  public:
53 
55 
56  /*!
57  \brief Constructor.
58 
59  \param d The name of the dataset to insert data.
60  \param f Vector with the fields to set data by select.
61  \param s The real SubSelect to be associated to this object.
62 
63  \note The Insert will take the ownership of the Select.
64  */
65  Insert(DataSetName* d, Fields* f, Select* s);
66 
67  /*!
68  \brief Constructor.
69 
70  \param d The name of the dataset to insert data.
71  \param f Vector with the fields to set data by select.
72  \param s The real SubSelect to be associated to this object.
73  */
74  Insert(const DataSetName& d, const Fields& f, const Select& s);
75 
76  /*!
77  \brief Constructor.
78 
79  \param d The name of the dataset to insert data.
80  \param s The real SubSelect to be associated to this object.
81 
82  \note The Insert will take the ownership of the Select.
83  */
84  Insert(DataSetName* d, Select* s);
85 
86  /*!
87  \brief Constructor.
88 
89  \param d The name of the dataset to insert data.
90  \param s The real SubSelect to be associated to this object.
91  */
92  Insert(const DataSetName& d, const Select& s);
93 
94  /*! \brief Copy constructor. */
95  Insert(const Insert& rhs);
96 
97  /*! \brief Destructor. */
98  ~Insert();
99 
100  /*! Assignment operator. */
101  Insert& operator=(const Insert& rhs);
102 
103  /*! \brief It creates a new copy of this Insert. */
104  Query* clone() const;
105 
106  /*!
107  \brief It returns the associated DataSetName.
108 
109  \return The associated DataSetName.
110  */
111  DataSetName* getDataSetName() const;
112 
113  /*!
114  \brief It sets the DataSetName associated to this object.
115 
116  \param d The Table to be associated to the Insert object.
117 
118  \note The Insert will take the ownership of the FromItem.
119  */
120  void setDataSetName(DataSetName* d);
121 
122  /*!
123  \brief It returns the associated fields.
124 
125  \return The associated fields.
126  */
127  Fields* getFields() const;
128 
129  /*!
130  \brief It sets the Fields associated to this object.
131 
132  \param f Fields to be associated to the Insert object.
133 
134  \note The Insert will take the ownership of the Fields.
135  */
136  void setFields(Fields* f);
137 
138  /*!
139  \brief It returns the associated select.
140 
141  \return The associated select.
142  */
143  Select* getSelect() const;
144 
145  /*!
146  \brief It sets the select associated to this object.
147 
148  \param s The Select to be associated to the Insert object.
149 
150  \note The Insert will take the ownership of the Select.
151  */
152  void setSelect(Select* s);
153 
154  private:
155 
156  std::auto_ptr<DataSetName> m_dsName; //!< The associated DataSetName.
157  std::auto_ptr<Fields> m_fields; //!< The associated Fields.
158  std::auto_ptr<Select> m_select; //!< The associated Select.
159  };
160 
161  } // end namespace da
162 } // end namespace te
163 
164 #endif // __TERRALIB_DATAACCESS_INTERNAL_INSERT_H
165 
A class that models the name of a dataset used in a From clause.
Definition: DataSetName.h:43
A class that models the name of a dataset used in a From clause.
The Insert object can add the return of a select object.
Definition: Insert.h:50
The base class for queries.
URI C++ Library.
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
Definition: Fields.h:37
A Select models a query to be used when retrieving data from a data source.
#define TE_DEFINE_VISITABLE
Definition: BaseVisitable.h:75
A Select models a query to be used when retrieving data from a DataSource.
Definition: Select.h:65
std::auto_ptr< DataSetName > m_dsName
The associated DataSetName.
Definition: Insert.h:156
The Field class can be used to model an expression that takes part of the output items of a SELECT...
The Fields class can be used to model a set of expressions that form the output items of a SELECT...
std::auto_ptr< Select > m_select
The associated Select.
Definition: Insert.h:158
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:97
std::auto_ptr< Fields > m_fields
The associated Fields.
Definition: Insert.h:157
A Query is independent from the data source language/dialect.
Definition: Query.h:46