Public Member Functions | Public Attributes

OCIPL::ColumnTypeInfo Struct Reference

column type information More...

#include <ocipl.h>

Inheritance diagram for OCIPL::ColumnTypeInfo:
Inheritance graph
[legend]
Collaboration diagram for OCIPL::ColumnTypeInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

tstring get_type_str (bool show_null=false) const

Public Attributes

ub2 _data_type
ub2 _width
ub1 _char_semantics
sb1 _scale
sb2 _precision
ub1 _nullable

Detailed Description

column type information

Definition at line 1166 of file ocipl.h.


Member Function Documentation

tstring OCIPL::ColumnTypeInfo::get_type_str ( bool  show_null = false ) const

Definition at line 863 of file ocipl.cpp.

References _data_type, _nullable, _precision, _scale, _width, and TEXT.

{
    tostringstream str;

    switch(_data_type) {
      case OCI_TYPECODE_CHAR:
        str << TEXT("CHAR(") << _width << TEXT(")");
        break;

      case OCI_TYPECODE_VARCHAR:
        str << TEXT("VARCHAR(") << _width << TEXT(")");
        break;

      case OCI_TYPECODE_VARCHAR2:
        str << TEXT("VARCHAR2(") << _width << TEXT(")");
        break;

      case OCI_TYPECODE_NUMBER:
        if (_precision == 0)
            str << TEXT("NUMBER");
        else if (_scale == -127) {
            if (_precision == 126)
                str << TEXT("FLOAT");
            else
                str << TEXT("FLOAT(") << (int)_precision << TEXT(")");
        } else if (_scale)
            str << TEXT("NUMBER(") << (int)_precision << TEXT(",") << (int)_scale << TEXT(")");
        else
            str << TEXT("NUMBER(") << (int)_precision << TEXT(")");
        break;

#ifdef SQLT_BFLOAT
      case OCI_TYPECODE_BFLOAT:
        str << TEXT("BINARY_FLOAT");
        break;

      case OCI_TYPECODE_BDOUBLE:
        str << TEXT("BINARY_DOUBLE");
        break;
#endif

      case OCI_TYPECODE_DATE:
        str << TEXT("DATE");
        break;

#if ORACLE_VERSION>=81
      case OCI_TYPECODE_TIMESTAMP:
        str << TEXT("TIMESTAMP");
        break;
#endif

      case OCI_TYPECODE_BLOB:
        str << TEXT("BLOB");
        break;

      case OCI_TYPECODE_BFILE:
        str << TEXT("BFILE");
        break;

      case OCI_TYPECODE_CLOB:
        str << TEXT("CLOB");
        break;

      case OCI_TYPECODE_CFILE:
        str << TEXT("CFILE");
        break;

      case SQLT_LNG:
        str << TEXT("LONG");
        break;

      default:
        str << TEXT("unknown");
    }

    if (show_null)
        if (!_nullable)
            str << TEXT(" NOT NULL");
        else
            str << TEXT(" NULL");

    return str.str();
}

Member Data Documentation

Definition at line 1170 of file ocipl.h.

Referenced by OCIPL::ColumnType::init().

Definition at line 1173 of file ocipl.h.

Referenced by get_type_str(), and OCIPL::ColumnType::init().

Definition at line 1172 of file ocipl.h.

Referenced by get_type_str(), and OCIPL::ColumnType::init().

Definition at line 1171 of file ocipl.h.

Referenced by get_type_str(), and OCIPL::ColumnType::init().


The documentation for this struct was generated from the following files: