Each session controls one connection to an Oracle database. Multiple sessions can be active and connected to different databases at the same time.
Definition at line 63 of file dbsession.h.
OSB_DB::Session::Session | ( | ) |
Empty default constructor.
OSB_DB::Session::Session | ( | const std::string & | username, | |
const std::string & | password, | |||
const std::string & | database | |||
) |
Constructor with connection settings.
It does not logon to the database.
username | Name of the database user. | |
password | Password for the database user. | |
database | TNS name of database instance. |
OSB_DB::Session::Session | ( | const Session & | ) |
Copy constructor.
It can be used only if the session is not connected.
OsbException | if the session is connected. |
OSB_DB::Session::~Session | ( | ) |
Destructor.
Calls logoff() if the session is still connected.
void OSB_DB::Session::alterSession | ( | std::string | clause | ) |
Specify or modify session specific options and settings. The session needs to be connected.
Use this command to execute any ALTER SESSION statement. Pass the statement in the clause string, the function will prepend "ALTER SESSION " and execute it.
clause | The alter session command that is executed on the database (without ALTER SESSION). |
void OSB_DB::Session::commit | ( | ) |
Commit a database transaction.
bool OSB_DB::Session::connected | ( | ) | const |
const std::string& OSB_DB::Session::database | ( | ) | const |
void OSB_DB::Session::logoff | ( | bool | msg = false |
) |
Logoff from the database.
msg | Write logoff message to Log? |
void OSB_DB::Session::logon | ( | const std::string & | username, | |
const std::string & | password, | |||
const std::string & | database, | |||
bool | msg = false | |||
) |
Logon to the database.
username | Database user. | |
password | Database password. | |
database | Database name. | |
msg | Write logon message to Log? |
OsbException | if the session is connected. |
void OSB_DB::Session::logon | ( | bool | msg = false |
) |
Logon to the database.
Uses the username, password and database supplied in the constructor to connect to the database.
msg | Write logon message to Log? |
OsbException | if the session is connected. |
OSB_DB::Session::operator otl_connect & | ( | ) | const |
Convery to a non-const otl_connect.
OsbException | if the session is not connected. |
void UnitGw::fetch(const Session& session) { otl_nocommit_stream dbSelect( FEW_ROWS, "SELECT unit_id, name " "FROM UNIT " "ORDER BY unit_id", session); }
Prevent assignment: not implemented.
const std::string& OSB_DB::Session::password | ( | ) | const |
void OSB_DB::Session::rollback | ( | ) |
Rollback a database transaction.
const std::string& OSB_DB::Session::username | ( | ) | const |
std::string OSB_DB::Session::database_ [private] |
const char* OSB_DB::Session::nlsDateFormat_ [static] |
OSB default date format for database statements.
Definition at line 72 of file dbsession.h.
otl_connect* OSB_DB::Session::otlConnect_ [mutable, private] |
std::string OSB_DB::Session::password_ [private] |
std::string OSB_DB::Session::username_ [private] |