Page MenuHomePhabricator

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

Authored by epriestley on Nov 7 2018, 1:06 AM.
Tags
None
Referenced Files
F13087075: D19784.diff
Thu, Apr 25, 12:51 AM
Unknown Object (File)
Wed, Apr 24, 4:52 AM
Unknown Object (File)
Sat, Apr 20, 11:05 AM
Unknown Object (File)
Fri, Apr 19, 8:04 PM
Unknown Object (File)
Fri, Apr 19, 6:56 AM
Unknown Object (File)
Wed, Apr 17, 2:03 AM
Unknown Object (File)
Sat, Apr 13, 1:34 PM
Unknown Object (File)
Sat, Apr 13, 12:54 PM
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
Branch
qobject4
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 21099
Build 28676: Run Core Tests
Build 28675: arc lint + arc unit

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

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.