\hypertarget{class_qore_1_1_s_q_l_1_1_datasource}{}\section{Qore\+:\+:S\+QL\+:\+:Datasource Class Reference}
\label{class_qore_1_1_s_q_l_1_1_datasource}\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}


This class provides the Qore interface to databases.  




Inheritance diagram for Qore\+:\+:S\+QL\+:\+:Datasource\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{class_qore_1_1_s_q_l_1_1_datasource__inherit__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}{begin\+Transaction}} ()
\begin{DoxyCompactList}\small\item\em Manually grabs the transaction lock. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ac9a78046de816a73c17ced8195e6e2eb}{clear\+Event\+Queue}} ()
\begin{DoxyCompactList}\small\item\em Clears the queue object for D\+BI events on the datasource. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a5048534538ce825624d4be475e09774c}{close}} ()
\begin{DoxyCompactList}\small\item\em Closes the connection to the database; if any actions are in progress on the database, the close call will block until the actions complete. If any errors are encountered, an exception is raised. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ab70fe02e890112a4449f0340ef7cc335}{commit}} ()
\begin{DoxyCompactList}\small\item\em Commits the current transaction and releases the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_transaction_lock}{transaction lock}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a8aa8d914a4e0fcb1c3827d73caa4d819}{constructor}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} driver, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} user, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} pass, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} db, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} host, \+\_\+\+\_\+7\+\_\+ softint port, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} options, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}} queue, auto arg)
\begin{DoxyCompactList}\small\item\em Creates the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object; attempts to load a D\+BI driver if the driver is not already present in Qore. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ad4729c1b5bbe81448527f1b182a08a34}{constructor}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} desc, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}} queue, auto arg)
\begin{DoxyCompactList}\small\item\em Creates a \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object from a single string giving all parameters that can be parsed by \mbox{\hyperlink{group__dbi__functions_gad95f3a076d1818cc722c516543e29858}{parse\+\_\+datasource()}} \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a532848530d34877ef0e5d7a827c38d01}{constructor}} (\mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} opts, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}} queue, auto arg)
\begin{DoxyCompactList}\small\item\em Creates a \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object from a hash argument giving parameters for the constructor. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a196d09ba7c9e3cb9e6a228593152b5fd}{copy}} ()
\begin{DoxyCompactList}\small\item\em Creates a new \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object with the same driver as the original and copies of all the connection parameters. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a5661e26369193015c195166e52c6d121}{current\+Thread\+In\+Transaction}} ()
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} if the current thread is in a transaction (i.\+e. holds the transaction lock), \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} if not. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a12ed8d5453f1737831bd03f11198766f}{describe}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sql,...)
\begin{DoxyCompactList}\small\item\em Executes an S\+QL select statement on the server and returns a description of the result set as a hash. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a420a865a5ef78ddc110f90529a5b7967}{destructor}} ()
\begin{DoxyCompactList}\small\item\em Closes the datasource if it\textquotesingle{}s open (if any operations are in progress, will block until the operations complete) and destroys the object. \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a226b0fa3f5fdc4da16d8dda6703f1fdb}{exec}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sql,...)
\begin{DoxyCompactList}\small\item\em Grabs the transaction lock (if autocommit is disabled) and executes an S\+QL command on the server and returns either the integer row count (for example, for updates, inserts, and deletes) or the data retrieved (for example, if a stored procedure is executed that returns values). \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a4ec5865609884af9b0498a7f45b1042f}{exec\+Raw}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sql)
\begin{DoxyCompactList}\small\item\em Grabs the transaction lock (if autocommit is disabled) and executes an S\+QL command on the server and returns either the row count (for example, for updates and inserts) or the data retrieved (for example, if a stored procedure is executed that returns values) \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a4b4bbaca92649d27b858fb0996dc86fd}{get\+Auto\+Commit}} ()
\begin{DoxyCompactList}\small\item\em Returns the autocommit status for the object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_add2d683039a2bc2b01df63621b698e6e}{get\+Capabilities}} ()
\begin{DoxyCompactList}\small\item\em Returns an integer bitfield of D\+BI driver capabilities. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga8f596b49953b71928f04c24b19834bc3}{list}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a760f8a33542561ec680d37b956890e99}{get\+Capability\+List}} ()
\begin{DoxyCompactList}\small\item\em Returns a list of strings giving the capabilities of the current D\+BI driver. \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a0074fed1b53e9b94f811f3b8481b1df4}{get\+Client\+Version}} ()
\begin{DoxyCompactList}\small\item\em Retrieves the driver-\/specific client library version information; this method may not be implemented for all drivers. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a68c63cda68bd98860f332e6335e7a642}{get\+Config\+Hash}} ()
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{group__dbi__functions_datasource_hash}{datasource hash}} describing the configuration of the current object. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a7713f26c809821a7942a60e27f924742}{get\+Config\+String}} ()
\begin{DoxyCompactList}\small\item\em Returns a string giving the configuration of the current object in a format that can be parsed by \mbox{\hyperlink{group__dbi__functions_gad95f3a076d1818cc722c516543e29858}{parse\+\_\+datasource()}} \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ab3ba2ad96626d4c25dd818a7dc608f05}{get\+D\+B\+Charset}} ()
\begin{DoxyCompactList}\small\item\em Retrieves the database-\/specific charset set encoding for the current connection. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ad3f499b4fc704c38b5cb064362b54501}{get\+D\+B\+Encoding}} ()
\begin{DoxyCompactList}\small\item\em Retrieves the database-\/specific charset set encoding for the current connection. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aa0084434a2631b776ce4cfa7075e5f01}{get\+D\+B\+Name}} ()
\begin{DoxyCompactList}\small\item\em Returns the database name parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aff2f886f27e033dd2bdcc49c22b2cd65}{get\+Driver\+Name}} ()
\begin{DoxyCompactList}\small\item\em Returns the name of the driver used for the object. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a103526f8e3e4e0783523f3af89047190}{get\+Host\+Name}} ()
\begin{DoxyCompactList}\small\item\em Returns the hostname parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a86bf7ff6686300ebcd270b3d09f508c9}{get\+O\+S\+Charset}} ()
\begin{DoxyCompactList}\small\item\em Returns the Qore character encoding name for the current connection as a string or {\ttfamily \char`\"{}(unknown)\char`\"{}} if none is set. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aae5a12ff32342c13df0cee4503e2f898}{get\+O\+S\+Encoding}} ()
\begin{DoxyCompactList}\small\item\em Returns the Qore character encoding name for the current connection as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set. \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a34834d2da5e1e8f13949810e76a6e1cd}{get\+Option}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} opt)
\begin{DoxyCompactList}\small\item\em Returns the current value for the given option. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_acf95b2265f01756ea0d51806dc51973b}{get\+Option\+Hash}} ()
\begin{DoxyCompactList}\small\item\em returns the valid options for the driver associated with the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} with descriptions and current values for the current \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ae8ecfbacb0245d1c2e5118352cfe9edb}{get\+Password}} ()
\begin{DoxyCompactList}\small\item\em Returns the password parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ad8c4bde5992da775c95bd8b2a3340e19}{get\+Port}} ()
\begin{DoxyCompactList}\small\item\em Gets the port number that will be used for the next connection to the server. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_s_q_l_statement}{Abstract\+S\+Q\+L\+Statement}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a39ef1a8bff15788d039672359c28772e}{get\+S\+Q\+L\+Statement}} ()
\begin{DoxyCompactList}\small\item\em Returns an \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_s_q_l_statement}{Abstract\+S\+Q\+L\+Statement}} object based on the current database connection object. \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a35340d8cbadc2eb5b20ab9d8e0fc87eb}{get\+Server\+Version}} ()
\begin{DoxyCompactList}\small\item\em Returns the driver-\/specific server version data for the current connection. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aadc509c6ff4daba5f528163ffd8e05dc}{get\+Transaction\+Lock\+Timeout}} ()
\begin{DoxyCompactList}\small\item\em Retrieves the transaction lock timeout value as an integer in milliseconds. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a0b9c482becfbe8349a75e5a55370f88c}{get\+User\+Name}} ()
\begin{DoxyCompactList}\small\item\em Returns the username parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_af74cb806c9e19c6099c0d2cce84a44ab}{in\+Transaction}} ()
\begin{DoxyCompactList}\small\item\em Returns \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} if a transaction is currently in progress, \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} if not. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aa6a07369dd7563f1db552588f41e02e7}{open}} ()
\begin{DoxyCompactList}\small\item\em Opens a connection to the datasouce, using the connection parameters already set; an exception is thrown if any errors occur. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a4c8ae5e2b2d6c1386525eeb019abfb9b}{reset}} ()
\begin{DoxyCompactList}\small\item\em Closes and reopens the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}}. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_acdc71e3819dbc3bf8be24d60e75e7bb2}{rollback}} ()
\begin{DoxyCompactList}\small\item\em Rolls the current transaction back and releases the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_transaction_lock}{transaction lock}}. \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{select}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sql,...)
\begin{DoxyCompactList}\small\item\em Executes an S\+QL select statement on the server and returns the result as a hash (column names) of lists (column values per row) \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ad8c5f2e1e03853c9e8ff8109ead1dfc8}{select\+Row}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sql,...)
\begin{DoxyCompactList}\small\item\em Executes an S\+QL select statement on the server and returns the first row as a hash (the column values) \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a41126ab5a3d9e11ee7dd6d7975dfd65a}{select\+Rows}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sql,...)
\begin{DoxyCompactList}\small\item\em Executes an S\+QL select statement on the server and returns the result as a list (rows) of hashes (the column values) \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a5c9bf476b32eb9394e90c252504889f0}{set\+Auto\+Commit}} (bool ac=\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}})
\begin{DoxyCompactList}\small\item\em Turns autocommit on or off for this object. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aa7559279ad45047f842fb9f9af7a025b}{set\+D\+B\+Charset}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding)
\begin{DoxyCompactList}\small\item\em Sets the database-\/specific character encoding name for the next connection to the server. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a6b6b1e6098b0028a872b045ea3d811b8}{set\+D\+B\+Encoding}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding)
\begin{DoxyCompactList}\small\item\em Sets the database-\/specific character encoding name for the next connection to the server. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aaf2c93ad25bf3046a1a6b230f6482665}{set\+D\+B\+Name}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} db)
\begin{DoxyCompactList}\small\item\em Sets the database name parameter for the time a connection to the server is established. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ad4953ced1fde3271c67b0dc838756ebf}{set\+Event\+Queue}} (\mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}} queue, auto arg)
\begin{DoxyCompactList}\small\item\em Sets a queue object for D\+BI events on the datasource. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a264ea9b1a20197fb4b9c2eaa972af7f3}{set\+Host\+Name}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} host)
\begin{DoxyCompactList}\small\item\em Sets the hostname to use for the next connection to the server. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ad64b2409e602054d6e29257442b8601e}{set\+Option}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} opt, auto val)
\begin{DoxyCompactList}\small\item\em sets an option for the datasource \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a1ecea098e3d8f0d256f088f85d8e4ae4}{set\+Password}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} pass)
\begin{DoxyCompactList}\small\item\em Sets the password parameter for the time a connection to the server is established. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a9c1dee4070b3ac1998bad8294307628b}{set\+Port}} (softint port=0)
\begin{DoxyCompactList}\small\item\em Sets the port number to use for the connection. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aed11f75205cdbf0d16243c7ccc57d21a}{set\+Transaction\+Lock\+Timeout}} (timeout timeout\+\_\+ms=0)
\begin{DoxyCompactList}\small\item\em Sets the transaction lock timeout value in milliseconds; set to 0 for no timeout. \end{DoxyCompactList}\item 
nothing \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a86c204c7e2b1cceb46ca1f7ffeb007cd}{set\+User\+Name}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} user)
\begin{DoxyCompactList}\small\item\em Sets the username parameter for the time a connection to the server is established. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_afb6307ab9be490fa5d770519bca9447c}{transaction\+Tid}} ()
\begin{DoxyCompactList}\small\item\em Returns the T\+ID of the thread holding the transaction lock or -\/1 if it\textquotesingle{}s not currently held. \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aa85211061b4569eba8e40e26884592da}{vexec}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sql, \+\_\+\+\_\+7\+\_\+ softlist vargs)
\begin{DoxyCompactList}\small\item\em Grabs the transaction lock (if autocommit is disabled) and executes S\+QL code on the DB connection, taking a list for all bind arguments. \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a09cba17e3e0955069777c5548be0a22c}{vselect}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sql, \+\_\+\+\_\+7\+\_\+ softlist vargs)
\begin{DoxyCompactList}\small\item\em Executes a select statement on the server and returns the results in a hash (column names) of lists (column values per row), taking a list for all bind arguments. \end{DoxyCompactList}\item 
\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ac950d57929533b0ae08a3db269ed3bee}{vselect\+Row}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sql, \+\_\+\+\_\+7\+\_\+ softlist vargs)
\begin{DoxyCompactList}\small\item\em Executes a select statement on the server and returns the first row as a hash (column names and values), taking a list for all bind arguments. \end{DoxyCompactList}\item 
auto \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a8a6c1d5fce4c0822e6943c0e36484385}{vselect\+Rows}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} sql, \+\_\+\+\_\+7\+\_\+ softlist vargs)
\begin{DoxyCompactList}\small\item\em Executes a select statement on the server and returns the results in a list (rows) of hashes (column names and values), taking a list for all bind arguments. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Additional Inherited Members}


