Safir SDK Core
|
The Environment class models the necessary setup each application neeeds in order to access the database. More...
#include <Safir/Databases/Odbc/Environment.h>
Public Member Functions | |
Environment (void) | |
Constructor. More... | |
~Environment (void) | |
Destructor. More... | |
void | Alloc () |
Allocates a new environment for the database. More... | |
void | Free () |
Frees the environment previously allocated for the database. More... | |
void | SetEnvAttr (long lAttribute, long lValue) |
Sets an integer Environment attribute. More... | |
void | SetEnvAttr (long lAttribute, const std::wstring &wszValue, unsigned long ulLength) |
Sets an string Environment attribute. More... | |
void | GetEnvAttr (long lAttribute, long &lValue) const |
Gets the value of an integer Environment attribute. More... | |
void | GetEnvAttr (long lAttribute, wchar_t *wszValue, unsigned long ulLength) const |
Gets the value of a string Environment attribute. More... | |
bool | GetDiagRec (short sRecNumber, std::wstring &SqlState, boost::int32_t &NativeError, std::wstring &MessageText, bool &bDataRead) const |
Get a diagnostics record. More... | |
bool | IsValid () const |
Checks if this environment is a valid allocated environment. More... | |
SQLHENV | Handle () const |
Returns the ODBC Handle of the environment. More... | |
The Environment class models the necessary setup each application neeeds in order to access the database.
Only one Environment is necessary in a application and all environments needs to be Allocated and Deallocated before use.
Safir::Databases::Odbc::Environment::Environment | ( | void | ) |
Constructor.
Safir::Databases::Odbc::Environment::~Environment | ( | void | ) |
Destructor.
void Safir::Databases::Odbc::Environment::Alloc | ( | ) |
Allocates a new environment for the database.
See SQLAllocHandle in ODBC documentation for more info.
ReconnectException | - SQLAllocHandle failed. Check GetDiagRec for info. |
void Safir::Databases::Odbc::Environment::Free | ( | ) |
Frees the environment previously allocated for the database.
See SQLFreeHandle in ODBC documentation for more info.
bool Safir::Databases::Odbc::Environment::GetDiagRec | ( | short | sRecNumber, |
std::wstring & | SqlState, | ||
boost::int32_t & | NativeError, | ||
std::wstring & | MessageText, | ||
bool & | bDataRead | ||
) | const |
Get a diagnostics record.
See SQLGetDiagRec in ODBC documentation for more info.
[in] | sRecNumber | - The sql error record. Starts at 1. |
[out] | SqlState | - The five char sql state error code. |
[out] | NativeError | - Driver specific error code. |
[out] | MessageText | - The diagnostic message text string. |
[out] | bDataRead | - true if data has been placed in the buffers. |
void Safir::Databases::Odbc::Environment::GetEnvAttr | ( | long | lAttribute, |
long & | lValue | ||
) | const |
Gets the value of an integer Environment attribute.
Some attributes can be retrieved without allocating the environment first. See SQLGetEnvAttr in ODBC documentation for more info.
[in] | lAttribute | - An integer representing the attribute |
[out] | lValue | - The value of the attribute to be set |
ReconnectException | - SQLGetEnvAttr failed. Check GetDiagRec for info. |
void Safir::Databases::Odbc::Environment::GetEnvAttr | ( | long | lAttribute, |
wchar_t * | wszValue, | ||
unsigned long | ulLength | ||
) | const |
Gets the value of a string Environment attribute.
Some attributes can be retrieved without allocating the environment first. See SQLGetEnvAttr in ODBC documentation for more info.
[in] | lAttribute | - An integer representing the attribute |
[out] | wszValue | - The value of the attribute to be set |
[in] | ulLength | - The length of string. |
ReconnectException | - SQLGetEnvAttr failed. Check GetDiagRec for info. |
SQLHENV Safir::Databases::Odbc::Environment::Handle | ( | ) | const |
Returns the ODBC Handle of the environment.
bool Safir::Databases::Odbc::Environment::IsValid | ( | ) | const |
Checks if this environment is a valid allocated environment.
void Safir::Databases::Odbc::Environment::SetEnvAttr | ( | long | lAttribute, |
long | lValue | ||
) |
Sets an integer Environment attribute.
Some attributes can be set without allocating the environment first. See SQLSetEnvAttr in ODBC documentation for more info.
[in] | lAttribute | - An integer representing the attribute |
[in] | lValue | - The value of the attribute to be set |
ReconnectException | - SQLSetEnvAttr failed. Check GetDiagRec for info. |
void Safir::Databases::Odbc::Environment::SetEnvAttr | ( | long | lAttribute, |
const std::wstring & | wszValue, | ||
unsigned long | ulLength | ||
) |
Sets an string Environment attribute.
Some attributes can be set without allocating the environment first. See SQLSetEnvAttr in ODBC documentation for more info.
[in] | lAttribute | - An integer representing the attribute |
[in] | wszValue | - The value of the attribute to be set |
[in] | ulLength | - The length of string. |
ReconnectException | - SQLSetEnvAttr failed. Check GetDiagRec for info. |