diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2018-11-26 15:47:57 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2018-11-29 00:35:25 +0100 |
| commit | 67758b2c67ea329116b59818c038797667c4e1d1 (patch) | |
| tree | 7e6b4ead6cbe9251ea5ef64d6c45179287597b2e /src/factory.cpp | |
| parent | 7e05bd0ff52fe3ba78dfd75f9ebebe3dfe715bca (diff) | |
| download | PROJ-67758b2c67ea329116b59818c038797667c4e1d1.tar.gz PROJ-67758b2c67ea329116b59818c038797667c4e1d1.zip | |
Redirect epsg:XXXX and IGNF:XXXX CRS expansions to the database, and remove the data/epsg and data/IGNF files
Diffstat (limited to 'src/factory.cpp')
| -rw-r--r-- | src/factory.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/factory.cpp b/src/factory.cpp index 3c360d13..f58b66a0 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -157,6 +157,8 @@ struct DatabaseContext::Private { }; private: + friend class DatabaseContext; + std::string databasePath_{}; bool close_handle_ = true; sqlite3 *sqlite_handle_{}; @@ -164,6 +166,7 @@ struct DatabaseContext::Private { PJ_CONTEXT *pjCtxt_ = nullptr; int recLevel_ = 0; bool detach_ = false; + std::string lastMetadataValue_{}; void closeDB(); @@ -704,6 +707,22 @@ const std::string &DatabaseContext::getPath() const { return d->getPath(); } // --------------------------------------------------------------------------- +/** \brief Return a metadata item. + * + * Value remains valid while this is alive and to the next call to getMetadata + */ +const char *DatabaseContext::getMetadata(const char *key) const { + auto res = + d->run("SELECT value FROM metadata WHERE key = ?", {std::string(key)}); + if (res.empty()) { + return nullptr; + } + d->lastMetadataValue_ = res[0][0]; + return d->lastMetadataValue_.c_str(); +} + +// --------------------------------------------------------------------------- + //! @cond Doxygen_Suppress DatabaseContextNNPtr DatabaseContext::create(void *sqlite_handle) { |