\subsection{Detailed Description}
This class provides the Qore interface to databases. 

\begin{DoxyParagraph}{Restrictions\+:}
\mbox{\hyperlink{group__parse__options_gac496a9d9bcf9d5c626c8c267c73a83bc}{Qore\+::\+P\+O\+\_\+\+N\+O\+\_\+\+D\+A\+T\+A\+B\+A\+SE}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Overview}
This class provides the main direct interface to D\+BI drivers (along with the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} and \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_pool}{Datasource\+Pool}} classes).~\newline
~\newline
 The Datasource class will attempt to load any D\+BI driver that is not currently loaded in the constructor. For connection pooling support, see the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_pool}{Datasource\+Pool}} class.~\newline
~\newline
 Datasource objects will implicitly call \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aa6a07369dd7563f1db552588f41e02e7}{Datasource\+::open()}} if no connection has yet been established and a method is called requiring a connection to the database server. Therefore any method that requires communication with the database server can also throw any exception that the open method can throw.~\newline
~\newline
 Most Qore D\+BI drivers allow \char`\"{}select\char`\"{} queries to be executed through the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a226b0fa3f5fdc4da16d8dda6703f1fdb}{Datasource\+::exec()}} method, and allow S\+QL commands (procedure calls, etc) to be executed through the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{Datasource\+::select()}} method, and some D\+BI drivers do not (depends on the underlying DB A\+PI). At any rate, the transaction lock is set when auto-\/commit is disabled and when the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a226b0fa3f5fdc4da16d8dda6703f1fdb}{Datasource\+::exec()}} or \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}{Datasource\+::begin\+Transaction()}} methods are executed as documented above. Therefore executing a transaction relevant command through the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{Datasource\+::select()}} method while auto-\/commit mode is disabled and a transaction has not yet started will not result in the transaction lock being allocated to the current thread and therefore could cause transaction errors when sharing the Datasource object between multiple threads.~\newline
~\newline
 Only databases with an existing Qore D\+BI driver can be accessed through the Datasource class.~\newline
~\newline
 All Qore D\+BI drivers set new connections to use transaction isolation level {\ttfamily \char`\"{}read committed\char`\"{}}.~\newline
~\newline
 The Datasource class provides high-\/level, per-\/connection locking on requests at a level above the D\+BI drivers to ensure that the communication between clients and servers is properly serialized.~\newline
~\newline
 Datasource objects also have a default character encoding; all requests to the server will be made in this encoding, and all responses will be returned in the given encoding. If no encoding is specifically given to the Datasource object, the Datasource object will use the \mbox{\hyperlink{character_encoding_default_encoding}{Default Character Encoding}}.
\end{DoxyParagraph}
\label{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}%
\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}%
 \begin{DoxyParagraph}{S\+QL Binding by Value and by Placeholder Overview}
All Datasource methods accepting S\+QL strings to execute understand a special syntax used in the query string to bind Qore data by value and to specify placeholders for output variables (for example, when executing a stored procedure or database function). Placeholder binding is D\+BI driver specific, but binding by value is supported with the same syntax in all drivers. Additionally, the {\ttfamily \%d} numeric specifier is supported equally in all Qore D\+BI drivers.~\newline
~\newline
 {\bfseries Datasource Format Specifiers}  \tabulinesep=1mm
\begin{longtabu} spread 0pt [c]{*{2}{|X[-1]}|}
\hline
{\bfseries Format Specification} &{\bfseries Description}  \\\cline{1-2}
{\ttfamily \%d}  &If any value other than \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} or \mbox{\hyperlink{basic_data_types_null}{N\+U\+LL}} is given, then the value is converted to an integer and this value is substituted in the string at this position; if the value is \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} or \mbox{\hyperlink{basic_data_types_null}{N\+U\+LL}}, then a literal {\ttfamily \char`\"{}null\char`\"{}} is substituted instead.  \\\cline{1-2}
{\ttfamily \%s}  &The argument is converted to a string and the string is inserted literally without any conversion or escape sequences in the string; this is useful for table or schema prefixes, etc  \\\cline{1-2}
{\ttfamily \%v}  &The argument is bound by value according to the D\+BI driver\textquotesingle{}s implementation.  \\\cline{1-2}
\end{longtabu}

\end{DoxyParagraph}
\begin{DoxyParagraph}{S\+QL Binding Details}
To bind Qore data values directly in a binary format in an S\+QL command, use {\ttfamily \%v} in the command string, and include the value as an argument after the string. Binding by value allows the D\+BI driver to take care of formatting the data properly for use in the query with the database server. When binding by value, strings do not need to be quoted, date/time values do not need special formatting, binary objects (with B\+L\+OB columns, for example) can be used directly in queries, etc.~\newline
~\newline
 Here is an example\+: 
\begin{DoxyCode}
int rows = db.exec(\textcolor{stringliteral}{"insert into table (varchar\_col, timestamp\_col, blob\_col, numeric\_col) values (%v, %v,
       %v, %d)"}, string, \mbox{\hyperlink{group__date__and__time__functions_ga23f067a4f82596346d4fef09782e1945}{now}}(), binary, 100);
\end{DoxyCode}
 ~\newline
 When using dynamic \mbox{\hyperlink{namespace_qore_1_1_s_q_l}{S\+QL}}, to insert a numeric value or a literal {\ttfamily \char`\"{}null\char`\"{}} in a query, use {\ttfamily \%d} in the command string, and include the value as an argument after the string. If the value is \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} or \mbox{\hyperlink{basic_data_types_null}{N\+U\+LL}}, a literal {\ttfamily \char`\"{}null\char`\"{}} will be written to the string; otherwise the argument is converted to an arbitrary-\/precision number or integer value if necessary and written to the string. This is useful for working with {\ttfamily D\+E\+C\+I\+M\+AL} ({\ttfamily N\+U\+M\+E\+R\+IC}, {\ttfamily N\+U\+M\+B\+ER}) types in a database-\/independent way; for example Postgre\+S\+QL servers do not do type conversions to {\ttfamily D\+E\+C\+I\+M\+AL} types when a string, integer, or float is bound by value, therefore to ensure that integral decimal values can be used in a database-\/independent way (with {\ttfamily \char`\"{}null\char`\"{}} substitution when no value is bound), a valid approach is to use the {\ttfamily \%d} code in the command string instead of {\ttfamily \%v}. However please note that {\ttfamily \%v} is normally preferred to keep the server-\/side statement cache a manageable size, in the previous example using the \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int()}}, \mbox{\hyperlink{group__type__conversion__functions_ga113d18216af1bdb70545081b6a9892ef}{float()}}, or \mbox{\hyperlink{group__type__conversion__functions_gaf6000d64e3fe99ce81b9faaf44b2de4e}{number()}} functions to convert string values before binding with {\ttfamily \%v} may be better.~\newline
~\newline
 For binding placeholders for output variables, write a unique name in the string and prefix it with a colon (ex\+: {\ttfamily \char`\"{}\+:code\char`\"{}}). In this case the method will return a hash of the output variables using the placeholder names as keys, but without the colon prefix. By default, a string type will be bound to the position. To bind other variable types to placeholder positions, include the type constant (see \mbox{\hyperlink{group__sql__constants}{S\+QL Constants}}) as an argument after the command string. For B\+L\+O\+Bs, use Binary, for C\+L\+O\+Bs, use the string \char`\"{}clob\char`\"{} (constants will be provided in a future release). Not all D\+BI drivers require placeholder buffer specifications; see the documentation for the D\+BI driver in question for more information and examples regarding placeholder buffer specifications.
\end{DoxyParagraph}
\label{class_qore_1_1_s_q_l_1_1_datasource_resultset_output_binding}%
\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_resultset_output_binding}%
 \begin{DoxyParagraph}{Result Set Output Binding}
A result set can be returned in two ways depending on the placeholder buffer specification\+:
\begin{DoxyItemize}
\item \mbox{\hyperlink{group__string__type__constants_ga30ed1908e2fdf3b908623541e7b78724}{Hash}}\+: (default for drivers that do not require placeholder buffer specifications)\+: returns the entire result set as data
\item \mbox{\hyperlink{group__sql__constants_ga9d23a1d69fcb188296a231a36c6b6da2}{R\+E\+S\+U\+L\+T\+S\+ET}}\+: (for drivers that support \mbox{\hyperlink{group__dbi__capabilities_ga91b90789d24991b1eebce9c11491f015}{Qore\+::\+S\+Q\+L\+::\+D\+B\+I\+\_\+\+C\+A\+P\+\_\+\+H\+A\+S\+\_\+\+R\+E\+S\+U\+L\+T\+S\+E\+T\+\_\+\+O\+U\+T\+P\+UT}})\+: returns an \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} representing the result set. This option allows a large result set to be returned in smaller pieces using the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} A\+PI if desired.
\end{DoxyItemize}
\end{DoxyParagraph}
When using \mbox{\hyperlink{group__sql__constants_ga9d23a1d69fcb188296a231a36c6b6da2}{R\+E\+S\+U\+L\+T\+S\+ET}}, the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} object created acquires the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_transaction_lock}{transaction lock}} even when used with a method that normally doesn\textquotesingle{}t indicate that a transaction will be started such as \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{select()}} or \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a41126ab5a3d9e11ee7dd6d7975dfd65a}{select\+Rows()}}, therefore the transaction lock must be released manually in such cases (just as with the normal usage of \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} objects); see the following example for details.

\begin{DoxyParagraph}{Result Set Output Binding Example}

\begin{DoxyCode}
\textcolor{comment}{# example of a result set output variable with Oracle}
SQLStatement stmt = ds.select(\textcolor{stringliteral}{"begin open :rs for select * from my\_table; end;"}, RESULTSET);
\textcolor{comment}{# we have to release the transaction when done}
on\_exit ds.rollback();
\textcolor{comment}{# iterate through the rows of the result set}
map process\_row($1), stmt;
\end{DoxyCode}

\end{DoxyParagraph}
\label{class_qore_1_1_s_q_l_1_1_datasource_transaction_lock}%
\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_transaction_lock}%
 \begin{DoxyParagraph}{Datasource Transaction Locks}
Datasource objects have an internal transaction lock which will be grabbed when the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a226b0fa3f5fdc4da16d8dda6703f1fdb}{Datasource\+::exec()}}, \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aa85211061b4569eba8e40e26884592da}{Datasource\+::vexec()}} \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a4ec5865609884af9b0498a7f45b1042f}{Datasource\+::exec\+Raw()}}, or \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}{Datasource\+::begin\+Transaction()}} methods are executed and autocommit is not enabled. This enables a single datasource to be safely used for transaction management by several threads simultaneously. Note that an exception in a Datasource method that would acquire the lock (such as the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a226b0fa3f5fdc4da16d8dda6703f1fdb}{Datasource\+::exec()}} method) when it\textquotesingle{}s not already held, will have the effect that the transaction lock is not acquired.~\newline
~\newline
 Any thread attempting to do transaction-\/relevant actions on a Datasource with auto-\/commit disabled while a transaction is in progress by another thread will block until the thread currently executing a transaction executes the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ab70fe02e890112a4449f0340ef7cc335}{Datasource\+::commit()}} or \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_acdc71e3819dbc3bf8be24d60e75e7bb2}{Datasource\+::rollback()}} methods (or the Datasource is deleted, reset, or closed, in which case the lock is released and an exception is raised as well).~\newline
