Page MenuHomePhabricator

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

Authored by epriestley on Nov 7 2018, 1:06 AM.
Tags
None
Referenced Files
F13061838: D19784.diff
Fri, Apr 19, 8:04 PM
F13052083: D19784.id47250.diff
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
Unknown Object (File)
Fri, Apr 5, 6:40 PM
Unknown Object (File)
Tue, Apr 2, 1:20 AM
Unknown Object (File)
Feb 16 2024, 3: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.