51 string err_str(
"Cannot convert type " );
53 err_str +=
" to type ";
63 string err_str(
"Cannot convert type " );
65 err_str +=
" to type ";
86 if (cur_type != type1) {
97 if (!(cur_type == type1 || cur_type == type2)) {
100 +
" but need either "
114 if (!(cur_type == type1 || cur_type == type2 || cur_type == type3)) {
117 +
" but need either "
143 const EDB_Type cur_type = m_Value.GetType();
151 return (
static_cast<const CDB_Bit&
>(m_Value).
Value() == 0 ? 0 : 1);
163 const EDB_Type cur_type = m_Value.GetType();
173 return (
static_cast<const CDB_Bit&
>(m_Value).
Value() == 0 ? 0 : 1);
185 const EDB_Type cur_type = m_Value.GetType();
207 const EDB_Type cur_type = m_Value.GetType();
231 const EDB_Type cur_type = m_Value.GetType();
257 const EDB_Type cur_type = m_Value.GetType();
287 const EDB_Type cur_type = m_Value.GetType();
316 static_cast<const char*
>(
static_cast<const CDB_Binary&
>(m_Value).
Value()),
317 static_cast<const CDB_Binary&
>(m_Value).Size()
336 strm.
Read(
const_cast<void*
>(
static_cast<const void*
>(
result.data())),
361 EDB_Type cur_type = m_Value.GetType();
385 if (m_Value.IsNULL()) {
396 if (m_Value.IsNULL()) {
400 const EDB_Type cur_type = m_Value.GetType();
408 return (
static_cast<const CDB_Bit&
>(m_Value).
Value() == 0 ? 0 : 1);
418 if (m_Value.IsNULL()) {
422 const EDB_Type cur_type = m_Value.GetType();
432 return (
static_cast<const CDB_Bit&
>(m_Value).
Value() == 0 ? 0 : 1);
442 if (m_Value.IsNULL()) {
446 const EDB_Type cur_type = m_Value.GetType();
466 if (m_Value.IsNULL()) {
470 const EDB_Type cur_type = m_Value.GetType();
492 if (m_Value.IsNULL()) {
496 const EDB_Type cur_type = m_Value.GetType();
520 if (m_Value.IsNULL()) {
524 const EDB_Type cur_type = m_Value.GetType();
550 if (m_Value.IsNULL()) {
556 const EDB_Type cur_type = m_Value.GetType();
585 static_cast<const char*
>(
static_cast<const CDB_Binary&
>(m_Value).
Value()),
586 static_cast<const CDB_Binary&
>(m_Value).Size()
605 strm.
Read(
const_cast<void*
>(
static_cast<const void*
>(
result.data())),
629 if (m_Value.IsNULL()) {
635 EDB_Type cur_type = m_Value.GetType();
651 template <
typename TO>
707 strm.
Read(
const_cast<void*
>(
static_cast<const void*
>(
result.data())),
719 template <
typename TO>
749 EDB_Type cur_type = m_Value.GetType();
753 return Convert_CDB_Object_DT<bool>(m_Value);
756 return Convert_CDB_Object<bool>(m_Value);
761 return Convert_CDB_Object<Uint1>(m_Value);
766 return Convert_CDB_Object<Int2>(m_Value);
771 return Convert_CDB_Object<Int4>(m_Value);
776 return Convert_CDB_Object<Int8>(m_Value);
781 return Convert_CDB_Object<float>(m_Value);
786 return Convert_CDB_Object<double>(m_Value);
791 EDB_Type cur_type = m_Value.GetType();
795 return Convert_CDB_Object_DT<string>(m_Value);
798 return Convert_CDB_Object<string>(m_Value);
806 EDB_Type cur_type = m_Value.GetType();
823 template <
typename TO>
827 if (
value.IsNULL()) {
881 strm.
Read(
const_cast<void*
>(
static_cast<const void*
>(
result.data())),
893 template <
typename TO>
897 if (
value.IsNULL()) {
925 EDB_Type cur_type = m_Value.GetType();
929 return Convert_CDB_ObjectSql_DT<bool>(m_Value);
932 return Convert_CDB_ObjectSql<bool>(m_Value);
937 return Convert_CDB_ObjectSql<Uint1>(m_Value);
942 return Convert_CDB_ObjectSql<Int2>(m_Value);
947 return Convert_CDB_ObjectSql<Int4>(m_Value);
952 return Convert_CDB_ObjectSql<Int8>(m_Value);
957 return Convert_CDB_ObjectSql<float>(m_Value);
962 return Convert_CDB_ObjectSql<double>(m_Value);
967 EDB_Type cur_type = m_Value.GetType();
971 return Convert_CDB_ObjectSql_DT<string>(m_Value);
974 return Convert_CDB_ObjectSql<string>(m_Value);
982 EDB_Type cur_type = m_Value.GetType();
#define DATABASE_DRIVER_ERROR(message, err_code)
const string & AsString(void) const
virtual size_t Read(void *buff, size_t nof_bytes)
static const char * GetTypeName(EDB_Type db_type, bool throw_on_unknown=true)
virtual size_t Size() const
uint8_t Uint1
1-byte (8-bit) unsigned integer
int16_t Int2
2-byte (16-bit) signed integer
int32_t Int4
4-byte (32-bit) signed integer
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
TO Convert_CDB_Object_DT(const CDB_Object &value)
void CheckType(const CDB_Object &value, EDB_Type type1)
void CheckNULL(const CDB_Object &value)
static void ReportTypeConvError(EDB_Type from_type, EDB_Type to_type)
TO Convert_CDB_Object(const CDB_Object &value)
TO Convert_CDB_ObjectSql(const CDB_Object &value)
TO Convert_CDB_ObjectSql_DT(const CDB_Object &value)
Static variables safety - create on demand, destroy on application termination.
static const char * str(char *buf, int n)
const value_slice::CValueConvert< value_slice::SRunTimeCP, FROM > Convert(const FROM &value)
const value_slice::CValueConvert< value_slice::SSafeCP, FROM > ConvertSafe(const FROM &value)
#define NCBI_CONVERT_TO(x, y)