~\newline
 There is a timeout associated with the transaction lock; if a thread waits for the transaction lock for more than the timeout period, then an exception will be raised in the waiting thread. The timeout value can be read and changed with the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aadc509c6ff4daba5f528163ffd8e05dc}{Datasource\+::get\+Transaction\+Lock\+Timeout()}} and \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aed11f75205cdbf0d16243c7ccc57d21a}{Datasource\+::set\+Transaction\+Lock\+Timeout()}} methods, respectively. The default transaction lock timeout value is 120 seconds.~\newline
~\newline
 Note that the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} class also grabs the transaction lock when executing if it is created using a Datasource object in the constructor; for more information see the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} class documentation.
\end{DoxyParagraph}
\begin{DoxyParagraph}{Thread Resource Handling}
The \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} class manages the transaction lock as a \mbox{\hyperlink{threading_thread_resources}{thread resource}}; if the transaction is not released with a call to \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ab70fe02e890112a4449f0340ef7cc335}{Datasource\+:\+:commit()}} or \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_acdc71e3819dbc3bf8be24d60e75e7bb2}{Datasource\+:\+:rollback()}} when the thread exits (or when \mbox{\hyperlink{group__threading__functions_ga421dca39ccb55b191d5d09fd98c2075a}{Qore\+::throw\+\_\+thread\+\_\+resource\+\_\+exceptions()}} or \mbox{\hyperlink{group__threading__functions_ga4e62409b8a1b414276d033267e7299e4}{Qore\+::throw\+\_\+thread\+\_\+resource\+\_\+exceptions\+\_\+to\+\_\+mark()}} is called), the transaction is rolled back automatically and a {\ttfamily D\+A\+T\+A\+S\+O\+U\+R\+C\+E-\/\+T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+E\+X\+C\+E\+P\+T\+I\+ON} exception is raised describing the situation.~\newline
~\newline
 Being an builtin class, the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} class does not inherit \mbox{\hyperlink{class_qore_1_1_thread_1_1_abstract_thread_resource}{Abstract\+Thread\+Resource}} explicitly as a part of the exported A\+PI, and the internal \mbox{\hyperlink{class_qore_1_1_thread_1_1_abstract_thread_resource_a0431f7384991eaf6900ee3a952b57f87}{Abstract\+Thread\+Resource\+:\+:cleanup()}} method cannot be overridden or suppressed.
\end{DoxyParagraph}
\begin{DoxyParagraph}{Data Serialization}
The \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} class supports \mbox{\hyperlink{class_qore_1_1_serializable}{data serialization}}; deserialization can fail if the database is not supported on or reachable from the target machine.
\end{DoxyParagraph}
When deserializing, any datasource event queue is lost; only the connection information is propagated in the deserialized copy.

\begin{DoxyNote}{Note}
This class is not available with the \mbox{\hyperlink{group__parse__options_gac496a9d9bcf9d5c626c8c267c73a83bc}{P\+O\+\_\+\+N\+O\+\_\+\+D\+A\+T\+A\+B\+A\+SE}} parse option
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\href{../../modules/SqlUtil/html/index.html}{\tt Sql\+Util} for a high level database-\/independent A\+PI 
\end{DoxySeeAlso}


\subsection{Member Function Documentation}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}\label{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!begin\+Transaction@{begin\+Transaction}}
\index{begin\+Transaction@{begin\+Transaction}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{begin\+Transaction()}{beginTransaction()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::begin\+Transaction (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Manually grabs the transaction lock. 

This method should be called when the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object will be shared between more than 1 thread, and a transaction will be started with a \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{Datasource\+::select()}} method or the like.

This method does not make any communication with the server to start a transaction; it only allocates the transaction lock to the current thread in Qore.

It is an error to call this method when autocommit is enabled for the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}}.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.beginTransaction();
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em A\+U\+T\+O\+C\+O\+M\+M\+I\+T-\/\+E\+R\+R\+OR} & Cannot start a transaction when autocommit is enabled \\
\hline
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock \\
\hline
\end{DoxyExceptions}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_ab879515333fbb878b567d3f9a80e4ba8}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ac9a78046de816a73c17ced8195e6e2eb}\label{class_qore_1_1_s_q_l_1_1_datasource_ac9a78046de816a73c17ced8195e6e2eb}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!clear\+Event\+Queue@{clear\+Event\+Queue}}
\index{clear\+Event\+Queue@{clear\+Event\+Queue}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{clear\+Event\+Queue()}{clearEventQueue()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::clear\+Event\+Queue (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Clears the queue object for D\+BI events on the datasource. 

\begin{DoxySince}{Since}
Qore 0.\+8.\+9 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a5048534538ce825624d4be475e09774c}\label{class_qore_1_1_s_q_l_1_1_datasource_a5048534538ce825624d4be475e09774c}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!close@{close}}
\index{close@{close}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{close()}{close()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::close (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Closes the connection to the database; if any actions are in progress on the database, the close call will block until the actions complete. If any errors are encountered, an exception is raised. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.close();
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions 
\end{DoxyNote}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ab70fe02e890112a4449f0340ef7cc335}\label{class_qore_1_1_s_q_l_1_1_datasource_ab70fe02e890112a4449f0340ef7cc335}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!commit@{commit}}
\index{commit@{commit}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{commit()}{commit()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::commit (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Commits the current transaction and releases the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_transaction_lock}{transaction lock}}. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.commit();
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions 
\end{DoxyNote}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a885eed5b3f805ec931f6b5c8fc165c8b}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a8aa8d914a4e0fcb1c3827d73caa4d819}\label{class_qore_1_1_s_q_l_1_1_datasource_a8aa8d914a4e0fcb1c3827d73caa4d819}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!constructor@{constructor}}
\index{constructor@{constructor}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily Qore\+::\+S\+Q\+L\+::\+Datasource\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{driver,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{user,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{pass,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{db,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{host,  }\item[{\+\_\+\+\_\+7\+\_\+ softint}]{port,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}}}]{options,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}}}]{queue,  }\item[{auto}]{arg }\end{DoxyParamCaption})}



Creates the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object; attempts to load a D\+BI driver if the driver is not already present in Qore. 


\begin{DoxyParams}{Parameters}
{\em driver} & The name of the D\+BI driver for the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}}. See \mbox{\hyperlink{group__sql__constants}{S\+QL Constants}} for builtin constants for D\+BI drivers shipped with Qore, or see the D\+BI driver documentation to use an add-\/on driver (this string should be the name of the driver to be loaded) \\
\hline
{\em user} & The user name for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a86c204c7e2b1cceb46ca1f7ffeb007cd}{Datasource\+::set\+User\+Name()}} for a method that allows this parameter to be set after the constructor. \\
\hline
{\em pass} & The password for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a1ecea098e3d8f0d256f088f85d8e4ae4}{Datasource\+::set\+Password()}} for a method that allows this parameter to be set after the constructor. \\
\hline
{\em db} & The database name for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aaf2c93ad25bf3046a1a6b230f6482665}{Datasource\+::set\+D\+B\+Name()}} for a method that allows this parameter to be set after the constructor. \\
\hline
{\em encoding} & The database-\/specific name of the \mbox{\hyperlink{character_encoding}{character encoding}} to use for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aa7559279ad45047f842fb9f9af7a025b}{Datasource\+::set\+D\+B\+Charset()}} for a method that allows this parameter to be set after the constructor. If no value is passed for this parameter, then the database character encoding corresponding to the \mbox{\hyperlink{character_encoding_default_encoding}{default character encoding}} will be used instead. \\
\hline
{\em host} & The host name for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a264ea9b1a20197fb4b9c2eaa972af7f3}{Datasource\+::set\+Host\+Name()}} for a method that allows this parameter to be set after the constructor. \\
\hline
{\em port} & The port number for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a9c1dee4070b3ac1998bad8294307628b}{Datasource\+::set\+Port()}} for a method that allows this parameter to be set after the constructor. \\
\hline
{\em options} & Any options for the database driver for the new connection \\
\hline
{\em queue} & An optional \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive datasource events; note that the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} passed cannot have any maximum size set or a {\ttfamily Q\+U\+E\+U\+E-\/\+E\+R\+R\+OR} will be thrown; passing \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} will clear any event queue \\
\hline
{\em arg} & an optional argument to be included in the {\ttfamily arg} key of datasource events\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
Datasource db(DSPGSQL, \textcolor{stringliteral}{"user"}, \textcolor{stringliteral}{"pass"}, \textcolor{stringliteral}{"database"}, \textcolor{stringliteral}{"utf8"}, \textcolor{stringliteral}{"localhost"}, 5432);
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em D\+A\+T\+A\+S\+O\+U\+R\+C\+E-\/\+U\+N\+S\+U\+P\+P\+O\+R\+T\+E\+D-\/\+D\+A\+T\+A\+B\+A\+SE} & D\+BI driver cannot be loaded \\
\hline
{\em D\+A\+T\+A\+S\+O\+U\+R\+C\+E-\/\+C\+O\+N\+S\+T\+R\+U\+C\+T\+O\+R-\/\+E\+R\+R\+OR} & port value is $<$= 0 \\
\hline
{\em D\+B\+I-\/\+O\+P\+T\+I\+O\+N-\/\+E\+R\+R\+OR} & unknown or unsupported option passed to driver \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ad4729c1b5bbe81448527f1b182a08a34}\label{class_qore_1_1_s_q_l_1_1_datasource_ad4729c1b5bbe81448527f1b182a08a34}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!constructor@{constructor}}
\index{constructor@{constructor}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily Qore\+::\+S\+Q\+L\+::\+Datasource\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{desc,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}}}]{queue,  }\item[{auto}]{arg }\end{DoxyParamCaption})}



Creates a \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object from a single string giving all parameters that can be parsed by \mbox{\hyperlink{group__dbi__functions_gad95f3a076d1818cc722c516543e29858}{parse\+\_\+datasource()}} 


\begin{DoxyParams}{Parameters}
{\em desc} & a datasource description string in the format that can be parsed by \mbox{\hyperlink{group__dbi__functions_gad95f3a076d1818cc722c516543e29858}{parse\+\_\+datasource()}} \\
\hline
{\em queue} & An optional \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive datasource events; note that the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} passed cannot have any maximum size set or a {\ttfamily Q\+U\+E\+U\+E-\/\+E\+R\+R\+OR} will be thrown; passing \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} will clear any event queue \\
\hline
{\em arg} & an optional argument to be included in the {\ttfamily arg} key of datasource events\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
Datasource ds(\textcolor{stringliteral}{"pgsql:user/pass@db01(utf8)%localhost:5432"});
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em D\+A\+T\+A\+S\+O\+U\+R\+C\+E-\/\+U\+N\+S\+U\+P\+P\+O\+R\+T\+E\+D-\/\+D\+A\+T\+A\+B\+A\+SE} & D\+BI driver cannot be loaded \\
\hline
{\em D\+A\+T\+A\+S\+O\+U\+R\+C\+E-\/\+C\+O\+N\+S\+T\+R\+U\+C\+T\+O\+R-\/\+E\+R\+RO} & missing required parameter for connection; port value is $<$= 0 \\
\hline
{\em D\+B\+I-\/\+O\+P\+T\+I\+O\+N-\/\+E\+R\+R\+OR} & unknown or unsupported option passed to driver\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a532848530d34877ef0e5d7a827c38d01}\label{class_qore_1_1_s_q_l_1_1_datasource_a532848530d34877ef0e5d7a827c38d01}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!constructor@{constructor}}
\index{constructor@{constructor}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{constructor()}{constructor()}\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily Qore\+::\+S\+Q\+L\+::\+Datasource\+::constructor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}}}]{opts,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}}}]{queue,  }\item[{auto}]{arg }\end{DoxyParamCaption})}



Creates a \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object from a hash argument giving parameters for the constructor. 


\begin{DoxyParams}{Parameters}
{\em opts} & a hash giving parameters for the new datasource with the following possible keys (the {\ttfamily \char`\"{}type\char`\"{}} key is mandatory, also usable with the output of the \mbox{\hyperlink{group__dbi__functions_gad95f3a076d1818cc722c516543e29858}{parse\+\_\+datasource()}} function)\+:
\begin{DoxyItemize}
\item {\ttfamily type\+:} (\mbox{\hyperlink{data_type_declarations_string_or_nothing_type}{$\ast$string}}) The name of the database driver to use; this key is mandatory; if not present, an exception will be raised. See \mbox{\hyperlink{group__sql__constants}{S\+QL Constants}} for builtin constants for D\+BI drivers shipped with \mbox{\hyperlink{namespace_qore}{Qore}}, or see the D\+BI driver documentation to use an add-\/on driver (this string should be the name of the driver to be loaded)
\item {\ttfamily user\+:} (\mbox{\hyperlink{data_type_declarations_string_or_nothing_type}{$\ast$string}}) The user name for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a86c204c7e2b1cceb46ca1f7ffeb007cd}{Datasource\+::set\+User\+Name()}} for a method that allows this parameter to be set after the constructor.
\item {\ttfamily pass\+:} (\mbox{\hyperlink{data_type_declarations_string_or_nothing_type}{$\ast$string}}) The password for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a1ecea098e3d8f0d256f088f85d8e4ae4}{Datasource\+::set\+Password()}} for a method that allows this parameter to be set after the constructor.
\item {\ttfamily db\+:} (\mbox{\hyperlink{data_type_declarations_string_or_nothing_type}{$\ast$string}}) The database name for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aaf2c93ad25bf3046a1a6b230f6482665}{Datasource\+::set\+D\+B\+Name()}} for a method that allows this parameter to be set after the constructor.
\item {\ttfamily charset\+:} (\mbox{\hyperlink{data_type_declarations_string_or_nothing_type}{$\ast$string}}) The database-\/specific name of the character encoding to use for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aa7559279ad45047f842fb9f9af7a025b}{Datasource\+::set\+D\+B\+Charset()}} for a method that allows this parameter to be set after the constructor. If no value is passed for this parameter, then the database character encoding corresponding to the default character encoding for the Qore process will be used instead.
\item {\ttfamily host\+:} (\mbox{\hyperlink{data_type_declarations_string_or_nothing_type}{$\ast$string}}) The host name for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a264ea9b1a20197fb4b9c2eaa972af7f3}{Datasource\+::set\+Host\+Name()}} for a method that allows this parameter to be set after the constructor.
\item {\ttfamily port\+:} (\mbox{\hyperlink{data_type_declarations_softint_type}{softint}}) The port number for the new connection. Also see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a9c1dee4070b3ac1998bad8294307628b}{Datasource\+::set\+Port()}} for a method that allows this parameter to be set after the constructor. If this key is present and is 0 then an exception will be raised.
\item {\ttfamily options\+:} (\mbox{\hyperlink{data_type_declarations_hash_or_nothing_type}{$\ast$hash}}) Any options for the new connection 
\end{DoxyItemize}\\
\hline
{\em queue} & An optional \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive datasource events; note that the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} passed cannot have any maximum size set or a {\ttfamily Q\+U\+E\+U\+E-\/\+E\+R\+R\+OR} will be thrown; passing \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} will clear any event queue \\
\hline
{\em arg} & an optional argument to be included in the {\ttfamily arg} key of datasource events\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
Datasource db((\textcolor{stringliteral}{"type"}: DSPGSQL, \textcolor{stringliteral}{"user"}: \textcolor{stringliteral}{"username"}, \textcolor{stringliteral}{"pass"}: \textcolor{stringliteral}{"password"}, \textcolor{stringliteral}{"db"}: \textcolor{stringliteral}{"database"}, \textcolor{stringliteral}{"charset"}: \textcolor{stringliteral}{"utf8"}
      , \textcolor{stringliteral}{"host"}: \textcolor{stringliteral}{"localhost"}, \textcolor{stringliteral}{"port"}: 5432);
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em D\+A\+T\+A\+S\+O\+U\+R\+C\+E-\/\+U\+N\+S\+U\+P\+P\+O\+R\+T\+E\+D-\/\+D\+A\+T\+A\+B\+A\+SE} & D\+BI driver cannot be loaded \\
\hline
{\em D\+A\+T\+A\+S\+O\+U\+R\+C\+E-\/\+C\+O\+N\+S\+T\+R\+U\+C\+T\+O\+R-\/\+E\+R\+R\+OR} & missing or invalid {\ttfamily \char`\"{}driver\char`\"{}} key, other key name not assigned to a string; port value is $<$= 0 \\
\hline
{\em D\+B\+I-\/\+O\+P\+T\+I\+O\+N-\/\+E\+R\+R\+OR} & unknown or unsupported option passed to driver \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a196d09ba7c9e3cb9e6a228593152b5fd}\label{class_qore_1_1_s_q_l_1_1_datasource_a196d09ba7c9e3cb9e6a228593152b5fd}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!copy@{copy}}
\index{copy@{copy}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{copy()}{copy()}}
{\footnotesize\ttfamily Qore\+::\+S\+Q\+L\+::\+Datasource\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Creates a new \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object with the same driver as the original and copies of all the connection parameters. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
Datasource new\_ds = ds.copy();
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a5661e26369193015c195166e52c6d121}\label{class_qore_1_1_s_q_l_1_1_datasource_a5661e26369193015c195166e52c6d121}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!current\+Thread\+In\+Transaction@{current\+Thread\+In\+Transaction}}
\index{current\+Thread\+In\+Transaction@{current\+Thread\+In\+Transaction}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{current\+Thread\+In\+Transaction()}{currentThreadInTransaction()}}
{\footnotesize\ttfamily bool Qore\+::\+S\+Q\+L\+::\+Datasource\+::current\+Thread\+In\+Transaction (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} if the current thread is in a transaction (i.\+e. holds the transaction lock), \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} if not. 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} if the current thread is in a transaction (i.\+e. holds the transaction lock), \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} if not
\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}
bool b = db.currentThreadInTransaction();
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_afb6307ab9be490fa5d770519bca9447c}{Datasource\+::transaction\+Tid()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+7 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a12ed8d5453f1737831bd03f11198766f}\label{class_qore_1_1_s_q_l_1_1_datasource_a12ed8d5453f1737831bd03f11198766f}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!describe@{describe}}
\index{describe@{describe}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{describe()}{describe()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::describe (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sql,  }\item[{}]{... }\end{DoxyParamCaption})}



Executes an S\+QL select statement on the server and returns a description of the result set as a hash. 

This method also accepts all bind parameters ({\ttfamily \%d}, {\ttfamily \%v}, {\ttfamily \%s}, etc) as documented in \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}{Binding by Value and Placeholder}}

This method does not retain the transaction lock if it was not already acquired before this method is called, so to execute select statements that begin a transaction (such as {\ttfamily \char`\"{}select for update\char`\"{}}), execute \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}{Datasource\+::begin\+Transaction()}} first to ensure that the transaction lock is dedicated to the calling thread.


\begin{DoxyParams}{Parameters}
{\em sql} & The S\+QL command to execute on the server \\
\hline
{\em ...} & Include any values to be bound (using {\ttfamily \%v} in the command string) or placeholder specifications (using {\ttfamily \+:}{\itshape key\+\_\+name} in the command string) in order after the command string\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hash describing the result set with the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily name\+:} the name of the column
\item {\ttfamily type\+:} a string giving the type of the column
\item {\ttfamily maxsize\+:} an integer giving the column size
\item {\ttfamily native\+\_\+type\+:} a string giving the native column type
\item {\ttfamily internal\+\_\+id\+:} an integer giving the native column type code
\end{DoxyItemize}
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
*hash h = db.describe(\textcolor{stringliteral}{"select * from example\_table where id = 1"});
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions
\end{DoxyNote}
\begin{DoxySince}{Since}
Qore 0.\+8.\+9 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a420a865a5ef78ddc110f90529a5b7967}\label{class_qore_1_1_s_q_l_1_1_datasource_a420a865a5ef78ddc110f90529a5b7967}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!destructor@{destructor}}
\index{destructor@{destructor}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{destructor()}{destructor()}}
{\footnotesize\ttfamily Qore\+::\+S\+Q\+L\+::\+Datasource\+::destructor (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Closes the datasource if it\textquotesingle{}s open (if any operations are in progress, will block until the operations complete) and destroys the object. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
delete db;
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em D\+A\+T\+A\+S\+O\+U\+R\+C\+E-\/\+T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+E\+X\+C\+E\+P\+T\+I\+ON} & The \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} was destroyed while a transaction was still in progress; the transaction will be automatically rolled back \\
\hline
\end{DoxyExceptions}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a226b0fa3f5fdc4da16d8dda6703f1fdb}\label{class_qore_1_1_s_q_l_1_1_datasource_a226b0fa3f5fdc4da16d8dda6703f1fdb}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!exec@{exec}}
\index{exec@{exec}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{exec()}{exec()}}
{\footnotesize\ttfamily auto Qore\+::\+S\+Q\+L\+::\+Datasource\+::exec (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sql,  }\item[{}]{... }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Grabs the transaction lock (if autocommit is disabled) and executes an S\+QL command on the server and returns either the integer row count (for example, for updates, inserts, and deletes) or the data retrieved (for example, if a stored procedure is executed that returns values). 

This method also accepts all bind parameters ({\ttfamily \%d}, {\ttfamily \%v}, {\ttfamily \%s}, etc) as documented in \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}{Binding by Value and Placeholder}}


