Page MenuHomePhabricator

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

Authored by epriestley on Nov 7 2018, 1:06 AM.
Tags
None
Referenced Files
F13223145: D19784.diff
Sun, May 19, 4:20 AM
F13177847: D19784.diff
Wed, May 8, 8:00 PM
F13175067: D19784.diff
Wed, May 8, 3:07 AM
Unknown Object (File)
Mon, May 6, 4:21 PM
Unknown Object (File)
Fri, May 3, 8:29 AM
Unknown Object (File)
Sat, Apr 27, 12:17 AM
Unknown Object (File)
Thu, Apr 25, 12:51 AM
Unknown Object (File)
Wed, Apr 24, 4:52 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.