\hypertarget{classosgeo_1_1proj_1_1io_1_1DatabaseContext}{}\doxysection{osgeo\+::proj\+::io\+::Database\+Context Class Reference}
\label{classosgeo_1_1proj_1_1io_1_1DatabaseContext}\index{osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}}


Database context.  




{\ttfamily \#include $<$io.\+hpp$>$}

\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{classosgeo_1_1proj_1_1io_1_1DatabaseContext_abb779217d54b3a7649dfe336f3349fb0}\label{classosgeo_1_1proj_1_1io_1_1DatabaseContext_abb779217d54b3a7649dfe336f3349fb0}} 
const std\+::string \& {\bfseries get\+Path} () const
\begin{DoxyCompactList}\small\item\em Return the path to the database. \end{DoxyCompactList}\item 
const char $\ast$ \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a100e25954f9c99e3360590d8b696a0fe}{get\+Metadata}} (const char $\ast$key) const
\begin{DoxyCompactList}\small\item\em Return a metadata item. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classosgeo_1_1proj_1_1io_1_1DatabaseContext_ab5b245a992eda9ca3cd078d6e3561670}\label{classosgeo_1_1proj_1_1io_1_1DatabaseContext_ab5b245a992eda9ca3cd078d6e3561670}} 
std\+::set$<$ std\+::string $>$ {\bfseries get\+Authorities} () const
\begin{DoxyCompactList}\small\item\em Return the list of authorities used in the database. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{classosgeo_1_1proj_1_1io_1_1DatabaseContext_aac79185bb5838e58fe95a5a4cbcadc45}\label{classosgeo_1_1proj_1_1io_1_1DatabaseContext_aac79185bb5838e58fe95a5a4cbcadc45}} 
std\+::vector$<$ std\+::string $>$ {\bfseries get\+Database\+Structure} () const
\begin{DoxyCompactList}\small\item\em Return the list of SQL commands (CREATE TABLE, CREATE TRIGGER, CREATE VIEW) needed to initialize a new database. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a3f9c2060dfcd55d22e6edec4a2b87c92}{start\+Insert\+Statements\+Session}} ()
\begin{DoxyCompactList}\small\item\em Starts a session for \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a8095cf657fe84d16e81e5764c885e71e}{get\+Insert\+Statements\+For()}} \end{DoxyCompactList}\item 
std\+::string \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a54d411ac211afe8b9b0ea16c5a26f405}{suggests\+Code\+For}} (const \mbox{\hyperlink{namespaceosgeo_1_1proj_1_1common_ada5c6f6eed30d72e1849e5aa583e2e99}{common\+::\+Identified\+Object\+NNPtr}} \&object, const std\+::string \&auth\+Name, bool numeric\+Code)
\begin{DoxyCompactList}\small\item\em Suggests a database code for the passed object. \end{DoxyCompactList}\item 
std\+::vector$<$ std\+::string $>$ \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a8095cf657fe84d16e81e5764c885e71e}{get\+Insert\+Statements\+For}} (const \mbox{\hyperlink{namespaceosgeo_1_1proj_1_1common_ada5c6f6eed30d72e1849e5aa583e2e99}{common\+::\+Identified\+Object\+NNPtr}} \&object, const std\+::string \&auth\+Name, const std\+::string \&code, bool numeric\+Code, const std\+::vector$<$ std\+::string $>$ \&allowed\+Authorities=\{\char`\"{}EPSG\char`\"{}, \char`\"{}PROJ\char`\"{}\})
\begin{DoxyCompactList}\small\item\em Returns SQL statements needed to insert the passed object into the database. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a1bba2c67b4ac6e30ddedd31d0261db57}{stop\+Insert\+Statements\+Session}} ()
\begin{DoxyCompactList}\small\item\em Stops an insertion session started with \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a3f9c2060dfcd55d22e6edec4a2b87c92}{start\+Insert\+Statements\+Session()}} \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static \mbox{\hyperlink{namespaceosgeo_1_1proj_1_1io_a776e066c227b9607a8c8e9e356bb9c40}{Database\+Context\+NNPtr}} \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a8eb7cb859aafaefb63704c4d02d1be61}{create}} (const std\+::string \&database\+Path=std\+::string(), const std\+::vector$<$ std\+::string $>$ \&auxiliary\+Database\+Paths=std\+::vector$<$ std\+::string $>$(), PJ\+\_\+\+CONTEXT $\ast$ctx=nullptr)
\begin{DoxyCompactList}\small\item\em Instantiate a database context. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Database context. 

A database context should be used only by one thread at a time. 

\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a8eb7cb859aafaefb63704c4d02d1be61}\label{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a8eb7cb859aafaefb63704c4d02d1be61}} 
\index{osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}!create@{create}}
\index{create@{create}!osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}}
\doxysubsubsection{\texorpdfstring{create()}{create()}}
{\footnotesize\ttfamily \mbox{\hyperlink{namespaceosgeo_1_1proj_1_1io_a776e066c227b9607a8c8e9e356bb9c40}{Database\+Context\+NNPtr}} osgeo\+::proj\+::io\+::\+Database\+Context\+::create (\begin{DoxyParamCaption}\item[{const std\+::string \&}]{database\+Path = {\ttfamily std\+:\+:string()},  }\item[{const std\+::vector$<$ std\+::string $>$ \&}]{auxiliary\+Database\+Paths = {\ttfamily std\+:\+:vector$<$std\+:\+:string$>$()},  }\item[{PJ\+\_\+\+CONTEXT $\ast$}]{ctx = {\ttfamily nullptr} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



Instantiate a database context. 

This database context should be used only by one thread at a time.


\begin{DoxyParams}{Parameters}
{\em database\+Path} & Path and filename of the database. Might be empty string for the default rules to locate the default proj.\+db \\
\hline
{\em auxiliary\+Database\+Paths} & Path and filename of auxiliary databases. Might be empty. Starting with PROJ 8.\+1, if this parameter is an empty array, the PROJ\+\_\+\+AUX\+\_\+\+DB environment variable will be used, if set. It must contain one or several paths. If several paths are provided, they must be separated by the colon (\+:) character on Unix, and on Windows, by the semi-\/colon (;) character. \\
\hline
{\em ctx} & Context used for file search. \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1FactoryException}{Factory\+Exception}}} & \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a8095cf657fe84d16e81e5764c885e71e}\label{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a8095cf657fe84d16e81e5764c885e71e}} 
\index{osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}!getInsertStatementsFor@{getInsertStatementsFor}}
\index{getInsertStatementsFor@{getInsertStatementsFor}!osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}}
\doxysubsubsection{\texorpdfstring{getInsertStatementsFor()}{getInsertStatementsFor()}}
{\footnotesize\ttfamily std\+::vector$<$ std\+::string $>$ osgeo\+::proj\+::io\+::\+Database\+Context\+::get\+Insert\+Statements\+For (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{namespaceosgeo_1_1proj_1_1common_ada5c6f6eed30d72e1849e5aa583e2e99}{common\+::\+Identified\+Object\+NNPtr}} \&}]{object,  }\item[{const std\+::string \&}]{auth\+Name,  }\item[{const std\+::string \&}]{code,  }\item[{bool}]{numeric\+Code,  }\item[{const std\+::vector$<$ std\+::string $>$ \&}]{allowed\+Authorities = {\ttfamily \{\char`\"{}EPSG\char`\"{},~\char`\"{}PROJ\char`\"{}\}} }\end{DoxyParamCaption})}



Returns SQL statements needed to insert the passed object into the database. 

\mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a3f9c2060dfcd55d22e6edec4a2b87c92}{start\+Insert\+Statements\+Session()}} must have been called previously.


\begin{DoxyParams}{Parameters}
{\em object} & The object to insert into the database. Currently only Prime\+Meridian, Ellipsoid, Datum, Geodetic\+CRS, Projected\+CRS, Vertical\+CRS, Compound\+CRS or Bound\+CRS are supported. \\
\hline
{\em auth\+Name} & Authority name into which the object will be inserted. \\
\hline
{\em code} & Code with which the object will be inserted. \\
\hline
{\em numeric\+Code} & Whether intermediate objects that can be created should use numeric codes (true), or may be alphanumeric (false) \\
\hline
{\em allowed\+Authorities} & Authorities to which intermediate objects are allowed to refer to. auth\+Name will be implicitly added to it. Note that unit, coordinate systems, projection methods and parameters will in any case be allowed to refer to EPSG. \\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1FactoryException}{Factory\+Exception}}} & \\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
8.\+1 
\end{DoxySince}
\mbox{\Hypertarget{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a100e25954f9c99e3360590d8b696a0fe}\label{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a100e25954f9c99e3360590d8b696a0fe}} 
\index{osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}!getMetadata@{getMetadata}}
\index{getMetadata@{getMetadata}!osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}}
\doxysubsubsection{\texorpdfstring{getMetadata()}{getMetadata()}}
{\footnotesize\ttfamily const char $\ast$ osgeo\+::proj\+::io\+::\+Database\+Context\+::get\+Metadata (\begin{DoxyParamCaption}\item[{const char $\ast$}]{key }\end{DoxyParamCaption}) const}