\begin{DoxyParams}{Parameters}
{\em sql} & The S\+QL command to execute on the server \\
\hline
{\em ...} & Include any values to be bound (using {\ttfamily \%v} in the command string) or placeholder specifications (using {\ttfamily \+:}{\itshape key\+\_\+name} in the command string) in order after the command string\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The return value depends on the D\+BI driver; normally, for commands with placeholders, a hash is returned holding the values acquired from executing the S\+QL statement. For all other commands, normally an integer row count is returned. However, some D\+BI drivers also allow select statements to be executed through this interface, which would also return a hash (column names) of lists (values for each column).
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
int rows = db.exec(\textcolor{stringliteral}{"insert into table (varchar\_col, timestamp\_col, blob\_col, numeric\_col) values (%v, %v,
       %v, %d)"}, string, \mbox{\hyperlink{group__date__and__time__functions_ga23f067a4f82596346d4fef09782e1945}{now}}(), binary, 100);
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions 
\end{DoxyNote}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a71cd33bd6be7230e8481b3b6a0d33892}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a4ec5865609884af9b0498a7f45b1042f}\label{class_qore_1_1_s_q_l_1_1_datasource_a4ec5865609884af9b0498a7f45b1042f}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!exec\+Raw@{exec\+Raw}}
\index{exec\+Raw@{exec\+Raw}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{exec\+Raw()}{execRaw()}}
{\footnotesize\ttfamily auto Qore\+::\+S\+Q\+L\+::\+Datasource\+::exec\+Raw (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sql }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Grabs the transaction lock (if autocommit is disabled) and executes an S\+QL command on the server and returns either the row count (for example, for updates and inserts) or the data retrieved (for example, if a stored procedure is executed that returns values) 

This method does not do any variable binding, so it\textquotesingle{}s useful for example for D\+DL statements etc

\begin{DoxyParagraph}{Warning\+:}
Using this method to execute pure dynamic S\+QL many times with different S\+QL strings (as opposed to using the same string and binding by value instead of dynamic S\+QL) can affect application performance by prohibiting the efficient usage of the DB server\textquotesingle{}s statement cache. See DB server documentation for variable binding and the S\+QL statement cache for more information.
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em sql} & The S\+QL command to execute on the server; this string will not be subjected to any transformations for variable binding\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The return value depends on the D\+BI driver; normally, for commands with placeholders, a hash is returned holding the values acquired from executing the S\+QL statement. For all other commands, normally an integer row count is returned. However, some D\+BI drivers also allow select statements to be executed through this interface, which would also return a hash (column names) of lists (values for each column).
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.execRaw(\textcolor{stringliteral}{"create table my\_tab (id number, some\_text varchar2(30))"});
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions 
\end{DoxyNote}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a8ebf9c0e5bb529dab200ab95ab36a5d4}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a4b4bbaca92649d27b858fb0996dc86fd}\label{class_qore_1_1_s_q_l_1_1_datasource_a4b4bbaca92649d27b858fb0996dc86fd}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Auto\+Commit@{get\+Auto\+Commit}}
\index{get\+Auto\+Commit@{get\+Auto\+Commit}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Auto\+Commit()}{getAutoCommit()}}
{\footnotesize\ttfamily bool Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Auto\+Commit (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the autocommit status for the object. 

\begin{DoxyReturn}{Returns}
the autocommit status for the object
\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}
bool b = db.getAutoCommit();
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_add2d683039a2bc2b01df63621b698e6e}\label{class_qore_1_1_s_q_l_1_1_datasource_add2d683039a2bc2b01df63621b698e6e}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Capabilities@{get\+Capabilities}}
\index{get\+Capabilities@{get\+Capabilities}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Capabilities()}{getCapabilities()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Capabilities (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns an integer bitfield of D\+BI driver capabilities. 

\begin{DoxyReturn}{Returns}
an integer bitfield of D\+BI driver capabilities; see \mbox{\hyperlink{group__dbi__capabilities}{D\+BI Capability Constants}} for the meaning of each bit
\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}
int caps = db.getCapabilities();
\textcolor{keywordflow}{if} (!(caps & DBI\_CAP\_TRANSACTION\_MANAGEMENT))
    throw \textcolor{stringliteral}{"DATASOURCE-ERROR"}, \mbox{\hyperlink{group__string__functions_ga7a74be141f814ef286046c367b21091c}{sprintf}}(\textcolor{stringliteral}{"DBI driver %y does not support transaction management"}, 
      db.getDriverName());
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a760f8a33542561ec680d37b956890e99}\label{class_qore_1_1_s_q_l_1_1_datasource_a760f8a33542561ec680d37b956890e99}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Capability\+List@{get\+Capability\+List}}
\index{get\+Capability\+List@{get\+Capability\+List}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Capability\+List()}{getCapabilityList()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga8f596b49953b71928f04c24b19834bc3}{list}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Capability\+List (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a list of strings giving the capabilities of the current D\+BI driver. 

\begin{DoxyReturn}{Returns}
a list of strings giving the capabilities of the current D\+BI driver
\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}
\mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"driver %y has the following capabilities:\(\backslash\)n"}, db.getDriverName());
foreach string cap \textcolor{keywordflow}{in} (db.getCapabilityList())
    \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"- %s\(\backslash\)n"}, cap);
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a0074fed1b53e9b94f811f3b8481b1df4}\label{class_qore_1_1_s_q_l_1_1_datasource_a0074fed1b53e9b94f811f3b8481b1df4}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Client\+Version@{get\+Client\+Version}}
\index{get\+Client\+Version@{get\+Client\+Version}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Client\+Version()}{getClientVersion()}}
{\footnotesize\ttfamily auto Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Client\+Version (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Retrieves the driver-\/specific client library version information; this method may not be implemented for all drivers. 

\begin{DoxyReturn}{Returns}
the driver-\/specific client library version information; this method may not be implemented for all drivers; see the D\+BI driver documentation for the return data type and format
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
auto ver = db.getClientVersion();
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for possible exceptions 
\end{DoxyNote}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_ad188ffb22d7cb8274fa8fa4255a28b8f}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a68c63cda68bd98860f332e6335e7a642}\label{class_qore_1_1_s_q_l_1_1_datasource_a68c63cda68bd98860f332e6335e7a642}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Config\+Hash@{get\+Config\+Hash}}
\index{get\+Config\+Hash@{get\+Config\+Hash}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Config\+Hash()}{getConfigHash()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Config\+Hash (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Returns a \mbox{\hyperlink{group__dbi__functions_datasource_hash}{datasource hash}} describing the configuration of the current object. 

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

\begin{DoxyCode}
hash h = ds.getConfigHash();
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{group__dbi__functions_datasource_hash}{datasource hash}} describing the configuration of the current object
\end{DoxyReturn}
This method does not require a connection to the server. The return value may differ for connected and unconnected objects, as the DB driver may set default option values when the datasource is connected.

\begin{DoxySince}{Since}
Qore 0.\+8.\+8 
\end{DoxySince}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a56a8cd699fe33e3c3b9f57e416608ccd}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a7713f26c809821a7942a60e27f924742}\label{class_qore_1_1_s_q_l_1_1_datasource_a7713f26c809821a7942a60e27f924742}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Config\+String@{get\+Config\+String}}
\index{get\+Config\+String@{get\+Config\+String}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Config\+String()}{getConfigString()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Config\+String (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Returns a string giving the configuration of the current object in a format that can be parsed by \mbox{\hyperlink{group__dbi__functions_gad95f3a076d1818cc722c516543e29858}{parse\+\_\+datasource()}} 

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

\begin{DoxyCode}
string str = ds.getConfigString();
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a string giving the configuration of the current object in a format that can be parsed by \mbox{\hyperlink{group__dbi__functions_gad95f3a076d1818cc722c516543e29858}{parse\+\_\+datasource()}}
\end{DoxyReturn}
This method does not require a connection to the server. The return value may differ for connected and unconnected objects, as the DB driver may set default option values when the datasource is connected.

\begin{DoxySince}{Since}
Qore 0.\+8.\+8 
\end{DoxySince}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a79772d8676975c1ab23710bc91d666ae}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ab3ba2ad96626d4c25dd818a7dc608f05}\label{class_qore_1_1_s_q_l_1_1_datasource_ab3ba2ad96626d4c25dd818a7dc608f05}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+D\+B\+Charset@{get\+D\+B\+Charset}}
\index{get\+D\+B\+Charset@{get\+D\+B\+Charset}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+D\+B\+Charset()}{getDBCharset()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+D\+B\+Charset (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Retrieves the database-\/specific charset set encoding for the current connection. 

A method synonym for \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ad3f499b4fc704c38b5cb064362b54501}{Datasource\+::get\+D\+B\+Encoding()}} kept for backwards-\/compatibility.

\begin{DoxyReturn}{Returns}
the database-\/specific charset set encoding for the current connection
\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}
string enc = db.getDBCharset();
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ad3f499b4fc704c38b5cb064362b54501}\label{class_qore_1_1_s_q_l_1_1_datasource_ad3f499b4fc704c38b5cb064362b54501}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+D\+B\+Encoding@{get\+D\+B\+Encoding}}
\index{get\+D\+B\+Encoding@{get\+D\+B\+Encoding}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+D\+B\+Encoding()}{getDBEncoding()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+D\+B\+Encoding (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Retrieves the database-\/specific charset set encoding for the current connection. 

\begin{DoxyReturn}{Returns}
the database-\/specific charset set encoding for the current connection
\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}
string enc = db.getDBEncoding();
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aae5a12ff32342c13df0cee4503e2f898}{Datasource\+::get\+O\+S\+Encoding()}}; 
\end{DoxySeeAlso}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_ae48205e644161ffd52fcbf10a8b75292}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_aa0084434a2631b776ce4cfa7075e5f01}\label{class_qore_1_1_s_q_l_1_1_datasource_aa0084434a2631b776ce4cfa7075e5f01}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+D\+B\+Name@{get\+D\+B\+Name}}
\index{get\+D\+B\+Name@{get\+D\+B\+Name}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+D\+B\+Name()}{getDBName()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+D\+B\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Returns the database name parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set. 

\begin{DoxyReturn}{Returns}
the database name parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set
\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}
*string db = db.getDBName();
\end{DoxyCode}
 
\end{DoxyParagraph}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a1e0d642801b1ce96fea0553ae4def964}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_aff2f886f27e033dd2bdcc49c22b2cd65}\label{class_qore_1_1_s_q_l_1_1_datasource_aff2f886f27e033dd2bdcc49c22b2cd65}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Driver\+Name@{get\+Driver\+Name}}
\index{get\+Driver\+Name@{get\+Driver\+Name}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Driver\+Name()}{getDriverName()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Driver\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Returns the name of the driver used for the object. 

\begin{DoxyReturn}{Returns}
the name of the driver used for the object
\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}
string driver = db.getDriverName();
\end{DoxyCode}
 
\end{DoxyParagraph}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a26a5370cb70baed85f0d3a51a8f36cf9}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a103526f8e3e4e0783523f3af89047190}\label{class_qore_1_1_s_q_l_1_1_datasource_a103526f8e3e4e0783523f3af89047190}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Host\+Name@{get\+Host\+Name}}
\index{get\+Host\+Name@{get\+Host\+Name}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Host\+Name()}{getHostName()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Host\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Returns the hostname parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set. 

\begin{DoxyReturn}{Returns}
the hostname parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set
\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}
*string host = db.getHostName();
\end{DoxyCode}
 
\end{DoxyParagraph}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a4ffcb9760eea609835734b27e7f97eac}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a34834d2da5e1e8f13949810e76a6e1cd}\label{class_qore_1_1_s_q_l_1_1_datasource_a34834d2da5e1e8f13949810e76a6e1cd}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Option@{get\+Option}}
\index{get\+Option@{get\+Option}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Option()}{getOption()}}
{\footnotesize\ttfamily auto Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Option (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{opt }\end{DoxyParamCaption})}



Returns the current value for the given option. 

