OCIPL Namespace Reference


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  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  OciDate
 wrapper for OCI DATE type More...
struct  OciDateArray
 OCI DATE type bind variable array. More...
struct  ocidatetime
 internal DATE representation 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 Documentation

typedef OciHandle<OCIBind> OCIPL::OciBindHandle

Definition at line 1173 of file ocipl.h.

typedef OciHandle<OCIDefine> OCIPL::OciDefineHandle

Definition at line 1174 of file ocipl.h.

typedef OciSimpleHandle<OCIDescribe> OCIPL::OciDescribe

OCI Describe Handles.

Definition at line 502 of file ocipl.h.

typedef OciSimpleHandle<OCIError> OCIPL::OciError

OCI Error Handles.

Definition at line 498 of file ocipl.h.

typedef OciDescriptor<OCIParam> OCIPL::OciParam

Definition at line 711 of file ocipl.h.


Enumeration Type Documentation

anonymous enum

Enumerator:
INT_NULL 

Definition at line 1221 of file ocipl.h.

01222 {INT_NULL = -1};

enum OCIPL::OCI_STATE

Enumerator:
OS_NONE 
OS_PREPARE 
OS_RELEASE 
OS_EXECUTE 
OS_FETCH 
OS_TRANSACTION 

Definition at line 327 of file ocipl.h.

