DataTypeUtil.cpp (Firebird-3.0.2.32703-0.tar.bz2) | : | DataTypeUtil.cpp (Firebird-3.0.4.33054-0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
#include "firebird.h" | #include "firebird.h" | |||
#include "../jrd/DataTypeUtil.h" | #include "../jrd/DataTypeUtil.h" | |||
#include "../jrd/SysFunction.h" | #include "../jrd/SysFunction.h" | |||
#include "../jrd/align.h" | #include "../jrd/align.h" | |||
#include "../common/cvt.h" | #include "../common/cvt.h" | |||
#include "../common/dsc.h" | #include "../common/dsc.h" | |||
#include "../jrd/intl.h" | #include "../jrd/intl.h" | |||
#include "../common/dsc_proto.h" | #include "../common/dsc_proto.h" | |||
#include "../jrd/intl_proto.h" | #include "../jrd/intl_proto.h" | |||
#include "../common/gdsassert.h" | #include "../common/gdsassert.h" | |||
#include "../jrd/err_proto.h" | ||||
using namespace Firebird; | using namespace Firebird; | |||
SSHORT DataTypeUtilBase::getResultBlobSubType(const dsc* value1, const dsc* valu e2) | SSHORT DataTypeUtilBase::getResultBlobSubType(const dsc* value1, const dsc* valu e2) | |||
{ | { | |||
const SSHORT subType1 = value1->getBlobSubType(); | const SSHORT subType1 = value1->getBlobSubType(); | |||
const SSHORT subType2 = value2->getBlobSubType(); | const SSHORT subType2 = value2->getBlobSubType(); | |||
if (value1->isUnknown()) | if (value1->isUnknown()) | |||
return subType2; | return subType2; | |||
skipping to change at line 361 | skipping to change at line 360 | |||
{ | { | |||
return INTL_charset_lookup(tdbb, charSet)->maxBytesPerChar(); | return INTL_charset_lookup(tdbb, charSet)->maxBytesPerChar(); | |||
} | } | |||
USHORT DataTypeUtil::getDialect() const | USHORT DataTypeUtil::getDialect() const | |||
{ | { | |||
return (tdbb->getDatabase()->dbb_flags & DBB_DB_SQL_dialect_3) ? 3 : 1; | return (tdbb->getDatabase()->dbb_flags & DBB_DB_SQL_dialect_3) ? 3 : 1; | |||
} | } | |||
// Returns false if conversion is not needed. | // Returns false if conversion is not needed. | |||
bool DataTypeUtil::convertToUTF8(const string& src, string& dst, CHARSET_ID char set) | bool DataTypeUtil::convertToUTF8(const string& src, string& dst, CHARSET_ID char set, ErrorFunction err) | |||
{ | { | |||
thread_db* tdbb = JRD_get_thread_data(); | thread_db* tdbb = JRD_get_thread_data(); | |||
if (charset == CS_dynamic) | if (charset == CS_dynamic) | |||
{ | { | |||
fb_assert(tdbb->getAttachment()); | fb_assert(tdbb->getAttachment()); | |||
charset = tdbb->getAttachment()->att_charset; | charset = tdbb->getAttachment()->att_charset; | |||
} | } | |||
if (charset == CS_UTF8 || charset == CS_UNICODE_FSS) | if (charset == CS_UTF8 || charset == CS_UNICODE_FSS) | |||
skipping to change at line 392 | skipping to change at line 391 | |||
*p = (*s < 0 ? '?' : *s); | *p = (*s < 0 ? '?' : *s); | |||
} | } | |||
else // charset != CS_UTF8 | else // charset != CS_UTF8 | |||
{ | { | |||
DataTypeUtil dtUtil(tdbb); | DataTypeUtil dtUtil(tdbb); | |||
ULONG length = dtUtil.convertLength(src.length(), charset, CS_UTF 8); | ULONG length = dtUtil.convertLength(src.length(), charset, CS_UTF 8); | |||
length = INTL_convert_bytes(tdbb, | length = INTL_convert_bytes(tdbb, | |||
CS_UTF8, (UCHAR*) dst.getBuffer(length), length, | CS_UTF8, (UCHAR*) dst.getBuffer(length), length, | |||
charset, (const BYTE*) src.begin(), src.length(), | charset, (const BYTE*) src.begin(), src.length(), | |||
ERR_post); | err); | |||
dst.resize(length); | dst.resize(length); | |||
} | } | |||
return true; | return true; | |||
} | } | |||
} // namespace Jrd | } // namespace Jrd | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 2 lines changed or added |