-
-
Notifications
You must be signed in to change notification settings - Fork 262
New 'UNLIST' function #8418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New 'UNLIST' function #8418
Changes from 2 commits
0167f8f
0653686
c7c6429
be29efd
dae3606
4e4420c
c4928d5
f0a8d10
b55d5b2
42bbb27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -22,7 +22,6 @@ | |||||
| #include "firebird.h" | ||||||
| #include "../dsql/ExprNodes.h" | ||||||
| #include "../dsql/StmtNodes.h" | ||||||
| #include "../jrd/align.h" | ||||||
| #include "../jrd/jrd.h" | ||||||
| #include "../jrd/mov_proto.h" | ||||||
| #include "../jrd/optimizer/Optimizer.h" | ||||||
|
|
@@ -36,7 +35,7 @@ using namespace Firebird; | |||||
| using namespace Jrd; | ||||||
|
|
||||||
| TableValueFunctionScan::TableValueFunctionScan(CompilerScratch* csb, StreamType stream, | ||||||
| const Firebird::string& alias) | ||||||
| const string& alias) | ||||||
| : RecordStream(csb, stream), m_alias(csb->csb_pool, alias) | ||||||
| { | ||||||
| m_impure = csb->allocImpure<Impure>(); | ||||||
|
|
@@ -60,6 +59,24 @@ void TableValueFunctionScan::close(thread_db* tdbb) const | |||||
| delete impure->m_recordBuffer; | ||||||
| impure->m_recordBuffer = nullptr; | ||||||
| } | ||||||
|
|
||||||
| if (impure->m_blob) | ||||||
| { | ||||||
| impure->m_blob->BLB_close(tdbb); | ||||||
| impure->m_blob = nullptr; | ||||||
| } | ||||||
|
|
||||||
| if (impure->m_separatorStr) | ||||||
| { | ||||||
| delete impure->m_separatorStr; | ||||||
| impure->m_separatorStr = nullptr; | ||||||
| } | ||||||
|
|
||||||
| if (impure->m_resultStr) | ||||||
| { | ||||||
| delete impure->m_resultStr; | ||||||
| impure->m_resultStr = nullptr; | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -78,13 +95,19 @@ bool TableValueFunctionScan::internalGetRecord(thread_db* tdbb) const | |||||
| } | ||||||
|
|
||||||
| rpb->rpb_number.increment(); | ||||||
|
|
||||||
| if (!impure->m_recordBuffer->fetch(rpb->rpb_number.getValue(), rpb->rpb_record)) | ||||||
| do | ||||||
| { | ||||||
| rpb->rpb_number.setValid(false); | ||||||
| return false; | ||||||
| } | ||||||
| return true; | ||||||
| if (!impure->m_recordBuffer->fetch(rpb->rpb_number.getValue(), rpb->rpb_record)) | ||||||
| { | ||||||
| if (!nextBuffer(tdbb)) | ||||||
| { | ||||||
| rpb->rpb_number.setValid(false); | ||||||
| return false; | ||||||
| } | ||||||
| continue; | ||||||
| } | ||||||
| return true; | ||||||
| } while (1); | ||||||
|
||||||
| } while (1); | |
| } while (true); |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not TableValueFunctionScan be an abstract class instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Others Firebird functions compare strings using collation rules.
Here this is disregard. Should it be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question to be discussed. Theoretically, one may ask to split the text into chunks by e.g. both 'A' and 'a' used as a case-insensitive separator 'a'. But honestly, I cannot imagine that being used in practice. And collation-aware compares would add some extra overhead. So maybe it's worth comparing byte-wise (converting both value and separator to the common data type, if necessary). Or maybe we should consider two code branches depending on whether byte-wise compare is possible or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't you mixing specifics of UnlistFunctionScan's impure in the base TableValueFunctionScan?