\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 opt} & the option to get\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
in order to ensure atomicity when dealing with \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} options, the transaction lock is acquired before executing this method if it was not already owned by the calling thread
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em D\+B\+I-\/\+O\+P\+T\+I\+O\+N-\/\+E\+R\+R\+OR} & unknown or unsupported option passed to driver \\
\hline
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_acf95b2265f01756ea0d51806dc51973b}\label{class_qore_1_1_s_q_l_1_1_datasource_acf95b2265f01756ea0d51806dc51973b}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Option\+Hash@{get\+Option\+Hash}}
\index{get\+Option\+Hash@{get\+Option\+Hash}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Option\+Hash()}{getOptionHash()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Option\+Hash (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



returns the valid options for the driver associated with the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} with descriptions and current values for the current \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object 

\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{DoxyReturn}{Returns}
a hash 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
\item {\ttfamily \char`\"{}value\char`\"{}}\+: the current value of the option
\end{DoxyItemize}
\end{DoxyReturn}
\begin{DoxyNote}{Note}
in order to ensure atomicity when dealing with \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} options, the transaction lock is acquired before executing this method if it was not already owned by the calling thread
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a86bf7ff6686300ebcd270b3d09f508c9}\label{class_qore_1_1_s_q_l_1_1_datasource_a86bf7ff6686300ebcd270b3d09f508c9}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+O\+S\+Charset@{get\+O\+S\+Charset}}
\index{get\+O\+S\+Charset@{get\+O\+S\+Charset}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+O\+S\+Charset()}{getOSCharset()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+O\+S\+Charset (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the Qore character encoding name for the current connection as a string or {\ttfamily \char`\"{}(unknown)\char`\"{}} if none is set. 

\begin{DoxyReturn}{Returns}
the Qore character encoding name for the current connection as a string or {\ttfamily \char`\"{}(unknown)\char`\"{}} if none is set
\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}
string enc = db.getOSCharset();
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_aae5a12ff32342c13df0cee4503e2f898}{Datasource\+::get\+O\+S\+Encoding()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_aae5a12ff32342c13df0cee4503e2f898}\label{class_qore_1_1_s_q_l_1_1_datasource_aae5a12ff32342c13df0cee4503e2f898}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+O\+S\+Encoding@{get\+O\+S\+Encoding}}
\index{get\+O\+S\+Encoding@{get\+O\+S\+Encoding}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+O\+S\+Encoding()}{getOSEncoding()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+O\+S\+Encoding (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Returns the Qore character encoding name for the current connection as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set. 

\begin{DoxyReturn}{Returns}
the Qore character encoding for the current connection as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set
\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}
*string enc = db.getOSEncoding();
\end{DoxyCode}
 
\end{DoxyParagraph}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_ab5d951f88607a8f3580730c894cd4681}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ae8ecfbacb0245d1c2e5118352cfe9edb}\label{class_qore_1_1_s_q_l_1_1_datasource_ae8ecfbacb0245d1c2e5118352cfe9edb}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Password@{get\+Password}}
\index{get\+Password@{get\+Password}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Password()}{getPassword()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Password (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Returns the password parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set. 

\begin{DoxyReturn}{Returns}
the password parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set
\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}
*string \textcolor{keywordflow}{pass} = db.getPassword();
\end{DoxyCode}
 
\end{DoxyParagraph}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_ac245a7e0615433778ab7a61abf845c54}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ad8c4bde5992da775c95bd8b2a3340e19}\label{class_qore_1_1_s_q_l_1_1_datasource_ad8c4bde5992da775c95bd8b2a3340e19}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Port@{get\+Port}}
\index{get\+Port@{get\+Port}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Port()}{getPort()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Port (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Gets the port number that will be used for the next connection to the server. 

Invalid port numbers will cause an exception to be thrown when the connection is opened

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

\begin{DoxyCode}
*int port = db.getPort();
\end{DoxyCode}
 
\end{DoxyParagraph}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a54d89afe6d44810ed7e141ba35310748}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a35340d8cbadc2eb5b20ab9d8e0fc87eb}\label{class_qore_1_1_s_q_l_1_1_datasource_a35340d8cbadc2eb5b20ab9d8e0fc87eb}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Server\+Version@{get\+Server\+Version}}
\index{get\+Server\+Version@{get\+Server\+Version}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Server\+Version()}{getServerVersion()}}
{\footnotesize\ttfamily auto Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Server\+Version (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Returns the driver-\/specific server version data for the current connection. 

\begin{DoxyReturn}{Returns}
the driver-\/specific server version data for the current connection; see the D\+BI driver documentation for the return data type and format
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
auto ver = db.getServerVersion();
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions 
\end{DoxyNote}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_acd2bef573f9d703c9511efd38bc1c2ec}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a39ef1a8bff15788d039672359c28772e}\label{class_qore_1_1_s_q_l_1_1_datasource_a39ef1a8bff15788d039672359c28772e}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+S\+Q\+L\+Statement@{get\+S\+Q\+L\+Statement}}
\index{get\+S\+Q\+L\+Statement@{get\+S\+Q\+L\+Statement}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+S\+Q\+L\+Statement()}{getSQLStatement()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_s_q_l_statement}{Abstract\+S\+Q\+L\+Statement}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+S\+Q\+L\+Statement (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns an \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_s_q_l_statement}{Abstract\+S\+Q\+L\+Statement}} object based on the current database connection object. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
AbstractSQLStatement stmt = ds.getSQLStatement();
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em S\+Q\+L\+S\+T\+A\+T\+E\+M\+E\+N\+T-\/\+E\+R\+R\+OR} & the D\+BI driver for the given object does not support the prepared statement A\+PI\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
\mbox{\hyperlink{namespace_qore}{Qore}} 0.\+9.\+0 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_aadc509c6ff4daba5f528163ffd8e05dc}\label{class_qore_1_1_s_q_l_1_1_datasource_aadc509c6ff4daba5f528163ffd8e05dc}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+Transaction\+Lock\+Timeout@{get\+Transaction\+Lock\+Timeout}}
\index{get\+Transaction\+Lock\+Timeout@{get\+Transaction\+Lock\+Timeout}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+Transaction\+Lock\+Timeout()}{getTransactionLockTimeout()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+Transaction\+Lock\+Timeout (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Retrieves the transaction lock timeout value as an integer in milliseconds. 

\begin{DoxyReturn}{Returns}
the transaction lock timeout value as an integer in milliseconds
\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}
int to\_ms = db.getTransactionLockTimeout();
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a0b9c482becfbe8349a75e5a55370f88c}\label{class_qore_1_1_s_q_l_1_1_datasource_a0b9c482becfbe8349a75e5a55370f88c}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!get\+User\+Name@{get\+User\+Name}}
\index{get\+User\+Name@{get\+User\+Name}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{get\+User\+Name()}{getUserName()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::get\+User\+Name (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Returns the username parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set. 

\begin{DoxyReturn}{Returns}
the username parameter as a string or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if none is set
\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}
*string user = db.getUserName();
\end{DoxyCode}
 
\end{DoxyParagraph}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_aea226bb7ae548363ae25a4f1e306b34a}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_af74cb806c9e19c6099c0d2cce84a44ab}\label{class_qore_1_1_s_q_l_1_1_datasource_af74cb806c9e19c6099c0d2cce84a44ab}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!in\+Transaction@{in\+Transaction}}
\index{in\+Transaction@{in\+Transaction}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{in\+Transaction()}{inTransaction()}}
{\footnotesize\ttfamily bool Qore\+::\+S\+Q\+L\+::\+Datasource\+::in\+Transaction (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Returns \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} if a transaction is currently in progress, \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} if not. 

\begin{DoxyReturn}{Returns}
\mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} if a transaction is currently in progress, \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} if not
\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}
bool b = db.inTransaction();
\end{DoxyCode}
 
\end{DoxyParagraph}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_ac7fe5b3cf6789100950622138915517e}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_aa6a07369dd7563f1db552588f41e02e7}\label{class_qore_1_1_s_q_l_1_1_datasource_aa6a07369dd7563f1db552588f41e02e7}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!open@{open}}
\index{open@{open}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{open()}{open()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::open (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Opens a connection to the datasouce, using the connection parameters already set; an exception is thrown if any errors occur. 

If the connection is already open, then no action is taken.

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.open();
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for possible exceptions
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a4c8ae5e2b2d6c1386525eeb019abfb9b}{Datasource\+::reset()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a4c8ae5e2b2d6c1386525eeb019abfb9b}\label{class_qore_1_1_s_q_l_1_1_datasource_a4c8ae5e2b2d6c1386525eeb019abfb9b}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!reset@{reset}}
\index{reset@{reset}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{reset()}{reset()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::reset (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Closes and reopens the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}}. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.reset();
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions 
\end{DoxyNote}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_acdc71e3819dbc3bf8be24d60e75e7bb2}\label{class_qore_1_1_s_q_l_1_1_datasource_acdc71e3819dbc3bf8be24d60e75e7bb2}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!rollback@{rollback}}
\index{rollback@{rollback}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{rollback()}{rollback()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::rollback (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Rolls the current transaction back and releases the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_transaction_lock}{transaction lock}}. 

\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.rollback();
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions 
\end{DoxyNote}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_acccf4e46fb29f2d12700cc6feb0c9438}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}\label{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!select@{select}}
\index{select@{select}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{select()}{select()}}
{\footnotesize\ttfamily auto Qore\+::\+S\+Q\+L\+::\+Datasource\+::select (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sql,  }\item[{}]{... }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Executes an S\+QL select statement on the server and returns the result as a hash (column names) of lists (column values per row) 

The return format of this method is suitable for use with \mbox{\hyperlink{statements_context}{context statements}}, for easy iteration and processing of query results. Alternatively, the \mbox{\hyperlink{class_qore_1_1_hash_list_iterator}{Hash\+List\+Iterator}} class can be used to iterate the return value of this method.

Additionally, this format is a more efficient format than that returned by the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a41126ab5a3d9e11ee7dd6d7975dfd65a}{Datasource\+::select\+Rows()}} method, because the column names are not repeated for each row returned. Therefore, for retrieving anything greater than small amounts of data, it is recommended to use this method instead of \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a41126ab5a3d9e11ee7dd6d7975dfd65a}{Datasource\+::select\+Rows()}}.

This method also accepts all bind parameters ({\ttfamily \%d}, {\ttfamily \%v}, {\ttfamily \%s}, etc) as documented in \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}{Binding by Value and Placeholder}}

This method does not retain the transaction lock if it was not already acquired before this method is called, so to execute select statements that begin a transaction (such as {\ttfamily \char`\"{}select for update\char`\"{}}), execute \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}{Datasource\+::begin\+Transaction()}} first to ensure that the transaction lock is dedicated to the calling thread.


\begin{DoxyParams}{Parameters}
{\em sql} & The S\+QL command to execute on the server \\
\hline
{\em ...} & Include any values to be bound (using {\ttfamily \%v} in the command string) or placeholder specifications (using {\ttfamily \+:}{\itshape key\+\_\+name} in the command string) in order after the command string\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
This method returns a hash (the keys are the column names) of lists (the column data per row) when executed with an S\+QL select statement, however some D\+BI drivers allow any S\+QL to be executed through this method, in which case other data types can be returned (such as an integer for a row count or a hash for output parameters when executing a stored procedure). If no rows are found, a hash of column names assigned to empty lists is returned.
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
\textcolor{comment}{# bind a string and a date/time value by value in a query}
hash query = db.select(\textcolor{stringliteral}{"select * from table where varchar\_column = %v and timestamp\_column > %v"}, string, 2
      007-10-11T15:31:26.289);
\textcolor{keywordflow}{if} (query.firstValue())
    \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"got results\(\backslash\)n"});
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item See the documentation for the D\+BI driver being used for additional possible exceptions
\item This method returns all the data available immediately; to process query data piecewise, use the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} class
\end{DoxyItemize}
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a09cba17e3e0955069777c5548be0a22c}{Datasource\+::vselect()}}
\item \mbox{\hyperlink{class_qore_1_1zzz8hashzzz9_aab3d2e6e69d212dbe05de43136f14367}{Qore\+::zzz8hashzzz9\+::context\+Iterator()}}
\item \mbox{\hyperlink{statements_context}{context Statements}} 
\end{DoxyItemize}
\end{DoxySeeAlso}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a594c9f65813ada4668a67aca0a5c0331}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ad8c5f2e1e03853c9e8ff8109ead1dfc8}\label{class_qore_1_1_s_q_l_1_1_datasource_ad8c5f2e1e03853c9e8ff8109ead1dfc8}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!select\+Row@{select\+Row}}
\index{select\+Row@{select\+Row}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{select\+Row()}{selectRow()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::select\+Row (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sql,  }\item[{}]{... }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Executes an S\+QL select statement on the server and returns the first row as a hash (the column values) 

If more than one row is returned, then it is treated as an error and a {\ttfamily D\+B\+I-\/\+S\+E\+L\+E\+C\+T-\/\+R\+O\+W-\/\+E\+R\+R\+OR} is returned (however the D\+BI driver should raise its own exception here to avoid retrieving more than one row from the server). For a similar method taking a list for all bind arguments, see \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ac950d57929533b0ae08a3db269ed3bee}{Datasource\+::vselect\+Row()}}.

This method also accepts all bind parameters ({\ttfamily \%d}, {\ttfamily \%v}, {\ttfamily \%s}, etc) as documented in \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}{Binding by Value and Placeholder}}

