simple OCI login to database
More...
#include <ocipl.h>
List of all members.
Public Types |
typedef OciHandle< OCISvcCtx > | super |
typedef OCISvcCtx | HandleType |
Public Member Functions |
| OciLogin (OciEnv &env) |
| OciLogin (OciEnv &env, const LoginPara &login_para) |
| OciLogin (OciEnv &env, const tstring &username, const tstring &password, const tstring &tnsname, ub4 mode=OCI_DEFAULT) |
void | connect (const LoginPara &login_para) |
void | connect (const tstring &username, const tstring &password, const tstring &tnsname, ub4 mode=OCI_DEFAULT) |
| ~OciLogin () |
void | disconnect () |
bool | connected () const |
void | commit (ub4 flags=OCI_DEFAULT) |
void | rollback (ub4 flags=OCI_DEFAULT) |
void | alloc () |
void | destroy () |
void | set_attribute (ub4 attrtype, const tstring &str) |
void | set_attribute (ub4 attrtype, ub4 value) |
void | set_attribute (ATTR &attr) |
void | get_attribute (dvoid *attributep, ub4 *sizep, ub4 attrtype) |
void | set_attribute_handle (ub4 attrtype, void *handle) |
| operator HandleType * () |
Static Public Member Functions |
static ub4 | get_type_id () |
static ub4 | get_attr_id () |
Public Attributes |
OracleServer | _server |
tstring | _warnings |
tstring | _tnsname |
OciEnv & | _env |
Protected Attributes |
OciContext | _ctx |
OciHandle< OCISession > | _session |
bool | _connected |
HandleType * | _handle |
Detailed Description
simple OCI login to database
Definition at line 944 of file ocipl.h.
Member Typedef Documentation
Constructor & Destructor Documentation
OCIPL::OciLogin::OciLogin |
( |
OciEnv & |
env ) |
[inline] |
OCIPL::OciLogin::OciLogin |
( |
OciEnv & |
env, |
|
|
const LoginPara & |
login_para |
|
) |
| [inline] |
OCIPL::OciLogin::OciLogin |
( |
OciEnv & |
env, |
|
|
const tstring & |
username, |
|
|
const tstring & |
password, |
|
|
const tstring & |
tnsname, |
|
|
ub4 |
mode = OCI_DEFAULT |
|
) |
| [inline] |
OCIPL::OciLogin::~OciLogin |
( |
) |
[inline] |
Member Function Documentation
Definition at line 596 of file ocipl.h.
{
if (_handle)
destroy();
sword res = OCIHandleAlloc(_env, (dvoid**)&_handle, super::get_type_id(), 0, 0);
oci_check_error(_env, res);
}
void OCIPL::OciLogin::commit |
( |
ub4 |
flags = OCI_DEFAULT ) |
[inline] |
void OCIPL::OciLogin::connect |
( |
const LoginPara & |
login_para ) |
[inline] |
void OCIPL::OciLogin::connect |
( |
const tstring & |
username, |
|
|
const tstring & |
password, |
|
|
const tstring & |
tnsname, |
|
|
ub4 |
mode = OCI_DEFAULT |
|
) |
| [inline] |
Definition at line 987 of file ocipl.h.
References OCIPL::oci_check_error(), and TCHAR.
{
_server.attach(tnsname);
_tnsname = tnsname;
_session.set_attribute(OCI_ATTR_USERNAME, username);
_session.set_attribute(OCI_ATTR_PASSWORD, password);
set_attribute(_server);
sword res = OCISessionBegin(_handle, _env._errh, _session, OCI_CRED_RDBMS, mode);
if (res!=OCI_SUCCESS && res!=OCI_SUCCESS_WITH_INFO) {
_server.detach();
oci_check_error(_env, res);
}
if (res == OCI_SUCCESS_WITH_INFO) {
TOraText buffer[1024];
sb4 errorcode;
sword res = OCIErrorGet(_env._errh, 1, NULL, &errorcode, (OraText*)buffer, sizeof(buffer), OCI_HTYPE_ERROR);
if (res == OCI_SUCCESS)
_warnings = (const TCHAR*)buffer;
}
_connected = true;
set_attribute(_session);
}
bool OCIPL::OciLogin::connected |
( |
) |
const [inline] |
void OCIPL::OciLogin::disconnect |
( |
) |
[inline] |
void OCIPL::OciHandle< OCISvcCtx >::get_attribute |
( |
dvoid * |
attributep, |
|
|
ub4 * |
sizep, |
|
|
ub4 |
attrtype |
|
) |
| [inline, inherited] |
Definition at line 629 of file ocipl.h.
{
sword res = OCIAttrGet(_handle, super::get_type_id(), attributep, sizep, attrtype, _env._errh);
oci_check_error(_env, res);
}
void OCIPL::OciLogin::rollback |
( |
ub4 |
flags = OCI_DEFAULT ) |
[inline] |
void OCIPL::OciHandle< OCISvcCtx >::set_attribute |
( |
ATTR & |
attr ) |
[inline, inherited] |
Definition at line 643 of file ocipl.h.
{
sword res = OCIAttrSet(_handle, super::get_type_id(), attr, 0, ATTR::get_attr_id(), _env._errh);
oci_check_error(_env, res);
}
void OCIPL::OciHandle< OCISvcCtx >::set_attribute |
( |
ub4 |
attrtype, |
|
|
ub4 |
value |
|
) |
| [inline, inherited] |
Definition at line 622 of file ocipl.h.
{
sword res = OCIAttrSet(_handle, super::get_type_id(), (OraText*)&value, (ub4)sizeof(value), attrtype, _env._errh);
oci_check_error(_env, res);
}
void OCIPL::OciHandle< OCISvcCtx >::set_attribute_handle |
( |
ub4 |
attrtype, |
|
|
void * |
handle |
|
) |
| [inline, inherited] |
Definition at line 636 of file ocipl.h.
{
sword res = OCIAttrSet(_handle, super::get_type_id(), handle, 0, attrtype, _env._errh);
oci_check_error(_env, res);
}
Member Data Documentation
The documentation for this struct was generated from the following file: