15 std::string outName =
"exampleInsert";
21 dsType->add(pkProperty);
25 dsType->setPrimaryKey(pk);
32 dsType->add(geomProp);
44 std::vector<te::dt::Property*> outputProps = dsType->getProperties();
46 for (std::size_t i = 0; i < outputProps.size(); ++i)
49 outFields->push_back(field);
53 std::unique_ptr<te::da::DataSourceTransactor> transactor = ds->getTransactor();
55 std::map<std::string, std::string> options;
56 ds->createDataSet(dsType.get(), options);
63 fields->push_back(f_gid);
66 fields->push_back(f_deno);
69 fields->push_back(f_geom);
73 from->push_back(fromItem);
82 delete transactor.release();
85 catch(
const std::exception& e)
87 std::cout << std::endl <<
"An exception has occurred in QueryInsertExample: " << e.what() << std::endl;
91 std::cout << std::endl <<
"An unexpected exception has occurred in QueryInsertExample!" << std::endl;
void setAutoNumber(bool a)
It tells if the property is an autonumber or not.
void add(te::dt::Property *p)
It adds a property to the list of properties of the primary key.
An abstract class that models a source of data in a query.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
void setGeometryType(GeomType t)
It sets the geometry subtype.
An atomic property like an integer or double.
A class that models the name of a dataset used in a From clause.
A class that models the description of a dataset.
static te::dt::Date ds(2010, 01, 01)
The Insert object can add the return of a select object.
void QueryInsertExample()
Quering Insert clause.
Examples on how to access/manipulate DataSources in TerraLib.
mydialect insert("+", new te::da::BinaryOpEncoder("+"))
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
A Select models a query to be used when retrieving data from a DataSource.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
std::unique_ptr< te::da::DataSource > GetPostGISConnection()
It describes a primary key (pk) constraint.