mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 12:43:03 +01:00
This should fix #7760: Parameters inside the IN list may cause a string truncation error
This commit is contained in:
parent
2ca8e1fc16
commit
f457282e64
@ -1191,6 +1191,15 @@ BoolExprNode* InListBoolNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
|||||||
const auto node = FB_NEW_POOL(dsqlScratch->getPool())
|
const auto node = FB_NEW_POOL(dsqlScratch->getPool())
|
||||||
InListBoolNode(dsqlScratch->getPool(), procArg, procList);
|
InListBoolNode(dsqlScratch->getPool(), procArg, procList);
|
||||||
|
|
||||||
|
// Try to force arg to be same type as list eg: ? = (FIELD, ...) case
|
||||||
|
for (auto item : procList->items)
|
||||||
|
PASS1_set_parameter_type(dsqlScratch, node->arg, item, false);
|
||||||
|
|
||||||
|
// Try to force list to be same type as arg eg: FIELD = (?, ...) case
|
||||||
|
for (auto item : procList->items)
|
||||||
|
PASS1_set_parameter_type(dsqlScratch, item, node->arg, false);
|
||||||
|
|
||||||
|
// Derive a common data type for the list items
|
||||||
dsc argDesc;
|
dsc argDesc;
|
||||||
DsqlDescMaker::fromNode(dsqlScratch, &argDesc, procArg);
|
DsqlDescMaker::fromNode(dsqlScratch, &argDesc, procArg);
|
||||||
|
|
||||||
@ -1221,6 +1230,7 @@ BoolExprNode* InListBoolNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
|||||||
listDesc = commonDesc;
|
listDesc = commonDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cast to the common data type where necessary
|
||||||
for (auto& item : procList->items)
|
for (auto& item : procList->items)
|
||||||
{
|
{
|
||||||
const auto desc = item->getDsqlDesc();
|
const auto desc = item->getDsqlDesc();
|
||||||
@ -1249,14 +1259,6 @@ BoolExprNode* InListBoolNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to force arg to be same type as list eg: ? = (FIELD, ...) case
|
|
||||||
for (auto item : procList->items)
|
|
||||||
PASS1_set_parameter_type(dsqlScratch, node->arg, item, false);
|
|
||||||
|
|
||||||
// Try to force list to be same type as arg eg: FIELD = (?, ...) case
|
|
||||||
for (auto item : procList->items)
|
|
||||||
PASS1_set_parameter_type(dsqlScratch, item, node->arg, false);
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user