Page MenuHomePhabricator

Add "%Z" (Raw Query) and "%LK" (List of Columns for Keys) to qsprintf()
ClosedPublic

Authored by epriestley on Nov 13 2018, 6:29 PM.
Tags
None
Referenced Files
F18112238: D19800.diff
Tue, Aug 12, 4:15 PM
F18110852: D19800.id47291.diff
Tue, Aug 12, 12:48 AM
F18110606: D19800.id47305.diff
Mon, Aug 11, 9:34 PM
F18095208: D19800.diff
Thu, Aug 7, 10:34 PM
F17947367: D19800.id.diff
Thu, Jul 31, 4:22 PM
Unknown Object (File)
Jul 3 2025, 7:35 PM
Unknown Object (File)
Jun 30 2025, 10:21 AM
Unknown Object (File)
Jun 29 2025, 4:55 AM
Subscribers
None

Details

Summary

Ref T13217. Ref T13216.

First, we still need a way to pass a raw, unsafe query to qsprintf(...) so we can apply .sql migrations. There's no way to make these "safe" so introduce a new "raw unsafe query" conversion which works like the old %Q: %Z.

Second, when bin/storage adjust adds or modifies keys, it needs to run a query like this:

ALTER TABLE x ADD KEY y (u, w);

The (u, w) part is usually a list of columns (same as %LC) but may look like (u(16), w(64)) if the key is on prefix substrings of the column values.

Introduce %LK to escape this particular kind of column list grammar.

Test Plan

See next revision.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable