Add needed columns to QueryBuilder explicitly
ClosedPublic

Authored by dkurz on Aug 23 2017, 6:45 PM.

Details

Summary

The former fullColumnNames approach relied on the number and order of
columns returned by fullColumnNames to not change. Requesting the
required column explicitly makes this more robust.

Diff Detail

Repository
R165 Akonadi
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dkurz created this revision.Aug 23 2017, 6:45 PM
Restricted Application added a project: KDE PIM. · View Herald TranscriptAug 23 2017, 6:45 PM
Restricted Application added a subscriber: KDE PIM. · View Herald Transcript
dkurz added a comment.Aug 23 2017, 6:50 PM

Yay, I used arcanist to create a review request for the first time!

Please let me know

  • if this should be pushed to Applications/17.08; it's obviously a bugfix, but I have no clue if it requires some push-to-stable preventing version bumps or something like that.
  • if you spot some obvious mistakes I did while using arcanist.

Also, how do I specify PIM as reviewer using arcanist? Using "arc cover" only gave "Daniel Vrátil", which I couldn't use as reviewer as it differs from your user name. I correctly guessed that I have to specify "dvratil" instead, but I have no clue for "KDE PIM".

dvratil edited edge metadata.Aug 23 2017, 8:17 PM

TagTable has 4 columns, so qb.addColums() on l. 77 adds 4 columns (indices 0 to 3, but we skip 3 because it's tag type ID which we don't care about in the extraction), on line 81 we add the type name column, which is 5th column (index 4), and optionally we add 6th column (remoteId) with index 5, so the current code should be correct....

However it's very error-prone as if the columns in TagTable change, the code will indeed break, so please fix the way the columns are queries (see my inline comment). Then your change in the result extraction will be also correct, because we can skip querying the 4th columns (idx 3).

Regarding arcanist: I think it's even harder and more annoying to use than just uploading patches via web. I don't use it, so I can't give you any advice on how to trick it into actually being helpful, rather than just plain annoying :D

src/server/handler/tagfetchhelper.cpp
77

Please replace this by

qb.addColumn(Tag::idFullColumnName());
qb.addColumn(Tag::gidFullColumnName());
qb.addColumn(Tag::parentIdFullColumnName());

so that the indices don't get broken again if we add another column to the table. Then the rest of your patch will actually be correct :)

dvratil requested changes to this revision.Aug 23 2017, 8:18 PM
This revision now requires changes to proceed.Aug 23 2017, 8:18 PM
dkurz updated this revision to Diff 18629.Aug 23 2017, 8:31 PM
dkurz edited edge metadata.

Added column names explicitly

dvratil accepted this revision.Aug 23 2017, 8:36 PM

Thanks! Commit to Applications/17.08 branch please, I'll merge it into master later.

This revision is now accepted and ready to land.Aug 23 2017, 8:36 PM
dkurz marked an inline comment as done.Aug 23 2017, 8:36 PM

I'll also update the commit message before I push this; my local changes somehow didn't make it through arcanist.

Last remaining question: which branch to commit against? master or Applications/17.08?

arcanist: I'll let you know when I got it figured out. I think you two had a bad start. To add PIM as reviewer using arcanist, you simply add <hashtag>kde_pim (putting an actual hashtag there in a comment automatically replaces it with the project; exactly what I was looking for ;-)

dkurz added a comment.Aug 23 2017, 8:38 PM

Now that was fast. Thanks for the fast reply. Trying arc land...

dkurz retitled this revision from Read correct query column indices when fetching tags to Add needed columns to QueryBuilder explicitly.Aug 23 2017, 8:48 PM
dkurz edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.