This method does not retain the transaction lock if it was not already acquired before this method is called, so to execute select statements that begin a transaction (such as {\ttfamily \char`\"{}select for update\char`\"{}}), execute \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}{Datasource\+::begin\+Transaction()}} first to ensure that the transaction lock is dedicated to the calling thread.


\begin{DoxyParams}{Parameters}
{\em sql} & The S\+QL command to execute on the server \\
\hline
{\em ...} & Include any values to be bound (using {\ttfamily \%v} in the command string) or placeholder specifications (using {\ttfamily \+:}{\itshape key\+\_\+name} in the command string) in order after the command string\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
This method returns a hash (the keys are the column names) of row data or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if no row is found for the query when executed with an S\+QL select statement
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
*hash h = db.selectRow(\textcolor{stringliteral}{"select * from example\_table where id = 1"});
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock \\
\hline
{\em D\+B\+I-\/\+S\+E\+L\+E\+C\+T-\/\+R\+O\+W-\/\+E\+R\+R\+OR} & more than 1 row retrieved from the server\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions 
\end{DoxyNote}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a6d4bd90ff3b28a637b19254a7f09dfba}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a41126ab5a3d9e11ee7dd6d7975dfd65a}\label{class_qore_1_1_s_q_l_1_1_datasource_a41126ab5a3d9e11ee7dd6d7975dfd65a}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!select\+Rows@{select\+Rows}}
\index{select\+Rows@{select\+Rows}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{select\+Rows()}{selectRows()}}
{\footnotesize\ttfamily auto Qore\+::\+S\+Q\+L\+::\+Datasource\+::select\+Rows (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sql,  }\item[{}]{... }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Executes an S\+QL select statement on the server and returns the result as a list (rows) of hashes (the column values) 

The return format of this method is not as memory efficient as that returned by the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{Datasource\+::select()}} method, therefore for larger amounts of data, it is recommended to use \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{Datasource\+::select()}}.

The usual return value of this method can be iterated with the \mbox{\hyperlink{class_qore_1_1_list_hash_iterator}{List\+Hash\+Iterator}} class.

This method also accepts all bind parameters ({\ttfamily \%d}, {\ttfamily \%v}, {\ttfamily \%s}, etc) as documented in \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}{Binding by Value and Placeholder}}

This method does not retain the transaction lock if it was not already acquired before this method is called, so to execute select statements that begin a transaction (such as {\ttfamily \char`\"{}select for update\char`\"{}}), execute \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}{Datasource\+::begin\+Transaction()}} first to ensure that the transaction lock is dedicated to the calling thread.


\begin{DoxyParams}{Parameters}
{\em sql} & The S\+QL command to execute on the server \\
\hline
{\em ...} & Include any values to be bound (using {\ttfamily \%v} in the command string) or placeholder specifications (using {\ttfamily \+:}{\itshape key\+\_\+name} in the command string) in order after the command string\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Normally returns a list (rows) of hash (where the keys are the column names of each row) or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if no rows are found for the query, however some D\+BI drivers allow any S\+QL statement to be executed through this method (not only select statements), in this case other data types can be returned
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
*list list = db.selectRows(\textcolor{stringliteral}{"select * from example\_table"});
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item See the documentation for the D\+BI driver being used for additional possible exceptions
\item This method returns all the data available immediately; to process query data piecewise, use the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} class
\end{DoxyItemize}
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{Datasource\+::select()}} 
\end{DoxySeeAlso}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_af4a40e6be75f11ea926378b6815a9654}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a5c9bf476b32eb9394e90c252504889f0}\label{class_qore_1_1_s_q_l_1_1_datasource_a5c9bf476b32eb9394e90c252504889f0}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+Auto\+Commit@{set\+Auto\+Commit}}
\index{set\+Auto\+Commit@{set\+Auto\+Commit}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+Auto\+Commit()}{setAutoCommit()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+Auto\+Commit (\begin{DoxyParamCaption}\item[{bool}]{ac = {\ttfamily \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}}} }\end{DoxyParamCaption})}



Turns autocommit on or off for this object. 


\begin{DoxyParams}{Parameters}
{\em ac} & \mbox{\hyperlink{group__boolean__constants_ga3ba2df91713a6249449347131ea526c3}{True}} to turn on autocommit (a commit will be executed after every S\+QL call to the server), \mbox{\hyperlink{group__boolean__constants_ga9da2b9a8003cd3788e48305f8a00540f}{False}} to turn off autocommit (commits must be manually triggered) \\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.setAutoCommit(\textcolor{keyword}{False});
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_aa7559279ad45047f842fb9f9af7a025b}\label{class_qore_1_1_s_q_l_1_1_datasource_aa7559279ad45047f842fb9f9af7a025b}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+D\+B\+Charset@{set\+D\+B\+Charset}}
\index{set\+D\+B\+Charset@{set\+D\+B\+Charset}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+D\+B\+Charset()}{setDBCharset()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+D\+B\+Charset (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})}



Sets the database-\/specific character encoding name for the next connection to the server. 

This is a method synonym for the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a6b6b1e6098b0028a872b045ea3d811b8}{Datasource\+::set\+D\+B\+Encoding()}} method, kept for backwards-\/compatibility.

Invalid character encoding names will cause an exception to be thrown when the connection is opened.


\begin{DoxyParams}{Parameters}
{\em encoding} & the database-\/specific character encoding name for the next connection to the server\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.setDBCharset(encoding);
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a6b6b1e6098b0028a872b045ea3d811b8}\label{class_qore_1_1_s_q_l_1_1_datasource_a6b6b1e6098b0028a872b045ea3d811b8}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+D\+B\+Encoding@{set\+D\+B\+Encoding}}
\index{set\+D\+B\+Encoding@{set\+D\+B\+Encoding}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+D\+B\+Encoding()}{setDBEncoding()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+D\+B\+Encoding (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})}



Sets the database-\/specific character encoding name for the next connection to the server. 

Invalid character encoding names will cause an exception to be thrown when the connection is opened.


\begin{DoxyParams}{Parameters}
{\em encoding} & the database-\/specific character encoding name for the next connection to the server\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.setDBEncoding(encoding);
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_aaf2c93ad25bf3046a1a6b230f6482665}\label{class_qore_1_1_s_q_l_1_1_datasource_aaf2c93ad25bf3046a1a6b230f6482665}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+D\+B\+Name@{set\+D\+B\+Name}}
\index{set\+D\+B\+Name@{set\+D\+B\+Name}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+D\+B\+Name()}{setDBName()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+D\+B\+Name (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{db }\end{DoxyParamCaption})}



Sets the database name parameter for the time a connection to the server is established. 

Invalid database names will cause an exception to be thrown when the connection is opened


\begin{DoxyParams}{Parameters}
{\em db} & the database name parameter for the time a connection to the server is established\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.setDBName(db);
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ad4953ced1fde3271c67b0dc838756ebf}\label{class_qore_1_1_s_q_l_1_1_datasource_ad4953ced1fde3271c67b0dc838756ebf}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+Event\+Queue@{set\+Event\+Queue}}
\index{set\+Event\+Queue@{set\+Event\+Queue}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+Event\+Queue()}{setEventQueue()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+Event\+Queue (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Qore\+::\+Thread\+::\+Queue}}}]{queue,  }\item[{auto}]{arg }\end{DoxyParamCaption})}



Sets a queue object for D\+BI events on the datasource. 


\begin{DoxyParams}{Parameters}
{\em queue} & the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} object to receive datasource events; note that the \mbox{\hyperlink{class_qore_1_1_thread_1_1_queue}{Queue}} passed cannot have any maximum size set or a {\ttfamily Q\+U\+E\+U\+E-\/\+E\+R\+R\+OR} will be thrown; passing \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} will clear any event queue \\
\hline
{\em arg} & an argument to be included in the {\ttfamily arg} key of datasource events\\
\hline
\end{DoxyParams}

\begin{DoxyExceptions}{Exceptions}
{\em Q\+U\+E\+U\+E-\/\+E\+R\+R\+OR} & the Queue passed has a maximum size set\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+9 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a264ea9b1a20197fb4b9c2eaa972af7f3}\label{class_qore_1_1_s_q_l_1_1_datasource_a264ea9b1a20197fb4b9c2eaa972af7f3}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+Host\+Name@{set\+Host\+Name}}
\index{set\+Host\+Name@{set\+Host\+Name}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+Host\+Name()}{setHostName()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+Host\+Name (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{host }\end{DoxyParamCaption})}



Sets the hostname to use for the next connection to the server. 

Invalid hostnames will cause an exception to be thrown when the connection is opened.


\begin{DoxyParams}{Parameters}
{\em host} & the hostname to use for the next connection to the server\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.setHostName(host);
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ad64b2409e602054d6e29257442b8601e}\label{class_qore_1_1_s_q_l_1_1_datasource_ad64b2409e602054d6e29257442b8601e}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+Option@{set\+Option}}
\index{set\+Option@{set\+Option}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+Option()}{setOption()}}
{\footnotesize\ttfamily Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+Option (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{opt,  }\item[{auto}]{val }\end{DoxyParamCaption})}



sets an option for the datasource 


\begin{DoxyParams}{Parameters}
{\em opt} & the option to set \\
\hline
{\em val} & the value to set\\
\hline
\end{DoxyParams}
\begin{DoxyNote}{Note}
in order to ensure atomicity when dealing with \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} options, the transaction lock is acquired before executing this method if it was not already owned by the calling thread
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em D\+B\+I-\/\+O\+P\+T\+I\+O\+N-\/\+E\+R\+R\+OR} & unknown or unsupported option passed to driver \\
\hline
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+6 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a1ecea098e3d8f0d256f088f85d8e4ae4}\label{class_qore_1_1_s_q_l_1_1_datasource_a1ecea098e3d8f0d256f088f85d8e4ae4}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+Password@{set\+Password}}
\index{set\+Password@{set\+Password}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+Password()}{setPassword()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+Password (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{pass }\end{DoxyParamCaption})}



Sets the password parameter for the time a connection to the server is established. 

Invalid passwords will cause an exception to be thrown when the connection is opened


\begin{DoxyParams}{Parameters}
{\em pass} & the password parameter for the time a connection to the server is established\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.setPassword(\textcolor{keywordflow}{pass});
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a9c1dee4070b3ac1998bad8294307628b}\label{class_qore_1_1_s_q_l_1_1_datasource_a9c1dee4070b3ac1998bad8294307628b}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+Port@{set\+Port}}
\index{set\+Port@{set\+Port}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+Port()}{setPort()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+Port (\begin{DoxyParamCaption}\item[{softint}]{port = {\ttfamily 0} }\end{DoxyParamCaption})}



Sets the port number to use for the connection. 

Invalid port numbers will cause an exception to be thrown when the connection is opened


\begin{DoxyParams}{Parameters}
{\em port} & the port number to use for the connection\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.setPort(port);
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_aed11f75205cdbf0d16243c7ccc57d21a}\label{class_qore_1_1_s_q_l_1_1_datasource_aed11f75205cdbf0d16243c7ccc57d21a}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+Transaction\+Lock\+Timeout@{set\+Transaction\+Lock\+Timeout}}
\index{set\+Transaction\+Lock\+Timeout@{set\+Transaction\+Lock\+Timeout}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+Transaction\+Lock\+Timeout()}{setTransactionLockTimeout()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+Transaction\+Lock\+Timeout (\begin{DoxyParamCaption}\item[{timeout}]{timeout\+\_\+ms = {\ttfamily 0} }\end{DoxyParamCaption})}



Sets the transaction lock timeout value in milliseconds; set to 0 for no timeout. 


\begin{DoxyParams}{Parameters}
{\em timeout\+\_\+ms} & the transaction lock timeout value in milliseconds; set to 0 for no timeout. Like all Qore functions and methods taking timeout values, a \mbox{\hyperlink{basic_data_types_relative_dates}{relative date/time value}} may be passed instead of an integer to make the timeout units clear (ex\+: {\ttfamily 2500ms} for 2.\+5 seconds).\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.setTransactionLockTimeout(4s);
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a86c204c7e2b1cceb46ca1f7ffeb007cd}\label{class_qore_1_1_s_q_l_1_1_datasource_a86c204c7e2b1cceb46ca1f7ffeb007cd}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!set\+User\+Name@{set\+User\+Name}}
\index{set\+User\+Name@{set\+User\+Name}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{set\+User\+Name()}{setUserName()}}
{\footnotesize\ttfamily nothing Qore\+::\+S\+Q\+L\+::\+Datasource\+::set\+User\+Name (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{user }\end{DoxyParamCaption})}



