Skip to content

Checking if the result of a query or query_one function is not empty or nullptr - #499

Merged
mcserep merged 7 commits into
Ericsson:masterfrom
matebelenyesi:query_check
Feb 13, 2021
Merged

Checking if the result of a query or query_one function is not empty or nullptr#499
mcserep merged 7 commits into
Ericsson:masterfrom
matebelenyesi:query_check

Conversation

@matebelenyesi

Copy link
Copy Markdown
Contributor

No description provided.

matebelenyesiand others added 6 commits December 2, 2020 16:04
change convert function
move connection string modifying functions to dbutil
smaller typo and formatting fixes
change connenctionstring only with pgsql change back everything and adding quotation marks
In an earlier commit (a8a1502) there was a
bugfix which related to fetching "is virtual" tag of a function pointer. Of
course function pointers can't have this flag. This previous commit fixed this
issue on server-side, however, it was the parser's fault that the symbol type
in a call expression was set to function even if it was a function pointer.
CallExpr can be applied to a function pointer

@mcserepmcserep left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Since these cases should not occur, maybe add some warning messages to the output, so we can easily identify them later?

AstQuery::astType == model::CppAstNode::AstType::Definition);
nodes.insert(nodes.end(), result.begin(), result.end());
if(!result.empty())
nodes.insert(nodes.end(), result.begin(), result.end());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required? Does not the vector handles the empty range when inserting? (When first == last.)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is ok to v.insert( v.end(), ...)
Moreover, if we are about to insert the first element to the vector than we have an empty vector. So this fix may deny us to insert one (or more) elements.

FileQuery::id == std::stoull(range_.file));

if(!file)
return;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be joined with the following check.

@mcserepmcserep left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the requested changes in bc22f91.

@mcserep
mcserep merged commit c63d041 into Ericsson:masterFeb 13, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@matebelenyesi@zporky@mcserep@bruntib