Classes | |
struct | OciException |
OCI Error handling. More... | |
struct | OciHandleID |
mapping between OCI handle types and the corresponding type and attribute constants More... | |
struct | OciSimpleHandle |
"simple" OCI handles without OciEnv More... | |
struct | OciHandleWrapper |
wrapping of already existing OCI handles without freeing them in destructor More... | |
struct | OciEnv |
OCI environment handles. More... | |
struct | OciEnvAlloc |
wrapper for the OCIEnv handle More... | |
struct | OciHandle |
OCI handles. More... | |
struct | OciDescriptor |
OCI descriptor handles. More... | |
struct | OracleServer |
encapsulation of the OCIServer handle, used in OCIPL::OciLogin More... | |
struct | LoginPara |
database login parameter structure More... | |
struct | OciContext |
struct | OciLogin |
simple OCI login to database More... | |
struct | OciConnection |
wrap OCIEnv and OCISvcCtx together More... | |
struct | DatabaseConnect |
DatabaseConnect to encapsulate all structures needed to connect to an Oracle database. More... | |
struct | ColumnTypeInfo |
column type information More... | |
struct | ColumnType |
column type description including name More... | |
struct | SqlInd |
Indicator variables are used to store information about the NULL-state of bind variables and result columns. More... | |
struct | SqlValue |
base class of bind variable structures containing the indicator variable More... | |
struct | SqlIndArray |
array of indicator variables More... | |
struct | SqlInt |
int wrapper with indicator variable More... | |
struct | SqlIntArray |
array of integer bind variable buffers More... | |
struct | SqlString |
string buffer bind variable structure More... | |
struct | SqlStringArray |
array of string bind variable buffers More... | |
struct | ocidatetime |
internal DATE representation More... | |
struct | OciDate |
wrapper for OCI DATE type More... | |
struct | OciDateArray |
OCI DATE type bind variable array. More... | |
struct | SqlDateTime |
wrapper for internal Oracle DATE type More... | |
struct | SqlDateTimeArray |
wrapper for internal Oracle DATE type More... | |
struct | oraclenumber |
internal NUMBER representation More... | |
struct | SqlNumber |
wrapper for internal Oracle NUMBER type More... | |
struct | SqlNumberArray |
array of NUMBER bind variable buffers More... | |
struct | OciLob |
base class for the BLOB/CLOB data holders OCIPL::OciLob and OCIPL::OciClob More... | |
struct | OciClob |
CLOB data holder structure. More... | |
struct | BindInput |
factory for call parameters of OCI bind functions More... | |
struct | BindOutput |
factory for call parameters of OCI bind functions More... | |
struct | TrimBindPar |
Binding of input strings with trimming to the specified maximum length. More... | |
struct | DefinePar |
factory for call parameters for OCI define functions More... | |
struct | LocalOciState |
struct | SqlStatement |
an OCI SQL statement More... | |
struct | SqlVariantArray |
variant array to be used as bind variable buffer More... | |
struct | SqlRecord |
a record to hold return columns for a given statement More... | |
struct | SqlResult |
class to retrieve query result values More... | |
struct | ResultIterator |
iterator utilizing bulk mode fetching More... | |
Typedefs | |
typedef OciSimpleHandle< OCIError > | OciError |
OCI Error Handles. | |
typedef OciSimpleHandle < OCIDescribe > | OciDescribe |
OCI Describe Handles. | |
typedef OciDescriptor< OCIParam > | OciParam |
typedef OciHandle< OCIBind > | OciBindHandle |
typedef OciHandle< OCIDefine > | OciDefineHandle |
Enumerations | |
enum | OCI_STATE { OS_NONE, OS_PREPARE, OS_RELEASE, OS_EXECUTE, OS_FETCH, OS_TRANSACTION } |
enum | { INT_NULL = -1 } |
Functions | |
void | throw_oci_exception (OCIError *errh, sword res) |
void | throw_oci_exception (OCIEnv *envh, sword res) |
int | number_to_int (const oraclenumber &val, OCIError *errh) |
double | number_to_double (const oraclenumber &val, OCIError *errh) |
tstring | number_to_str (const oraclenumber &val, OCIError *errh, const TCHAR *fmt, const TCHAR *nls_fmt) |
tstring | ocidate_to_string (const OCIDate &date) |
tstring | ocidate_to_short_string (const OCIDate &date) |
struct tm * | ocidate_to_gmt (const OCIDate &date) |
struct tm * | ocidate_to_lctime (const OCIDate &date) |
time_t | ocidate_to_time_t (const OCIDate &date) |
tstring | ocidatetime_to_string (const ocidatetime &date) |
const TCHAR * | get_oci_ptype_str (ub1 type) |
static tstring | tokenize (const TCHAR **ptr, const TCHAR *sep) |
static tstring | tokenize (const TCHAR **ptr, const TCHAR *sep, TCHAR key) |
int | istspace (TCHAR c) |
void | oci_check_error (OCIError *errh, sword res) |
void | oci_check_error (OCIEnv *envh, sword res) |
void | oci_check_error (OciEnv &env, sword res) |
void | throw_ocipl_exception (OciException e) |
This function is called to throw OCIPL Exceptions in response to Oracle Errors. | |
Variables | |
int | g_OCIPL_BULK_ROWS = 100 |
typedef OciHandle<OCIBind> OCIPL::OciBindHandle |
typedef OciHandle<OCIDefine> OCIPL::OciDefineHandle |
typedef OciSimpleHandle<OCIDescribe> OCIPL::OciDescribe |
typedef OciSimpleHandle<OCIError> OCIPL::OciError |
typedef OciDescriptor<OCIParam> OCIPL::OciParam |
enum OCIPL::OCI_STATE |
Definition at line 336 of file ocipl.h.
{ OS_NONE, OS_PREPARE, OS_RELEASE, OS_EXECUTE, OS_FETCH, OS_TRANSACTION };
const TCHAR * OCIPL::get_oci_ptype_str | ( | ub1 | type ) |
Definition at line 1978 of file ocipl.cpp.
References TEXT.
{ switch(type) { case OCI_PTYPE_TABLE: return TEXT("table"); case OCI_PTYPE_VIEW: return TEXT("view"); case OCI_PTYPE_PROC: return TEXT("procedure"); case OCI_PTYPE_FUNC: return TEXT("function"); case OCI_PTYPE_PKG: return TEXT("package"); case OCI_PTYPE_TYPE: return TEXT("user-defined type"); case OCI_PTYPE_SYN: return TEXT("synonym"); case OCI_PTYPE_SEQ: return TEXT("sequence"); case OCI_PTYPE_COL: return TEXT("column"); case OCI_PTYPE_ARG: return TEXT("argument"); case OCI_PTYPE_LIST: return TEXT("list"); case OCI_PTYPE_TYPE_ATTR: return TEXT("user-defined type's attribute"); case OCI_PTYPE_TYPE_COLL: return TEXT("collection type's element "); case OCI_PTYPE_TYPE_METHOD: return TEXT("user-defined type's method"); case OCI_PTYPE_TYPE_ARG: return TEXT("user-defined type method's argument"); case OCI_PTYPE_TYPE_RESULT: return TEXT("user-defined type method's result"); #if ORACLE_VERSION>=81 case OCI_PTYPE_SCHEMA: return TEXT("schema"); case OCI_PTYPE_DATABASE: return TEXT("database"); #endif } return TEXT("unknown type"); }
int OCIPL::istspace | ( | TCHAR | c ) | [inline] |
Definition at line 290 of file ocipl.h.
Referenced by OCIPL::OciDate::OciDate(), OCIPL::LoginPara::parse(), and OCIPL::SqlNumber::SqlNumber().
{ #ifdef UNICODE return _istspace((unsigned short)c); #else return isspace((unsigned char)c); #endif }
double OCIPL::number_to_double | ( | const oraclenumber & | val, |
OCIError * | errh | ||
) |
Definition at line 467 of file ocipl.cpp.
References oci_check_error().
Referenced by OCIPL::SqlNumberArray::get_double(), OCIPL::SqlNumber::get_double(), and number_to_int().
{ double x; sword res = OCINumberToReal(errh, (OCINumber*)&val, sizeof(x), &x); oci_check_error(errh, res); return x; }
int OCIPL::number_to_int | ( | const oraclenumber & | val, |
OCIError * | errh | ||
) |
Definition at line 423 of file ocipl.cpp.
References number_to_double(), and oci_check_error().
Referenced by OCIPL::SqlNumberArray::get_int(), and OCIPL::SqlNumber::get_int().
{ int x; #if ORACLE_VERSION>=81 // Oracle Version >= 8.1.x boolean isInt; sword res = OCINumberIsInt(errh, (OCINumber*)&val, &isInt); if (res==OCI_SUCCESS && isInt) { res = OCINumberToInt(errh, (OCINumber*)&val, sizeof(x), OCI_NUMBER_SIGNED, &x); oci_check_error(errh, res); } else #else // OCI.DLL of Oracle Version 8.0 sword res = OCINumberToInt(errh, (OCINumber*)&val, sizeof(x), OCI_NUMBER_SIGNED, &x); if (res != OCI_SUCCESS) #endif { double d = number_to_double(val, errh); x = int(d + .5); } //x = atoi(str(true).c_str()); return x; }
tstring OCIPL::number_to_str | ( | const oraclenumber & | val, |
OCIError * | errh, | ||
const TCHAR * | fmt, | ||
const TCHAR * | nls_fmt | ||
) |
Definition at line 477 of file ocipl.cpp.
References _tcslen, oci_check_error(), and TCHAR.
Referenced by OCIPL::SqlNumberArray::str(), and OCIPL::SqlNumber::str().
{ OraText buffer[128]; ub4 l = sizeof(buffer); sword res = OCINumberToText(errh, (OCINumber*)&val, (const OraText*)fmt, (ub4)_tcslen(fmt)*sizeof(TOraText), (const OraText*)nls_fmt, (ub4)_tcslen(nls_fmt)*sizeof(TOraText), &l, buffer); oci_check_error(errh, res); // const TCHAR* p = (const TCHAR*)buffer; // while(istspace(*p)) // ++p; return (const TCHAR*)buffer;//p }
void OCIPL::oci_check_error | ( | OCIError * | errh, |
sword | res | ||
) | [inline] |
Definition at line 724 of file ocipl.h.
References throw_oci_exception().
Referenced by OCIPL::OciHandle< OCIServer >::alloc(), OCIPL::OciSimpleHandle< OCIError >::alloc(), OCIPL::OciLob::append(), OCIPL::OracleServer::attach(), OCIPL::SqlStatement::bind_input(), OCIPL::SqlStatement::bind_output(), OCIPL::SqlStatement::bind_result(), OCIPL::OciConnection::cancel(), OCIPL::OciLob::clear(), OCIPL::OciContext::commit(), OCIPL::OciLogin::connect(), OCIPL::OciLob::copy(), OCIPL::OciDescriptor< TYPE >::destroy(), OCIPL::OciHandle< OCIServer >::destroy(), OCIPL::OciSimpleHandle< OCIError >::destroy(), OCIPL::OracleServer::detach(), OCIPL::OciLob::disable_buffering(), OCIPL::OciLogin::disconnect(), OCIPL::OciLob::enable_buffering(), OCIPL::OciLob::erase(), OCIPL::SqlStatement::execute_internal(), OCIPL::SqlStatement::fetch(), OCIPL::OciLob::flush(), OCIPL::OciDescriptor< TYPE >::get_attribute(), OCIPL::OciHandle< OCIServer >::get_attribute(), OCIPL::OciSimpleHandle< OCIError >::get_attribute(), OCIPL::OciLob::get_chunk_size(), OCIPL::SqlStatement::get_column_count(), OCIPL::SqlStatement::get_column_type(), OCIPL::SqlStatement::get_stmt_type(), OCIPL::ColumnType::init(), number_to_double(), number_to_int(), number_to_str(), oci_check_error(), OCIPL::OciDate::OciDate(), OCIPL::OciLob::OciLob(), OCIPL::OciLob::operator==(), OCIPL::SqlStatement::prepare(), OCIPL::OciClob::read(), OCIPL::OciContext::rollback(), OCIPL::SqlStatement::row_count(), OCIPL::OciHandle< OCIServer >::set_attribute(), OCIPL::OciHandle< OCIServer >::set_attribute_handle(), OCIPL::SqlNumber::SqlNumber(), OCIPL::OciLob::trim(), OCIPL::OciClob::write(), and OCIPL::OciLob::~OciLob().
{ if (res != OCI_SUCCESS) throw_oci_exception(errh, res); // doesn't throw an exception for res==OCI_SUCCESS_WITH_INFO }
void OCIPL::oci_check_error | ( | OCIEnv * | envh, |
sword | res | ||
) | [inline] |
Definition at line 731 of file ocipl.h.
References throw_oci_exception().
{ if (res != OCI_SUCCESS) throw_oci_exception(envh, res); // doesn't throw an exception for res==OCI_SUCCESS_WITH_INFO }
void OCIPL::oci_check_error | ( | OciEnv & | env, |
sword | res | ||
) | [inline] |
Definition at line 738 of file ocipl.h.
References OCIPL::OciEnv::_errh, and oci_check_error().
{ oci_check_error(env._errh, res); // doesn't throw an exception for res==OCI_SUCCESS_WITH_INFO }
struct tm * OCIPL::ocidate_to_gmt | ( | const OCIDate & | date ) | [read] |
Definition at line 670 of file ocipl.cpp.
Referenced by OCIPL::OciDateArray::get_gmt(), and OCIPL::OciDate::get_gmt().
{ struct tm ltime = { date.OCIDateTime.OCITimeSS, date.OCIDateTime.OCITimeMI, date.OCIDateTime.OCITimeHH, date.OCIDateDD, date.OCIDateMM - 1, date.OCIDateYYYY - 1900, -1, -1, -1 }; time_t time = mktime(<ime); assert(time!=-1); #ifdef __STDC_WANT_SECURE_LIB__ struct tm newtime; gmtime_s(&newtime, &time); struct tm* gmt = &newtime; #else struct tm* gmt = gmtime(&time); #endif return gmt; }
struct tm * OCIPL::ocidate_to_lctime | ( | const OCIDate & | date ) | [read] |
Definition at line 698 of file ocipl.cpp.
Referenced by OCIPL::OciDateArray::get_lctime(), OCIPL::OciDate::get_lctime(), and ocidate_to_time_t().
{ struct tm ltime = { date.OCIDateTime.OCITimeSS, date.OCIDateTime.OCITimeMI, date.OCIDateTime.OCITimeHH, date.OCIDateDD, date.OCIDateMM - 1, date.OCIDateYYYY - 1900, -1, -1, -1 }; time_t time = mktime(<ime); assert(time!=-1); #ifdef __STDC_WANT_SECURE_LIB__ struct tm newtime; localtime_s(&newtime, &time); struct tm* lct = &newtime; #else struct tm* lct = localtime(&time); #endif return lct; }
Definition at line 655 of file ocipl.cpp.
References _stprintf, COUNTOF, TCHAR, and TEXT.
Referenced by OCIPL::OciDateArray::short_str(), and OCIPL::OciDate::short_str().
{ TCHAR buffer[40]; #ifdef __STDC_WANT_SECURE_LIB__ _stprintf_s(buffer, COUNTOF(buffer), #else _stprintf(buffer, #endif TEXT("%02d.%02d.%04d"), date.OCIDateDD, date.OCIDateMM, date.OCIDateYYYY); return buffer; }
Definition at line 639 of file ocipl.cpp.
References _stprintf, COUNTOF, TCHAR, and TEXT.
Referenced by OCIPL::OciDateArray::str(), and OCIPL::OciDate::str().
{ TCHAR buffer[40]; #ifdef __STDC_WANT_SECURE_LIB__ _stprintf_s(buffer, COUNTOF(buffer), #else _stprintf(buffer, #endif TEXT("%02d.%02d.%04d %02d:%02d:%02d"), date.OCIDateDD, date.OCIDateMM, date.OCIDateYYYY, date.OCIDateTime.OCITimeHH, date.OCIDateTime.OCITimeMI, date.OCIDateTime.OCITimeSS); return buffer; }
time_t OCIPL::ocidate_to_time_t | ( | const OCIDate & | date ) |
Definition at line 726 of file ocipl.cpp.
References ocidate_to_lctime().
Referenced by OCIPL::OciDateArray::get_time_t(), and OCIPL::OciDate::get_time_t().
{ time_t time = mktime(ocidate_to_lctime(date)); assert(time!=-1); return time; }
tstring OCIPL::ocidatetime_to_string | ( | const ocidatetime & | date ) |
Definition at line 762 of file ocipl.cpp.
References _stprintf, OCIPL::ocidatetime::century, COUNTOF, OCIPL::ocidatetime::day, OCIPL::ocidatetime::hour, OCIPL::ocidatetime::minute, OCIPL::ocidatetime::month, OCIPL::ocidatetime::second, TCHAR, TEXT, and OCIPL::ocidatetime::year.
Referenced by OCIPL::SqlDateTimeArray::str(), and OCIPL::SqlDateTime::str().
{ TCHAR buffer[40]; #ifdef __STDC_WANT_SECURE_LIB__ _stprintf_s(buffer, COUNTOF(buffer), #else _stprintf(buffer, #endif TEXT("%02d.%02d.%04d %02d:%02d:%02d"), date.day, date.month, 100*(date.century-100)+(date.year-100), date.hour-1, date.minute-1, date.second-1); return buffer; }
void OCIPL::throw_oci_exception | ( | OCIEnv * | envh, |
sword | res | ||
) |
Definition at line 122 of file ocipl.cpp.
References THROW_OCI_EXCEPTION.
{ switch(res) { case OCI_ERROR: case OCI_NO_DATA: case OCI_INVALID_HANDLE: THROW_OCI_EXCEPTION(envh); //@todo handle other error states } }
void OCIPL::throw_oci_exception | ( | OCIError * | errh, |
sword | res | ||
) |
Definition at line 105 of file ocipl.cpp.
References THROW_OCI_EXCEPTION.
Referenced by oci_check_error().
{ switch(res) { case OCI_ERROR: case OCI_NO_DATA: THROW_OCI_EXCEPTION(errh); break; case OCI_INVALID_HANDLE: THROW_OCI_EXCEPTION("invalid handle"); break; //@todo handle other error states } }
void OCIPL::throw_ocipl_exception | ( | OciException | e ) |
This function is called to throw OCIPL Exceptions in response to Oracle Errors.
You can plug in your own version instead by implementing and linking another throw_ocipl_exception() function.
Definition at line 55 of file ocithrow.cpp.
Referenced by OCIPL::SqlStatement::execute_internal().
{
throw e;
}
static tstring OCIPL::tokenize | ( | const TCHAR ** | ptr, |
const TCHAR * | sep, | ||
TCHAR | key | ||
) | [static] |
static tstring OCIPL::tokenize | ( | const TCHAR ** | ptr, |
const TCHAR * | sep | ||
) | [static] |
Definition at line 2007 of file ocipl.cpp.
References _tcslen, _tcspbrk, and TCHAR.
Referenced by OCIPL::LoginPara::parse(), and tokenize().
{ const TCHAR* start = *ptr; const TCHAR* end; const TCHAR* found = _tcspbrk(*ptr, sep); if (found) { end = found; *ptr = found; } else *ptr = end = start + _tcslen(start); return tstring(start, end-start); }
int OCIPL::g_OCIPL_BULK_ROWS = 100 |