Sets the username parameter for the time a connection to the server is established. 

Invalid usernames will cause an exception to be thrown when the connection is opened


\begin{DoxyParams}{Parameters}
{\em user} & the username parameter for the time a connection to the server is established\\
\hline
\end{DoxyParams}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
db.setUserName(user);
\end{DoxyCode}
 
\end{DoxyParagraph}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_afb6307ab9be490fa5d770519bca9447c}\label{class_qore_1_1_s_q_l_1_1_datasource_afb6307ab9be490fa5d770519bca9447c}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!transaction\+Tid@{transaction\+Tid}}
\index{transaction\+Tid@{transaction\+Tid}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{transaction\+Tid()}{transactionTid()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::transaction\+Tid (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns the T\+ID of the thread holding the transaction lock or -\/1 if it\textquotesingle{}s not currently held. 

If the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource}{Datasource}} object is used in a multithreaded context and if the transaction lock is not held by the current thread, then the transaction lock status could change at any time.

\begin{DoxyReturn}{Returns}
the T\+ID of the thread holding the transaction lock or -\/1 if it\textquotesingle{}s not currently held
\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}
int tid = db.transactionTid();
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a5661e26369193015c195166e52c6d121}{Datasource\+::current\+Thread\+In\+Transaction()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+7 
\end{DoxySince}
\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_aa85211061b4569eba8e40e26884592da}\label{class_qore_1_1_s_q_l_1_1_datasource_aa85211061b4569eba8e40e26884592da}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!vexec@{vexec}}
\index{vexec@{vexec}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{vexec()}{vexec()}}
{\footnotesize\ttfamily auto Qore\+::\+S\+Q\+L\+::\+Datasource\+::vexec (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sql,  }\item[{\+\_\+\+\_\+7\+\_\+ softlist}]{vargs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Grabs the transaction lock (if autocommit is disabled) and executes S\+QL code on the DB connection, taking a list for all bind arguments. 

Same as \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a226b0fa3f5fdc4da16d8dda6703f1fdb}{Datasource\+::exec()}} except takes an explicit list for bind arguments

This method also accepts all bind parameters ({\ttfamily \%d}, {\ttfamily \%v}, {\ttfamily \%s}, etc) as documented in \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}{Binding by Value and Placeholder}}


\begin{DoxyParams}{Parameters}
{\em sql} & The S\+QL command to execute on the server \\
\hline
{\em vargs} & Include any values to be bound (using {\ttfamily \%v} in the command string) or placeholder specifications (using {\ttfamily \+:}{\itshape key\+\_\+name} in the command string) in order after the command string\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The return value depends on the D\+BI driver; normally, for commands with placeholders, a hash is returned holding the values acquired from executing the S\+QL statement. For all other commands, normally an integer row count is returned. However, some D\+BI drivers also allow select statements to be executed through this interface, which would also return a hash (column names) of lists (values for each column).
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
int rows = db.vexec(\textcolor{stringliteral}{"insert into example\_table value (%v, %v, %v)"}, arg\_list);
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions 
\end{DoxyNote}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_aa9b7fdd4dc43ce6bac4399cd4c9271d0}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a09cba17e3e0955069777c5548be0a22c}\label{class_qore_1_1_s_q_l_1_1_datasource_a09cba17e3e0955069777c5548be0a22c}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!vselect@{vselect}}
\index{vselect@{vselect}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{vselect()}{vselect()}}
{\footnotesize\ttfamily auto Qore\+::\+S\+Q\+L\+::\+Datasource\+::vselect (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sql,  }\item[{\+\_\+\+\_\+7\+\_\+ softlist}]{vargs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Executes a select statement on the server and returns the results in a hash (column names) of lists (column values per row), taking a list for all bind arguments. 

The return format of this method is suitable for use with \mbox{\hyperlink{statements_context}{context statements}}, for easy iteration and processing of query results. Alternatively, the \mbox{\hyperlink{class_qore_1_1_hash_list_iterator}{Hash\+List\+Iterator}} class can be used to iterate the return value of this method.

This method also accepts all bind parameters ({\ttfamily \%d}, {\ttfamily \%v}, {\ttfamily \%s}, etc) as documented in \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}{Binding by Value and Placeholder}}

This method does not retain the transaction lock if it was not already acquired before this method is called, so to execute select statements that begin a transaction (such as {\ttfamily \char`\"{}select for update\char`\"{}}), execute \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}{Datasource\+::begin\+Transaction()}} first to ensure that the transaction lock is dedicated to the calling thread.


\begin{DoxyParams}{Parameters}
{\em sql} & The S\+QL command to execute on the server \\
\hline
{\em vargs} & Include any values to be bound (using {\ttfamily \%v} in the command string) or placeholder specifications (using {\ttfamily \+:}{\itshape key\+\_\+name} in the command string) in order after the command string\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Normally returns a hash (the keys are the column names) of list (each hash key\textquotesingle{}s value is a list giving the row data), however some D\+BI drivers allow any S\+QL statement to be executed through this method (not only select statements), in this case other data types can be returned. If no rows are found, a hash of column names assigned to empty lists is returned.
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
hash query = db.vselect(\textcolor{stringliteral}{"select * from example\_table where id = %v and name = %v"}, arg\_list);
\textcolor{keywordflow}{if} (query.firstValue())
    \mbox{\hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}}(\textcolor{stringliteral}{"got results\(\backslash\)n"});
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item See the documentation for the D\+BI driver being used for additional possible exceptions
\item This method returns all the data available immediately; to process query data piecewise, use the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} class
\end{DoxyItemize}
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{Datasource\+::select()}}
\item \mbox{\hyperlink{class_qore_1_1zzz8hashzzz9_aab3d2e6e69d212dbe05de43136f14367}{Qore\+::zzz8hashzzz9\+::context\+Iterator()}}
\item \mbox{\hyperlink{statements_context}{context Statements}} 
\end{DoxyItemize}
\end{DoxySeeAlso}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a68d0ca8c0e0410356723390a3ebc4c60}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_ac950d57929533b0ae08a3db269ed3bee}\label{class_qore_1_1_s_q_l_1_1_datasource_ac950d57929533b0ae08a3db269ed3bee}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!vselect\+Row@{vselect\+Row}}
\index{vselect\+Row@{vselect\+Row}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{vselect\+Row()}{vselectRow()}}
{\footnotesize\ttfamily \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga5182bb860e3837e1eb337e85a9b3ebd6}{hash}} Qore\+::\+S\+Q\+L\+::\+Datasource\+::vselect\+Row (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sql,  }\item[{\+\_\+\+\_\+7\+\_\+ softlist}]{vargs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Executes a select statement on the server and returns the first row as a hash (column names and values), taking a list for all bind arguments. 

This method is the same as the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ad8c5f2e1e03853c9e8ff8109ead1dfc8}{Datasource\+::select\+Row()}} method, except this method takes a single argument after the S\+QL command giving the list of bind value parameters

This method also accepts all bind parameters ({\ttfamily \%d}, {\ttfamily \%v}, {\ttfamily \%s}, etc) as documented in \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}{Binding by Value and Placeholder}}

This method does not retain the transaction lock if it was not already acquired before this method is called, so to execute select statements that begin a transaction (such as {\ttfamily \char`\"{}select for update\char`\"{}}), execute \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}{Datasource\+::begin\+Transaction()}} first to ensure that the transaction lock is dedicated to the calling thread.


\begin{DoxyParams}{Parameters}
{\em sql} & The S\+QL command to execute on the server \\
\hline
{\em vargs} & Include any values to be bound (using {\ttfamily \%v} in the command string) or placeholder specifications (using {\ttfamily \+:}{\itshape key\+\_\+name} in the command string) in order after the command string\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
This method returns a hash (the keys are the column names) of row data or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if no row is found for the query when executed with an S\+QL select statement
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
*hash h = db.vselectRow(\textcolor{stringliteral}{"select * from example\_table where id = %v and type = %v"}, arg\_list);
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}
see the documentation for the D\+BI driver being used for additional possible exceptions
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_ad8c5f2e1e03853c9e8ff8109ead1dfc8}{Datasource\+::select\+Row()}} 
\end{DoxySeeAlso}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_aa47f34f9939c398ba1a83f52453762bd}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

\mbox{\Hypertarget{class_qore_1_1_s_q_l_1_1_datasource_a8a6c1d5fce4c0822e6943c0e36484385}\label{class_qore_1_1_s_q_l_1_1_datasource_a8a6c1d5fce4c0822e6943c0e36484385}} 
\index{Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}!vselect\+Rows@{vselect\+Rows}}
\index{vselect\+Rows@{vselect\+Rows}!Qore\+::\+S\+Q\+L\+::\+Datasource@{Qore\+::\+S\+Q\+L\+::\+Datasource}}
\subsubsection{\texorpdfstring{vselect\+Rows()}{vselectRows()}}
{\footnotesize\ttfamily auto Qore\+::\+S\+Q\+L\+::\+Datasource\+::vselect\+Rows (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{sql,  }\item[{\+\_\+\+\_\+7\+\_\+ softlist}]{vargs }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [virtual]}}



Executes a select statement on the server and returns the results in a list (rows) of hashes (column names and values), taking a list for all bind arguments. 

Same as the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a41126ab5a3d9e11ee7dd6d7975dfd65a}{Datasource\+::select\+Rows()}} method, except this method takes a single argument after the S\+QL command giving the list of bind value parameters.

The usual return value of this method can be iterated with the \mbox{\hyperlink{class_qore_1_1_list_hash_iterator}{List\+Hash\+Iterator}} class.

The return format of this method is not as memory efficient as that returned by the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{Datasource\+::select()}} method, therefore for larger amounts of data, it is recommended to use \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a05b1d0d126d815b2d7578e5ce8b9a0de}{Datasource\+::select()}}.

This method also accepts all bind parameters ({\ttfamily \%d}, {\ttfamily \%v}, {\ttfamily \%s}, etc) as documented in \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_sql_binding}{Binding by Value and Placeholder}}

This method does not retain the transaction lock if it was not already acquired before this method is called, so to execute select statements that begin a transaction (such as {\ttfamily \char`\"{}select for update\char`\"{}}), execute \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a3be309ce31c8b980aaee71010c3048f0}{Datasource\+::begin\+Transaction()}} first to ensure that the transaction lock is dedicated to the calling thread.


\begin{DoxyParams}{Parameters}
{\em sql} & The S\+QL command to execute on the server \\
\hline
{\em vargs} & Include any values to be bound (using {\ttfamily \%v} in the command string) or placeholder specifications (using {\ttfamily \+:}{\itshape key\+\_\+name} in the command string) in order after the command string\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Normally returns a list (rows) of hash (where the keys are the column names of each row) or \mbox{\hyperlink{basic_data_types_nothing}{N\+O\+T\+H\+I\+NG}} if no rows are found for the query, however some D\+BI drivers allow any S\+QL statement to be executed through this method (not only select statements), in this case other data types can be returned
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}
*list list = db.vselectRows(\textcolor{stringliteral}{"select * from example\_table where id = %v and type = %v"}, arg\_list);
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em T\+R\+A\+N\+S\+A\+C\+T\+I\+O\+N-\/\+L\+O\+C\+K-\/\+T\+I\+M\+E\+O\+UT} & Timeout trying to acquire the transaction lock\\
\hline
\end{DoxyExceptions}
\begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item See the documentation for the D\+BI driver being used for additional possible exceptions
\item This method returns all the data available immediately; to process query data piecewise, use the \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_s_q_l_statement}{S\+Q\+L\+Statement}} class
\end{DoxyItemize}
\end{DoxyNote}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_datasource_a41126ab5a3d9e11ee7dd6d7975dfd65a}{Datasource\+::select\+Rows()}} 
\end{DoxySeeAlso}


Implements \mbox{\hyperlink{class_qore_1_1_s_q_l_1_1_abstract_datasource_a03dfbdadca1d9c93e432744262771b7d}{Qore\+::\+S\+Q\+L\+::\+Abstract\+Datasource}}.

