\hypertarget{group__dbi__functions}{}\section{D\+BI Functions}
\label{group__dbi__functions}\index{DBI Functions@{DBI Functions}}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{group__dbi__functions_ga87a7753d10594ea3bae85b62e188b21d}{Qore\+::\+Qore\+::\+S\+Q\+L\+::dbi\+\_\+get\+\_\+driver\+\_\+capabilities}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} driver)
\begin{DoxyCompactList}\small\item\em Returns an integer representing the capabilities of a D\+BI driver binary-\/\+OR\textquotesingle{}ed together (see \mbox{\hyperlink{group__dbi__capabilities}{D\+BI Capability Constants}}) or 0 if the driver is not already loaded. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga4b52a1cbee7a3aed46c32cb0a938629c}{list}}$<$ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} $>$ \mbox{\hyperlink{group__dbi__functions_gaf2ddc5fadceda303167a75a000ec6d82}{Qore\+::\+Qore\+::\+S\+Q\+L\+::dbi\+\_\+get\+\_\+driver\+\_\+capability\+\_\+list}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} driver)
\begin{DoxyCompactList}\small\item\em Returns a list of each capability supported by the given D\+BI driver (see \mbox{\hyperlink{group__dbi__capabilities}{D\+BI Capability Constants}}) or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if the driver cannot be found. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga4b52a1cbee7a3aed46c32cb0a938629c}{list}}$<$ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} $>$ \mbox{\hyperlink{group__dbi__functions_ga39836a5539dccbf56583d212e9bffa7e}{Qore\+::\+Qore\+::\+S\+Q\+L\+::dbi\+\_\+get\+\_\+driver\+\_\+list}} ()
\begin{DoxyCompactList}\small\item\em Returns a list of strings of D\+BI drivers currently loaded or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if no drivers are loaded. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ \mbox{\hyperlink{group__dbi__functions_gaf66db5f01f469deab5ec8c989c043f18}{Qore\+::\+Qore\+::\+S\+Q\+L\+::dbi\+\_\+get\+\_\+driver\+\_\+options}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} driver)
\begin{DoxyCompactList}\small\item\em returns a hash of driver options \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$ auto $>$ \mbox{\hyperlink{group__dbi__functions_gaedeaa269d4daf4bf5b5c2da763f20049}{Qore\+::\+Qore\+::\+S\+Q\+L\+::parse\+\_\+datasource}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} ds)
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{group__dbi__functions_datasource_hash}{datasource hash}} of the components of a datasource string. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
These D\+BI functions were added in Qore 0.\+8.\+6; the original functions used camel case names and had \mbox{\hyperlink{code_flags_NOOP}{N\+O\+OP}} variants (see \mbox{\hyperlink{group__old__dbi__functions}{Old D\+BI Functions}})\hypertarget{group__dbi__functions_datasource_hash}{}\subsection{Datasource Hash}\label{group__dbi__functions_datasource_hash}
 \tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
