mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-02-02 09:20:39 +01:00
Correction, thanks to Dmitry.
This commit is contained in:
parent
1e2493a252
commit
c7f5662d94
@ -226,7 +226,8 @@ Statement::Statement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb)
|
||||
}
|
||||
|
||||
// Turn a parsed scratch into a statement.
|
||||
Statement* Statement::makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag, dsc* exprDesc)
|
||||
Statement* Statement::makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag,
|
||||
std::function<void ()> beforeCsbRelease)
|
||||
{
|
||||
DEV_BLKCHK(csb, type_csb);
|
||||
SET_TDBB(tdbb);
|
||||
@ -302,16 +303,11 @@ Statement* Statement::makeStatement(thread_db* tdbb, CompilerScratch* csb, bool
|
||||
if (csb->csb_impure > MAX_REQUEST_SIZE)
|
||||
IBERROR(226); // msg 226 request size limit exceeded
|
||||
|
||||
if (beforeCsbRelease)
|
||||
beforeCsbRelease();
|
||||
|
||||
// Build the statement and the final request block.
|
||||
|
||||
if (exprDesc)
|
||||
{
|
||||
fb_assert(csb->csb_node->getKind() == DmlNode::KIND_VALUE);
|
||||
static_cast<ValueExprNode*>(csb->csb_node)->getDesc(tdbb, csb, exprDesc);
|
||||
}
|
||||
|
||||
const auto pool = tdbb->getDefaultPool();
|
||||
|
||||
statement = FB_NEW_POOL(*pool) Statement(tdbb, pool, csb);
|
||||
|
||||
tdbb->setRequest(old_request);
|
||||
@ -343,6 +339,19 @@ Statement* Statement::makeStatement(thread_db* tdbb, CompilerScratch* csb, bool
|
||||
return statement;
|
||||
}
|
||||
|
||||
Statement* Statement::makeValueExpression(thread_db* tdbb, ValueExprNode*& node, dsc& desc,
|
||||
CompilerScratch* csb, bool internalFlag)
|
||||
{
|
||||
fb_assert(csb->csb_node->getKind() == DmlNode::KIND_VALUE);
|
||||
|
||||
return makeStatement(tdbb, csb, internalFlag,
|
||||
[&]
|
||||
{
|
||||
node = static_cast<ValueExprNode*>(csb->csb_node);
|
||||
node->getDesc(tdbb, csb, &desc);
|
||||
});
|
||||
}
|
||||
|
||||
// Turn a parsed scratch into an executable request.
|
||||
Request* Statement::makeRequest(thread_db* tdbb, CompilerScratch* csb, bool internalFlag)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "../include/fb_blk.h"
|
||||
#include "../jrd/exe.h"
|
||||
#include "../jrd/EngineInterface.h"
|
||||
#include <functional>
|
||||
|
||||
namespace Jrd {
|
||||
|
||||
@ -45,7 +46,12 @@ private:
|
||||
Statement(thread_db* tdbb, MemoryPool* p, CompilerScratch* csb);
|
||||
|
||||
public:
|
||||
static Statement* makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag, dsc* exprDesc = nullptr);
|
||||
static Statement* makeStatement(thread_db* tdbb, CompilerScratch* csb, bool internalFlag,
|
||||
std::function<void ()> beforeCsbRelease = nullptr);
|
||||
|
||||
static Statement* makeValueExpression(thread_db* tdbb, ValueExprNode*& node, dsc& desc,
|
||||
CompilerScratch* csb, bool internalFlag);
|
||||
|
||||
static Request* makeRequest(thread_db* tdbb, CompilerScratch* csb, bool internalFlag);
|
||||
|
||||
StmtNumber getStatementId() const
|
||||
|
@ -2758,13 +2758,12 @@ static bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork*
|
||||
|
||||
if (!IDX.RDB$EXPRESSION_BLR.NULL)
|
||||
{
|
||||
idx.idx_expression = static_cast<ValueExprNode*>(MET_get_dependencies(
|
||||
tdbb, relation, NULL, 0, NULL, &IDX.RDB$EXPRESSION_BLR,
|
||||
MET_get_dependencies(tdbb, relation, nullptr, 0, nullptr, &IDX.RDB$EXPRESSION_BLR,
|
||||
nullptr, &csb, work->dfw_name, obj_expression_index, 0,
|
||||
transaction));
|
||||
transaction);
|
||||
|
||||
idx.idx_expression_statement = Statement::makeStatement(tdbb, csb, false,
|
||||
&idx.idx_expression_desc);
|
||||
idx.idx_expression_statement = Statement::makeValueExpression(tdbb,
|
||||
idx.idx_expression, idx.idx_expression_desc, csb, false);
|
||||
}
|
||||
} // end scope
|
||||
|
||||
|
@ -2621,12 +2621,10 @@ void MET_lookup_index_expression(thread_db* tdbb, jrd_rel* relation, index_desc*
|
||||
{ // scope
|
||||
Jrd::ContextPoolHolder context(tdbb, attachment->createPool());
|
||||
|
||||
idx->idx_expression = static_cast<ValueExprNode*>(MET_parse_blob(
|
||||
tdbb, relation, &IDX.RDB$EXPRESSION_BLR, &csb,
|
||||
nullptr, false, false));
|
||||
MET_parse_blob(tdbb, relation, &IDX.RDB$EXPRESSION_BLR, &csb, nullptr, false, false);
|
||||
|
||||
idx->idx_expression_statement = Statement::makeStatement(tdbb, csb, false,
|
||||
&idx->idx_expression_desc);
|
||||
idx->idx_expression_statement = Statement::makeValueExpression(tdbb,
|
||||
idx->idx_expression, idx->idx_expression_desc, csb, false);
|
||||
} // end scope
|
||||
}
|
||||
END_FOR
|
||||
|
Loading…
Reference in New Issue
Block a user