column type information More...
#include <ocipl.h>


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 |
column type information
Definition at line 1166 of file ocipl.h.
| 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();
}
Definition at line 1170 of file ocipl.h.
Referenced by OCIPL::ColumnType::init().
Definition at line 1168 of file ocipl.h.
Referenced by get_type_str(), OCIPL::ColumnType::init(), and OCIPL::SqlVariantArray::SqlVariantArray().
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().
Definition at line 1169 of file ocipl.h.
Referenced by get_type_str(), OCIPL::ColumnType::init(), and OCIPL::SqlVariantArray::SqlVariantArray().
1.7.2