\hline
{\bfseries{Key}} &{\bfseries{Description}}  \\\cline{1-2}
{\ttfamily type}  &the name of the driver, if present  \\\cline{1-2}
{\ttfamily user}  &the username given in the string  \\\cline{1-2}
{\ttfamily pass}  &the password for the connection  \\\cline{1-2}
{\ttfamily db}  &the database name for the connection  \\\cline{1-2}
{\ttfamily charset}  &The name of the D\+B-\/specific character encoding to use for the connection, if present in the string  \\\cline{1-2}
{\ttfamily host}  &the hostname for the connection, if present in the string  \\\cline{1-2}
{\ttfamily port}  &the port number to use for the connection, if present in the string  \\\cline{1-2}
{\ttfamily options}  &A hash of options given in the string, if present. Special options are {\ttfamily \char`\"{}min\char`\"{}} and {\ttfamily \char`\"{}max\char`\"{}}, which are respected by the Datasource\+Pool\+::constructor(hash) variant for setting the minimum and maximum connections in the pool, respectively; other options are passed to the D\+BI driver  \\\cline{1-2}
\end{longtabu}


\subsection{Function Documentation}
\mbox{\Hypertarget{group__dbi__functions_ga87a7753d10594ea3bae85b62e188b21d}\label{group__dbi__functions_ga87a7753d10594ea3bae85b62e188b21d}} 
\index{DBI Functions@{DBI Functions}!dbi\_get\_driver\_capabilities@{dbi\_get\_driver\_capabilities}}
\index{dbi\_get\_driver\_capabilities@{dbi\_get\_driver\_capabilities}!DBI Functions@{DBI Functions}}
\subsubsection{\texorpdfstring{dbi\_get\_driver\_capabilities()}{dbi\_get\_driver\_capabilities()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+Qore\+::\+S\+Q\+L\+::dbi\+\_\+get\+\_\+driver\+\_\+capabilities (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{driver }\end{DoxyParamCaption})}



Returns an integer representing the capabilities of a D\+BI driver binary-\/\+OR\textquotesingle{}ed together (see \mbox{\hyperlink{group__dbi__capabilities}{D\+BI Capability Constants}}) or 0 if the driver is not already loaded. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em driver} & the name of the driver; if the given driver is not already loaded then this function returns \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
an integer representing the capabilities of a D\+BI driver binary-\/\+OR\textquotesingle{}ed together (see \mbox{\hyperlink{group__dbi__capabilities}{D\+BI Capability Constants}}) or 0 if the driver is not already loaded
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{int caps = \mbox{\hyperlink{group__dbi__functions_ga87a7753d10594ea3bae85b62e188b21d}{dbi\_get\_driver\_capabilities}}(\textcolor{stringliteral}{"pgsql"});}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
similar to \mbox{\hyperlink{group__old__dbi__functions_gaec342f12d867758d49be57c1bf2a39cf}{get\+D\+B\+I\+Driver\+Capabilities()}} except uses the standard function naming scheme (ie {\ttfamily \char`\"{}names\+\_\+like\+\_\+this()\char`\"{}} instead of {\ttfamily \char`\"{}camel\+Case()\char`\"{}}), always returns an \mbox{\hyperlink{data_type_declarations_int_type}{int}}, and does not have a \mbox{\hyperlink{code_flags_NOOP}{N\+O\+OP}} variant
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
\mbox{\Hypertarget{group__dbi__functions_gaf2ddc5fadceda303167a75a000ec6d82}\label{group__dbi__functions_gaf2ddc5fadceda303167a75a000ec6d82}} 
\index{DBI Functions@{DBI Functions}!dbi\_get\_driver\_capability\_list@{dbi\_get\_driver\_capability\_list}}
\index{dbi\_get\_driver\_capability\_list@{dbi\_get\_driver\_capability\_list}!DBI Functions@{DBI Functions}}
\subsubsection{\texorpdfstring{dbi\_get\_driver\_capability\_list()}{dbi\_get\_driver\_capability\_list()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga4b52a1cbee7a3aed46c32cb0a938629c}{list}}$<$\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}$>$ Qore\+::\+Qore\+::\+S\+Q\+L\+::dbi\+\_\+get\+\_\+driver\+\_\+capability\+\_\+list (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{driver }\end{DoxyParamCaption})}



Returns a list of each capability supported by the given D\+BI driver (see \mbox{\hyperlink{group__dbi__capabilities}{D\+BI Capability Constants}}) or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if the driver cannot be found. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em driver} & the name of the driver; if the given driver is not loaded then the function returns \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a list of each capability supported by the given D\+BI driver (see \mbox{\hyperlink{group__dbi__capabilities}{D\+BI Capability Constants}}) or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if the driver cannot be found
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*list<string> l = \mbox{\hyperlink{group__dbi__functions_gaf2ddc5fadceda303167a75a000ec6d82}{dbi\_get\_driver\_capability\_list}}(\textcolor{stringliteral}{"pgsql"});}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
similar to \mbox{\hyperlink{group__old__dbi__functions_ga9cbf88f872bbaebcd1d228efef180117}{get\+D\+B\+I\+Driver\+Capability\+List()}} except uses the standard function naming scheme (ie {\ttfamily \char`\"{}names\+\_\+like\+\_\+this()\char`\"{}} instead of {\ttfamily \char`\"{}camel\+Case()\char`\"{}}) and does not have a \mbox{\hyperlink{code_flags_NOOP}{N\+O\+OP}} variant
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
\mbox{\Hypertarget{group__dbi__functions_ga39836a5539dccbf56583d212e9bffa7e}\label{group__dbi__functions_ga39836a5539dccbf56583d212e9bffa7e}} 
\index{DBI Functions@{DBI Functions}!dbi\_get\_driver\_list@{dbi\_get\_driver\_list}}
\index{dbi\_get\_driver\_list@{dbi\_get\_driver\_list}!DBI Functions@{DBI Functions}}
\subsubsection{\texorpdfstring{dbi\_get\_driver\_list()}{dbi\_get\_driver\_list()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga4b52a1cbee7a3aed46c32cb0a938629c}{list}}$<$\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}$>$ Qore\+::\+Qore\+::\+S\+Q\+L\+::dbi\+\_\+get\+\_\+driver\+\_\+list (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a list of strings of D\+BI drivers currently loaded or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if no drivers are loaded. 

\begin{DoxyReturn}{Returns}
a list of strings of D\+BI drivers currently loaded or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if no drivers are loaded
\end{DoxyReturn}
\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*list<string> l = \mbox{\hyperlink{group__dbi__functions_ga39836a5539dccbf56583d212e9bffa7e}{dbi\_get\_driver\_list}}();}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
similar to \mbox{\hyperlink{group__old__dbi__functions_ga20fdc611dd5a56fce211b3106578840c}{get\+D\+B\+I\+Driver\+List()}} except uses the standard function naming scheme (ie {\ttfamily \char`\"{}names\+\_\+like\+\_\+this()\char`\"{}} instead of {\ttfamily \char`\"{}camel\+Case()\char`\"{}})
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
\mbox{\Hypertarget{group__dbi__functions_gaf66db5f01f469deab5ec8c989c043f18}\label{group__dbi__functions_gaf66db5f01f469deab5ec8c989c043f18}} 
\index{DBI Functions@{DBI Functions}!dbi\_get\_driver\_options@{dbi\_get\_driver\_options}}
\index{dbi\_get\_driver\_options@{dbi\_get\_driver\_options}!DBI Functions@{DBI Functions}}
\subsubsection{\texorpdfstring{dbi\_get\_driver\_options()}{dbi\_get\_driver\_options()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+Qore\+::\+S\+Q\+L\+::dbi\+\_\+get\+\_\+driver\+\_\+options (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{driver }\end{DoxyParamCaption})}



returns a hash of driver options 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em driver} & the name of the driver; if the given driver is not already loaded then this function returns \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}}\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
if the given driver is not already loaded then the function returns \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}}; if the driver does not support any options then an empty hash is returned, otherwise a hash is returned where the keys are valid option names, and the values are hashes with the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily \char`\"{}desc\char`\"{}}\+: a string description of the option
\item {\ttfamily \char`\"{}type\char`\"{}}\+: a string giving the data type restriction for the option
\end{DoxyItemize}
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{*hash<auto> h = \mbox{\hyperlink{group__dbi__functions_gaf66db5f01f469deab5ec8c989c043f18}{dbi\_get\_driver\_options}}(\textcolor{stringliteral}{"pgsql"});}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
\mbox{\Hypertarget{group__dbi__functions_gaedeaa269d4daf4bf5b5c2da763f20049}\label{group__dbi__functions_gaedeaa269d4daf4bf5b5c2da763f20049}} 
\index{DBI Functions@{DBI Functions}!parse\_datasource@{parse\_datasource}}
\index{parse\_datasource@{parse\_datasource}!DBI Functions@{DBI Functions}}
\subsubsection{\texorpdfstring{parse\_datasource()}{parse\_datasource()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}$<$auto$>$ Qore\+::\+Qore\+::\+S\+Q\+L\+::parse\+\_\+datasource (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{ds }\end{DoxyParamCaption})}



Returns a \mbox{\hyperlink{group__dbi__functions_datasource_hash}{datasource hash}} of the components of a datasource string. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em ds} & a string describing the datasource with the following syntax\+:~\newline
 {\ttfamily \mbox{[}}{\itshape driver}{\ttfamily \+:\mbox{]}\mbox{[}}{\itshape user}{\ttfamily \mbox{]}\+:\mbox{[}/}{\itshape pass}{\ttfamily \mbox{]}@}{\itshape db}{\ttfamily \mbox{[}(}{\itshape charset}{\ttfamily )\mbox{]}\mbox{[}\%}{\itshape host}{\ttfamily \mbox{[}\+:}{\itshape port}{\ttfamily \mbox{]}\mbox{[}\{}{\itshape option}{\ttfamily =}{\itshape val}{\ttfamily \mbox{[},...\mbox{]}\}\mbox{]}} ~\newline
 where all elements except {\ttfamily @}{\itshape db} are optional\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{group__dbi__functions_datasource_hash}{datasource hash}} of the components of a datasource string
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash<auto> h = \mbox{\hyperlink{group__dbi__functions_gaedeaa269d4daf4bf5b5c2da763f20049}{parse\_datasource}}(\textcolor{stringliteral}{"pgsql:user/pass@dbname(utf8)\%dbhost.internal:1521\{min=4,max=10\}"});}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em D\+A\+T\+A\+S\+O\+U\+R\+C\+E-\/\+P\+A\+R\+S\+E-\/\+E\+R\+R\+OR} & a syntax error occurred parsing the datasource string (missing field, unexpected character, etc)\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
similar to \mbox{\hyperlink{group__old__dbi__functions_gaba3a2421c3d2b492c9494f346c13da1c}{parse\+Datasource()}} except uses the standard function naming scheme (ie {\ttfamily \char`\"{}names\+\_\+like\+\_\+this()\char`\"{}} instead of {\ttfamily \char`\"{}camel\+Case()\char`\"{}}) and does not have a \mbox{\hyperlink{code_flags_NOOP}{N\+O\+OP}} variant
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
