mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 17:23:03 +01:00
Merge pull request #8204 from FirebirdSQL/work/gh-8203
Fixed bug #8203 : Function MAKE_DBKEY may produce random errors if used with relation name
This commit is contained in:
parent
ed60d4d7a6
commit
c03852efc9
@ -12330,7 +12330,9 @@ DmlNode* SysFuncCallNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScrat
|
||||
|
||||
if (literal && literal->litDesc.isText())
|
||||
{
|
||||
const MetaName relName = literal->getText();
|
||||
MetaName relName;
|
||||
CVT2_make_metaname(&literal->litDesc, name, tdbb->getAttachment()->att_dec_status);
|
||||
|
||||
const jrd_rel* const relation = MET_lookup_relation(tdbb, relName);
|
||||
|
||||
if (relation)
|
||||
|
@ -972,12 +972,6 @@ public:
|
||||
return *reinterpret_cast<SLONG*>(litDesc.dsc_address);
|
||||
}
|
||||
|
||||
const char* getText() const
|
||||
{
|
||||
fb_assert(litDesc.dsc_dtype == dtype_text);
|
||||
return reinterpret_cast<const char*>(litDesc.dsc_address);
|
||||
}
|
||||
|
||||
void fixMinSInt32(MemoryPool& pool);
|
||||
void fixMinSInt64(MemoryPool& pool);
|
||||
void fixMinSInt128(MemoryPool& pool);
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "../jrd/blb_proto.h"
|
||||
#include "../jrd/cch_proto.h"
|
||||
#include "../jrd/cvt_proto.h"
|
||||
#include "../jrd/cvt2_proto.h"
|
||||
#include "../common/cvt.h"
|
||||
#include "../jrd/evl_proto.h"
|
||||
#include "../jrd/intl_proto.h"
|
||||
@ -5381,7 +5382,7 @@ dsc* evlMakeDbkey(Jrd::thread_db* tdbb, const SysFunction* function, const NestV
|
||||
if (argDsc->isText())
|
||||
{
|
||||
MetaName relName;
|
||||
MOV_get_metaname(tdbb, argDsc, relName);
|
||||
CVT2_make_metaname(argDsc, relName, tdbb->getAttachment()->att_dec_status);
|
||||
|
||||
const jrd_rel* const relation = MET_lookup_relation(tdbb, relName);
|
||||
if (!relation)
|
||||
|
@ -914,6 +914,28 @@ int CVT2_blob_compare(const dsc* arg1, const dsc* arg2, DecimalStatus decSt)
|
||||
}
|
||||
|
||||
|
||||
void CVT2_make_metaname(const dsc* desc, MetaName& name, DecimalStatus decSt)
|
||||
/**************************************
|
||||
*
|
||||
* C V T 2 _ m a k e _ m e t a n a m e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
*
|
||||
* Convert the data from the desc to a string in the metadata charset.
|
||||
* Then return the string as MetaName object.
|
||||
*
|
||||
**************************************/
|
||||
{
|
||||
MoveBuffer buff;
|
||||
UCHAR* ptr = nullptr;
|
||||
|
||||
const auto len = CVT2_make_string2(desc, CS_METADATA, &ptr, buff, decSt);
|
||||
name.assign(reinterpret_cast<const char*>(ptr), len);
|
||||
}
|
||||
|
||||
|
||||
USHORT CVT2_make_string2(const dsc* desc, USHORT to_interp, UCHAR** address, MoveBuffer& temp, DecimalStatus decSt)
|
||||
{
|
||||
/**************************************
|
||||
|
@ -31,6 +31,7 @@ extern const BYTE CVT2_compare_priority[];
|
||||
bool CVT2_get_binary_comparable_desc(dsc*, const dsc*, const dsc*);
|
||||
int CVT2_compare(const dsc*, const dsc*, Firebird::DecimalStatus);
|
||||
int CVT2_blob_compare(const dsc*, const dsc*, Firebird::DecimalStatus);
|
||||
void CVT2_make_metaname(const dsc* desc, Jrd::MetaName& name, Firebird::DecimalStatus);
|
||||
USHORT CVT2_make_string2(const dsc*, USHORT, UCHAR**, Jrd::MoveBuffer&, Firebird::DecimalStatus);
|
||||
|
||||
#endif // JRD_CVT2_PROTO_H
|
||||
|
Loading…
Reference in New Issue
Block a user