HomePhabricator

Support "%R" (Database + Table Ref) in qsprintf(...)

Description

Support "%R" (Database + Table Ref) in qsprintf(...)

Summary:
Ref T13210. Ref T11908. In the future, we'd like to be able to use one port-to-port database connection to issue queries for multiple databases (e.g., both Differential and Maniphest) if both applications are on the same host.

The big issue with this is that we currently run queries like SELECT * FROM xyz, and assume the database name based on the connection state. Instead, we want to run SELECT * FROM abc.xyz, which will work no matter which database the connection is currently USE ..-ing.

To support this, add a %R conversion to qsprintf(...) which takes a "database + table ref" object. This is a new type of object which stores both a database name and a table name, so we can build "abc.xyz".

Test Plan: See the next change for callsites and unit tests.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13210, T11908

Differential Revision: https://secure.phabricator.com/D19764