diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2018-12-03 16:44:21 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2018-12-03 16:44:21 +0100 |
| commit | ba111ac8323ff194039a06db87d1fb17ed8175b3 (patch) | |
| tree | 176a946244be38963714bc75984803655ebdd4a8 /src/factory.cpp | |
| parent | 2d8f295354ce20f2d375a985ff48fd5e7f8b90ca (diff) | |
| download | PROJ-ba111ac8323ff194039a06db87d1fb17ed8175b3.tar.gz PROJ-ba111ac8323ff194039a06db87d1fb17ed8175b3.zip | |
Export to ESRI WKT: make it use verbatim WKT definition from the database when possible
Diffstat (limited to 'src/factory.cpp')
| -rw-r--r-- | src/factory.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/factory.cpp b/src/factory.cpp index f58b66a0..91d0c478 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -852,6 +852,29 @@ DatabaseContext::getAliasFromOfficialName(const std::string &officialName, return res[0][0]; } +// --------------------------------------------------------------------------- + +/** \brief Return the 'text_definition' column of a table for an object + * + * @param tableName Table name/category. + * @param authName Authority name of the object. + * @param code Code of the object + * @return Text definition (or empty) + * @throw FactoryException + */ +std::string DatabaseContext::getTextDefinition(const std::string &tableName, + const std::string &authName, + const std::string &code) const { + std::string sql("SELECT text_definition FROM \""); + sql += replaceAll(tableName, "\"", "\"\""); + sql += "\" WHERE auth_name = ? AND code = ?"; + auto res = d->run(sql, {authName, code}); + if (res.empty()) { + return std::string(); + } + return res[0][0]; +} + //! @endcond // --------------------------------------------------------------------------- @@ -3807,6 +3830,11 @@ AuthorityFactory::createObjectsFromName( break; } } + if (res.empty() && !deprecated) { + return createObjectsFromName(searchedName + " (deprecated)", + allowedObjectTypes, approximateMatch, + limitResultCount); + } auto sortLambda = [](const common::IdentifiedObjectNNPtr &a, const common::IdentifiedObjectNNPtr &b) { |