Return a metadata item. 

Value remains valid while this is alive and to the next call to get\+Metadata \mbox{\Hypertarget{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a3f9c2060dfcd55d22e6edec4a2b87c92}\label{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a3f9c2060dfcd55d22e6edec4a2b87c92}} 
\index{osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}!startInsertStatementsSession@{startInsertStatementsSession}}
\index{startInsertStatementsSession@{startInsertStatementsSession}!osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}}
\doxysubsubsection{\texorpdfstring{startInsertStatementsSession()}{startInsertStatementsSession()}}
{\footnotesize\ttfamily void osgeo\+::proj\+::io\+::\+Database\+Context\+::start\+Insert\+Statements\+Session (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Starts a session for \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a8095cf657fe84d16e81e5764c885e71e}{get\+Insert\+Statements\+For()}} 

Starts a new session for one or several calls to \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a8095cf657fe84d16e81e5764c885e71e}{get\+Insert\+Statements\+For()}}. An insertion session guarantees that the inserted objects will not create conflicting intermediate objects.

The session must be stopped with \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a1bba2c67b4ac6e30ddedd31d0261db57}{stop\+Insert\+Statements\+Session()}}.

Only one session may be active at a time for a given database context.


\begin{DoxyExceptions}{Exceptions}
{\em \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1FactoryException}{Factory\+Exception}}} & \\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
8.\+1 
\end{DoxySince}
\mbox{\Hypertarget{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a1bba2c67b4ac6e30ddedd31d0261db57}\label{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a1bba2c67b4ac6e30ddedd31d0261db57}} 
\index{osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}!stopInsertStatementsSession@{stopInsertStatementsSession}}
\index{stopInsertStatementsSession@{stopInsertStatementsSession}!osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}}
\doxysubsubsection{\texorpdfstring{stopInsertStatementsSession()}{stopInsertStatementsSession()}}
{\footnotesize\ttfamily void osgeo\+::proj\+::io\+::\+Database\+Context\+::stop\+Insert\+Statements\+Session (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Stops an insertion session started with \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a3f9c2060dfcd55d22e6edec4a2b87c92}{start\+Insert\+Statements\+Session()}} 

\begin{DoxySince}{Since}
8.\+1 
\end{DoxySince}
\mbox{\Hypertarget{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a54d411ac211afe8b9b0ea16c5a26f405}\label{classosgeo_1_1proj_1_1io_1_1DatabaseContext_a54d411ac211afe8b9b0ea16c5a26f405}} 
\index{osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}!suggestsCodeFor@{suggestsCodeFor}}
\index{suggestsCodeFor@{suggestsCodeFor}!osgeo::proj::io::DatabaseContext@{osgeo::proj::io::DatabaseContext}}
\doxysubsubsection{\texorpdfstring{suggestsCodeFor()}{suggestsCodeFor()}}
{\footnotesize\ttfamily std\+::string osgeo\+::proj\+::io\+::\+Database\+Context\+::suggests\+Code\+For (\begin{DoxyParamCaption}\item[{const \mbox{\hyperlink{namespaceosgeo_1_1proj_1_1common_ada5c6f6eed30d72e1849e5aa583e2e99}{common\+::\+Identified\+Object\+NNPtr}} \&}]{object,  }\item[{const std\+::string \&}]{auth\+Name,  }\item[{bool}]{numeric\+Code }\end{DoxyParamCaption})}



Suggests a database code for the passed object. 

Supported type of objects are Prime\+Meridian, Ellipsoid, Datum, Datum\+Ensemble, Geodetic\+CRS, Projected\+CRS, Vertical\+CRS, Compound\+CRS, Bound\+CRS, Conversion.


\begin{DoxyParams}{Parameters}
{\em object} & Object for which to suggest a code. \\
\hline
{\em auth\+Name} & Authority name into which the object will be inserted. \\
\hline
{\em numeric\+Code} & Whether the code should be numeric, or derived from the object name. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the suggested code, that is guaranteed to not conflict with an existing one.
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em \mbox{\hyperlink{classosgeo_1_1proj_1_1io_1_1FactoryException}{Factory\+Exception}}} & \\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
8.\+1 
\end{DoxySince}


The documentation for this class was generated from the following files\+:\begin{DoxyCompactItemize}
\item 
include/proj/io.\+hpp\item 
src/iso19111/factory.\+cpp\end{DoxyCompactItemize}