00328                {
00329     OS_NONE,
00330     OS_PREPARE,
00331     OS_RELEASE,
00332     OS_EXECUTE,
00333     OS_FETCH,
00334     OS_TRANSACTION


Function Documentation

const TCHAR * OCIPL::get_oci_ptype_str ( ub1  type  ) 

Definition at line 1962 of file ocipl.cpp.

References TEXT.

01964 {
01965     switch(type) {
01966       case OCI_PTYPE_TABLE:         return TEXT("table");
01967       case OCI_PTYPE_VIEW:          return TEXT("view");
01968       case OCI_PTYPE_PROC:          return TEXT("procedure");
01969       case OCI_PTYPE_FUNC:          return TEXT("function");
01970       case OCI_PTYPE_PKG:           return TEXT("package");
01971       case OCI_PTYPE_TYPE:          return TEXT("user-defined type");
01972       case OCI_PTYPE_SYN:           return TEXT("synonym");
01973       case OCI_PTYPE_SEQ:           return TEXT("sequence");
01974       case OCI_PTYPE_COL:           return TEXT("column");
01975       case OCI_PTYPE_ARG:           return TEXT("argument");
01976       case OCI_PTYPE_LIST:          return TEXT("list");
01977       case OCI_PTYPE_TYPE_ATTR:     return TEXT("user-defined type's attribute");
01978       case OCI_PTYPE_TYPE_COLL:     return TEXT("collection type's element ");
01979       case OCI_PTYPE_TYPE_METHOD:   return TEXT("user-defined type's method");
01980       case OCI_PTYPE_TYPE_ARG:      return TEXT("user-defined type method's argument");
01981       case OCI_PTYPE_TYPE_RESULT:   return TEXT("user-defined type method's result");
01982 #if ORACLE_VERSION>=81
01983       case OCI_PTYPE_SCHEMA:        return TEXT("schema");
01984       case OCI_PTYPE_DATABASE:      return TEXT("database");
01985 #endif
01986     }
01987 
01988     return TEXT("unknown type");

int OCIPL::istspace ( TCHAR  c  )  [inline]

Definition at line 281 of file ocipl.h.

Referenced by OCIPL::OciDate::OciDate(), OCIPL::LoginPara::parse(), and OCIPL::SqlNumber::SqlNumber().

00283 {
00284 #ifdef UNICODE
00285     return _istspace((unsigned short)c);
00286 #else
00287     return isspace((unsigned char)c);
00288 #endif

Here is the caller graph for this function:

double OCIPL::number_to_double ( const oraclenumber &  val,
OCIError *  errh 
)

Definition at line 466 of file ocipl.cpp.

References oci_check_error().

Referenced by OCIPL::SqlNumberArray::get_double(), OCIPL::SqlNumber::get_double(), and number_to_int().

00467 {
00468     double x;
00469 
00470     sword res = OCINumberToReal(errh, (OCINumber*)&val, sizeof(x), &x);
00471     oci_check_error(errh, res);
00472 
00473     return x;
00474 }

Here is the call graph for this function:

Here is the caller graph for this function:

int OCIPL::number_to_int ( const oraclenumber &  val,
OCIError *  errh 
)

Definition at line 422 of file ocipl.cpp.

References number_to_double(), and oci_check_error().

Referenced by OCIPL::SqlNumberArray::get_int(), and OCIPL::SqlNumber::get_int().

00423 {
00424     int x;
00425 
00426 #if ORACLE_VERSION>=81
00427      // Oracle Version >= 8.1.x
00428     boolean isInt;
00429     sword res = OCINumberIsInt(errh, (OCINumber*)&val, &isInt);
00430 
00431     if (res==OCI_SUCCESS && isInt)
00432     {
00433         res = OCINumberToInt(errh, (OCINumber*)&val, sizeof(x), OCI_NUMBER_SIGNED, &x);
00434         oci_check_error(errh, res);
00435     }
00436     else
00437 #else
00438      // OCI.DLL of Oracle Version 8.0
00439     sword res = OCINumberToInt(errh, (OCINumber*)&val, sizeof(x), OCI_NUMBER_SIGNED, &x);
00440 
00441     if (res != OCI_SUCCESS)
00442 #endif
00443     {
00444         double d = number_to_double(val, errh);
00445 
00446         x = int(d + .5);
00447     }
00448 
00449     //x = atoi(str(true).c_str());
00450 
00451     return x;
00452 }

Here is the call graph for this function:

Here is the caller graph for this function:

tstring OCIPL::number_to_str ( const oraclenumber &  val,
OCIError *  errh,
const TCHAR *  fmt,
const TCHAR *  nls_fmt 
)

Definition at line 476 of file ocipl.cpp.

References _tcslen, oci_check_error(), and TCHAR.

Referenced by OCIPL::SqlNumberArray::str(), and OCIPL::SqlNumber::str().

00477 {
00478     OraText buffer[128];
00479     ub4 l = sizeof(buffer);
00480 
00481     sword res = OCINumberToText(errh,
00482                         (OCINumber*)&val,
00483                         (const OraText*)fmt, (ub4)_tcslen(fmt)*sizeof(TOraText),
00484                         (const OraText*)nls_fmt, (ub4)_tcslen(nls_fmt)*sizeof(TOraText),
00485                         &l, buffer);
00486 
00487     oci_check_error(errh, res);
00488 
00489 //  const TCHAR* p = (const TCHAR*)buffer;
00490 //  while(istspace(*p))
00491 //      ++p;
00492 
00493     return (const TCHAR*)buffer;//p
00494 }

Here is the call graph for this function:

Here is the caller graph for this function:

void OCIPL::oci_check_error ( OciEnv &  env,
sword  res 
) [inline]

Definition at line 729 of file ocipl.h.

References OCIPL::OciEnv::_errh, and oci_check_error().

00731 {
00732     oci_check_error(env._errh, res);    // doesn't throw an exception for res==OCI_SUCCESS_WITH_INFO

Here is the call graph for this function:

void OCIPL::oci_check_error ( OCIEnv *  envh,
sword  res 
) [inline]

Definition at line 722 of file ocipl.h.

References throw_oci_exception().

00724 {
00725     if (res != OCI_SUCCESS)
00726         throw_oci_exception(envh, res); // doesn't throw an exception for res==OCI_SUCCESS_WITH_INFO

Here is the call graph for this function:

void OCIPL::oci_check_error ( OCIError *  errh,
sword  res 
) [inline]

Definition at line 715 of file ocipl.h.

References throw_oci_exception().

Referenced by OCIPL::OciHandle< OCIServer >::alloc(), OCIPL::OciSimpleHandle< OCIEnv >::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< OCIEnv >::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< OCIEnv >::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().

00717 {
00718     if (res != OCI_SUCCESS)
00719         throw_oci_exception(errh, res); // doesn't throw an exception for res==OCI_SUCCESS_WITH_INFO

Here is the call graph for this function:

Here is the caller graph for this function:

struct tm * OCIPL::ocidate_to_gmt ( const OCIDate date  )  [read]

Definition at line 669 of file ocipl.cpp.

Referenced by OCIPL::OciDateArray::get_gmt(), and OCIPL::OciDate::get_gmt().

00670 {
00671     struct tm ltime = {
00672         date.OCIDateTime.OCITimeSS,
00673         date.OCIDateTime.OCITimeMI,
00674         date.OCIDateTime.OCITimeHH,
00675         date.OCIDateDD,
00676         date.OCIDateMM - 1,
00677         date.OCIDateYYYY - 1900,
00678         -1,
00679         -1,
00680         -1
00681     };
00682 
00683     time_t time = mktime(&ltime);
00684 
00685 #ifdef __STDC_WANT_SECURE_LIB__
00686     struct tm newtime;
00687     gmtime_s(&newtime, &time);
00688     struct tm* gmt = &newtime;
00689 #else
00690     struct tm* gmt = gmtime(&time);
00691 #endif
00692 
00693     return gmt;
00694 }

Here is the caller graph for this function:

struct tm * OCIPL::ocidate_to_lctime ( const OCIDate date  )  [read]

Definition at line 696 of file ocipl.cpp.

Referenced by OCIPL::OciDateArray::get_lctime(), OCIPL::OciDate::get_lctime(), and ocidate_to_time_t().

00697 {
00698     struct tm ltime = {
00699         date.OCIDateTime.OCITimeSS,
00700         date.OCIDateTime.OCITimeMI,
00701         date.OCIDateTime.OCITimeHH,
00702         date.OCIDateDD,
00703         date.OCIDateMM - 1,
00704         date.OCIDateYYYY - 1900,
00705         -1,
00706         -1,
00707         -1
00708     };
00709 
00710     time_t time = mktime(&ltime);
00711 
00712 #ifdef __STDC_WANT_SECURE_LIB__
00713     struct tm newtime;
00714     localtime_s(&newtime, &time);
00715     struct tm* lct = &newtime;
00716 #else
00717     struct tm* lct = localtime(&time);
00718 #endif
00719 
00720     return lct;
00721 }

Here is the caller graph for this function:

tstring OCIPL::ocidate_to_short_string ( const OCIDate date  ) 

Definition at line 654 of file ocipl.cpp.

References _stprintf, COUNTOF, TCHAR, and TEXT.

Referenced by OCIPL::OciDateArray::short_str(), and OCIPL::OciDate::short_str().

00655 {
00656     TCHAR buffer[40];
00657 
00658 #ifdef __STDC_WANT_SECURE_LIB__
00659     _stprintf_s(buffer, COUNTOF(buffer),
00660 #else
00661     _stprintf(buffer,
00662 #endif
00663                 TEXT("%02d.%02d.%04d"),
00664                 date.OCIDateDD, date.OCIDateMM, date.OCIDateYYYY);
00665 
00666     return buffer;
00667 }

Here is the caller graph for this function:

tstring OCIPL::ocidate_to_string ( const OCIDate date  ) 

Definition at line 638 of file ocipl.cpp.

References _stprintf, COUNTOF, TCHAR, and TEXT.

Referenced by OCIPL::OciDateArray::str(), and OCIPL::OciDate::str().

00639 {
00640     TCHAR buffer[40];
00641 
00642 #ifdef __STDC_WANT_SECURE_LIB__
00643     _stprintf_s(buffer, COUNTOF(buffer),
00644 #else
00645     _stprintf(buffer,
00646 #endif
00647                 TEXT("%02d.%02d.%04d %02d:%02d:%02d"),
00648                 date.OCIDateDD, date.OCIDateMM, date.OCIDateYYYY,
00649                 date.OCIDateTime.OCITimeHH, date.OCIDateTime.OCITimeMI, date.OCIDateTime.OCITimeSS);
00650 
00651     return buffer;
00652 }

Here is the caller graph for this function:

time_t OCIPL::ocidate_to_time_t ( const OCIDate date  ) 

Definition at line 723 of file ocipl.cpp.

References ocidate_to_lctime().

Referenced by OCIPL::OciDateArray::get_time_t(), and OCIPL::OciDate::get_time_t().

00724 {
00725     time_t time = mktime(ocidate_to_lctime(date));
00726 
00727     return time;
00728 }

Here is the call graph for this function:

Here is the caller graph for this function:

tstring OCIPL::ocidatetime_to_string ( const ocidatetime &  date  ) 

Definition at line 758 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().

00759 {
00760     TCHAR buffer[40];
00761 
00762 #ifdef __STDC_WANT_SECURE_LIB__
00763     _stprintf_s(buffer, COUNTOF(buffer),
00764 #else
00765     _stprintf(buffer,
00766 #endif
00767                 TEXT("%02d.%02d.%04d %02d:%02d:%02d"),
00768                 date.day, date.month, 100*(date.century-100)+(date.year-100),
00769                 date.hour-1, date.minute-1, date.second-1);
00770 
00771     return buffer;
00772 }

Here is the caller graph for this function:

void OCIPL::throw_oci_exception ( OCIEnv *  envh,
sword  res 
)

Definition at line 122 of file ocipl.cpp.

References THROW_OCI_EXCEPTION.

00123 {
00124     switch(res) {
00125       case OCI_ERROR:
00126       case OCI_NO_DATA:
00127       case OCI_INVALID_HANDLE:
00128         THROW_OCI_EXCEPTION(envh);
00129 
00130         //@todo handle other error states
00131 
00132     }
00133 }

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().

00106 {
00107     switch(res) {
00108       case OCI_ERROR:
00109       case OCI_NO_DATA:
00110         THROW_OCI_EXCEPTION(errh);
00111         break;
00112 
00113       case OCI_INVALID_HANDLE:
00114         THROW_OCI_EXCEPTION("invalid handle");
00115         break;
00116 
00117         //@todo handle other error states
00118 
00119     }
00120 }

Here is the caller graph for this function:

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().

00056 {
00057     throw e;
00058 }

Here is the caller graph for this function:

static tstring OCIPL::tokenize ( const TCHAR **  ptr,
const TCHAR *  sep,
TCHAR  key 
) [static]

Definition at line 2007 of file ocipl.cpp.

References TEXT, and tokenize().

02009 {
02010     if (**ptr != key)
02011         return TEXT("");
02012 
02013     ++*ptr;
02014 
02015     return tokenize(ptr, sep);

Here is the call graph for this function:

static tstring OCIPL::tokenize ( const TCHAR **  ptr,
const TCHAR *  sep 
) [static]

Definition at line 1991 of file ocipl.cpp.

References _tcslen, _tcspbrk, and TCHAR.

Referenced by OCIPL::LoginPara::parse(), and tokenize().

01993 {
01994     const TCHAR* start = *ptr;
01995     const TCHAR* end;
01996 
01997     const TCHAR* found = _tcspbrk(*ptr, sep);
01998 
01999     if (found) {
02000         end = found;
02001         *ptr = found;
02002     } else
02003         *ptr = end = start + _tcslen(start);
02004 
02005     return tstring(start, end-start);

Here is the caller graph for this function:


Variable Documentation

int OCIPL::g_OCIPL_BULK_ROWS = 100

Definition at line 102 of file ocipl.cpp.


Generated on Wed Sep 29 00:05:12 2010 for OCIPL/C++ by  doxygen 1.5.4