Page MenuHomePhabricator

Update PhabricatorLiskDAO::chunkSQL() for new %Q semantics
ClosedPublic

Authored by epriestley on Nov 7 2018, 1:06 AM.
Tags
None
Referenced Files
F14137545: D19784.id47290.diff
Mon, Dec 2, 11:48 PM
F14137544: D19784.id47250.diff
Mon, Dec 2, 11:48 PM
Unknown Object (File)
Mon, Dec 2, 11:45 AM
Unknown Object (File)
Mon, Nov 25, 3:02 AM
Unknown Object (File)
Wed, Nov 20, 5:39 PM
Unknown Object (File)
Sun, Nov 17, 1:37 AM
Unknown Object (File)
Wed, Nov 13, 4:15 AM
Unknown Object (File)
Oct 29 2024, 5:28 AM
Subscribers
Restricted Owners Package

Details

Summary

Ref T13217. This method is slightly tricky:

  • We can't safely return a string: return an array instead.
  • It no longer makes sense to accept glue. All callers use ', ' as glue anyway, so hard-code that.

Then convert all callsites.

Test Plan

Browsed around, saw fewer "unsafe" errors in error log.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a subscriber: Restricted Owners Package.Nov 7 2018, 1:06 AM
Harbormaster returned this revision to the author for changes because remote builds failed.Nov 7 2018, 1:07 AM
Harbormaster failed remote builds in B21099: Diff 47250!

Tests are likely to fail since this depends on %LQ out of libphutil/ in D19783.

amckinley added inline comments.
src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
218–222

Another place where a TODO might be appropriate.

244–247

And this is dead code because we're now doing this work inside the %LQ conversion, right?

This revision is now accepted and ready to land.Nov 7 2018, 9:12 PM
epriestley added inline comments.
src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
244–247

Right -- %LQ (or some other %L*) now do the joins safely, and implode(...) is "unsafe".

(We could make this "safe" and keep the semantics, but we'd have to whitelist acceptable glue, and we only ever use , as glue. I'm guessing third-party code has very few chunkSQL() calls since it's mostly an optimization / migration / workaround-for-low-mysql-packet-size thing.)

This revision was automatically updated to reflect the committed changes.