2 files changed
+10
-1
No files matched your search
@@ -1104,6 +1104,15 @@ describe("buildExecutionCandidates", () => {
|
||||
expect(splitSqlStatementRanges("/*@global:true*/", "mysql")).toEqual([]);
|
||||
});
|
||||
|
||||
it("preserves leading ampersand tenant routing hints in current statement candidates", () => {
|
||||
const hintedSql = "/*&tenant:mctest*/\nSELECT count(*) FROM tenant_table";
|
||||
const sql = `SELECT 1;\n${hintedSql};`;
|
||||
const candidates = buildExecutionCandidates(sql, indexOf(sql, "tenant_table"), "mysql");
|
||||
|
||||
expect(candidates[0].sql).toBe(hintedSql);
|
||||
expect(splitSqlStatementRanges("/*&tenant:mctest*/", "mysql")).toEqual([]);
|
||||
});
|
||||
|
||||
it("uses the cursor statement for the first candidate when there is no selection", () => {
|
||||
const sql = "SELECT *\nFROM users\nWHERE active = 1";
|
||||
const candidates = buildExecutionCandidates(sql, indexOf(sql, "users"));
|
||||
|
||||
Reference in new issue
Block a user