|
@@ -43,7 +43,9 @@
|
|
|
{ type: 'asterisk', location: { first_line:1, last_line:1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'testTable1' }] }, { identifierChain: [{ name: 'db1' }, { name: 'table2' }] }] },
|
|
{ type: 'asterisk', location: { first_line:1, last_line:1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'testTable1' }] }, { identifierChain: [{ name: 'db1' }, { name: 'table2' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 25 }, identifierChain: [{ name: 'testTable1' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 25 }, identifierChain: [{ name: 'testTable1' }] },
|
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 34}, identifierChain: [{ name: 'db1' }]},
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 34}, identifierChain: [{ name: 'db1' }]},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 35, last_column: 41 }, identifierChain: [{ name: 'db1' }, { name: 'table2' }] }
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 35, last_column: 41 }, identifierChain: [{ name: 'db1' }, { name: 'table2' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 41, last_column: 41 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 41, last_column: 41 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -58,7 +60,9 @@
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 14 }, identifierChain: [{ name: 'db' }, { name: 'tbl' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 14 }, identifierChain: [{ name: 'db' }, { name: 'tbl' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'col'}], tables: [{ identifierChain: [{ name: 'db' }, { name: 'tbl' }]}]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'col'}], tables: [{ identifierChain: [{ name: 'db' }, { name: 'tbl' }]}]},
|
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 24, last_column: 26 }, identifierChain: [{ name: 'db' }]},
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 24, last_column: 26 }, identifierChain: [{ name: 'db' }]},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 27, last_column: 30 }, identifierChain: [{ name: 'db' }, { name: 'tbl' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 27, last_column: 30 }, identifierChain: [{ name: 'db' }, { name: 'tbl' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 30, last_column: 30 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 30, last_column: 30 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -69,7 +73,9 @@
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 16 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 16 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }]},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 16, last_column: 16 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 16, last_column: 16 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -81,9 +87,13 @@
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 16 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 16 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 16, last_column: 16 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 16, last_column: 16 }},
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 32 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 32 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 24, last_column: 25 }, identifierChain: [{ name: 'y' }], tables: [{ identifierChain: [{ name: 'y' }] }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 24, last_column: 25 }, identifierChain: [{ name: 'y' }], tables: [{ identifierChain: [{ name: 'y' }] }] },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 32 }, identifierChain: [{ name: 'y' }] }
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 32 }, identifierChain: [{ name: 'y' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 32, last_column: 32 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 32, last_column: 32 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -95,9 +105,13 @@
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 1, last_column: 16 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 1, last_column: 16 } },
|
|
|
{ type: 'column', location: { first_line: 2, last_line: 2, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }] },
|
|
{ type: 'column', location: { first_line: 2, last_line: 2, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }] },
|
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }] },
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }},
|
|
|
{ type: 'statement', location: { first_line: 2, last_line: 5, first_column: 17, last_column: 16 } },
|
|
{ type: 'statement', location: { first_line: 2, last_line: 5, first_column: 17, last_column: 16 } },
|
|
|
{ type: 'column', location: { first_line: 5, last_line: 5, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'y' }], tables: [{ identifierChain: [{ name: 'y' }] }] },
|
|
{ type: 'column', location: { first_line: 5, last_line: 5, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'y' }], tables: [{ identifierChain: [{ name: 'y' }] }] },
|
|
|
- { type: 'table', location: { first_line: 5, last_line: 5, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'y' }] }
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 5, last_line: 5, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'y' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 5, last_line: 5, first_column: 16, last_column: 16 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 5, last_line: 5, first_column: 16, last_column: 16 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -109,7 +123,9 @@
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 19 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 19 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }, { identifierChain: [{ name: 'y' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }, { identifierChain: [{ name: 'y' }] }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }]},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 18, last_column: 19 }, identifierChain: [{ name: 'y' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 18, last_column: 19 }, identifierChain: [{ name: 'y' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 19 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 19 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -125,7 +141,9 @@
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 23, last_column: 33 }, identifierChain: [{ name: 'testTable1' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 23, last_column: 33 }, identifierChain: [{ name: 'testTable1' }] },
|
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 35, last_column: 37 }, identifierChain: [{ name: 'db' }]},
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 35, last_column: 37 }, identifierChain: [{ name: 'db' }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 38, last_column: 48 }, identifierChain: [{ name: 'db' },{ name: 'testTable2'}] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 38, last_column: 48 }, identifierChain: [{ name: 'db' },{ name: 'testTable2'}] },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 50, last_column: 60 }, identifierChain: [{ name: 'testTable3' }] }
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 50, last_column: 60 }, identifierChain: [{ name: 'testTable3' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 63, last_column: 63 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 63, last_column: 63 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -137,7 +155,9 @@
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 42 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 42 } },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
|
- { type: 'column', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain:[{ name: 'bar'}], tables: [{ identifierChain: [{ name: 'foo' }] }]}
|
|
|
|
|
|
|
+ { type: 'whereClause', missing: false, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 42 } },
|
|
|
|
|
+ { type: 'column', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain:[{ name: 'bar'}], tables: [{ identifierChain: [{ name: 'foo' }] }]},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 42, last_column: 42 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -149,9 +169,11 @@
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 48 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 48 } },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
|
- { type: 'column', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain:[{ name: 'bar'}], tables: [{ identifierChain: [{ name: 'foo' }] }]},
|
|
|
|
|
- { type: 'column', location: { first_line: 1, last_line: 1, first_column: 33, last_column: 35 }, identifierChain: [{ name: 'id'}], tables: [{ identifierChain: [{ name: 'foo' }] }]},
|
|
|
|
|
- { type: 'column', location: { first_line: 1, last_line: 1, first_column: 41, last_column: 43 }, identifierChain: [{ name: 'id'}], tables: [{ identifierChain: [{ name: 'foo' }] }]}
|
|
|
|
|
|
|
+ { type: 'whereClause', missing: false, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 48 }},
|
|
|
|
|
+ { type: 'column', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain: [{ name: 'bar' }], tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
|
|
|
+ { type: 'column', location: { first_line: 1, last_line: 1, first_column: 33, last_column: 35 }, identifierChain: [{ name: 'id' }], tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
|
|
|
+ { type: 'column', location: { first_line: 1, last_line: 1, first_column: 41, last_column: 43 }, identifierChain: [{ name: 'id' }], tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 48, last_column: 48 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -193,6 +215,7 @@
|
|
|
{ type: 'column', location: { first_line: 5, last_line: 5, first_column: 10, last_column: 14 }, identifierChain: [{ name: 'code' }], tables: [{ identifierChain: [{ name: 'sample_07' }], alias: 's07' }] },
|
|
{ type: 'column', location: { first_line: 5, last_line: 5, first_column: 10, last_column: 14 }, identifierChain: [{ name: 'code' }], tables: [{ identifierChain: [{ name: 'sample_07' }], alias: 's07' }] },
|
|
|
{ type: 'table', location: { first_line: 5, last_line: 5, first_column: 17, last_column: 20 }, identifierChain: [{ name: 'sample_08' }] },
|
|
{ type: 'table', location: { first_line: 5, last_line: 5, first_column: 17, last_column: 20 }, identifierChain: [{ name: 'sample_08' }] },
|
|
|
{ type: 'column', location: { first_line: 5, last_line: 5, first_column: 21, last_column: 25 }, identifierChain: [{ name: 'code' }], tables: [{ identifierChain: [{ name: 'sample_08' }], alias: 's08' }] },
|
|
{ type: 'column', location: { first_line: 5, last_line: 5, first_column: 21, last_column: 25 }, identifierChain: [{ name: 'code' }], tables: [{ identifierChain: [{ name: 'sample_08' }], alias: 's08' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: false, location: { first_line: 6, last_line: 7, first_column: 1, last_column: 26 }},
|
|
|
{ type: 'table', location: { first_line: 7, last_line: 7, first_column: 3, last_column: 6 }, identifierChain: [{ name: 'sample_07' }] },
|
|
{ type: 'table', location: { first_line: 7, last_line: 7, first_column: 3, last_column: 6 }, identifierChain: [{ name: 'sample_07' }] },
|
|
|
{ type: 'column', location: { first_line: 7, last_line: 7, first_column: 7, last_column: 13 }, identifierChain: [{ name: 'salary' }], tables: [{ identifierChain: [{ name: 'sample_07' }], alias: 's07' }] },
|
|
{ type: 'column', location: { first_line: 7, last_line: 7, first_column: 7, last_column: 13 }, identifierChain: [{ name: 'salary' }], tables: [{ identifierChain: [{ name: 'sample_07' }], alias: 's07' }] },
|
|
|
{ type: 'table', location: { first_line: 7, last_line: 7, first_column: 16, last_column: 19 }, identifierChain: [{ name: 'sample_08' }] },
|
|
{ type: 'table', location: { first_line: 7, last_line: 7, first_column: 16, last_column: 19 }, identifierChain: [{ name: 'sample_08' }] },
|
|
@@ -200,21 +223,8 @@
|
|
|
{ type: 'table', location: { first_line: 8, last_line: 8, first_column: 10, last_column: 13 }, identifierChain: [{ name: 'sample_08' }] },
|
|
{ type: 'table', location: { first_line: 8, last_line: 8, first_column: 10, last_column: 13 }, identifierChain: [{ name: 'sample_08' }] },
|
|
|
{ type: 'column', location: { first_line: 8, last_line: 8, first_column: 14, last_column: 20 }, identifierChain: [{ name: 'salary' }], tables: [{ identifierChain: [{ name: 'sample_08' }], alias: 's08' }] },
|
|
{ type: 'column', location: { first_line: 8, last_line: 8, first_column: 14, last_column: 20 }, identifierChain: [{ name: 'salary' }], tables: [{ identifierChain: [{ name: 'sample_08' }], alias: 's08' }] },
|
|
|
{ type: 'table', location: { first_line: 8, last_line: 8, first_column: 21, last_column: 24 }, identifierChain: [{ name: 'sample_07' }] },
|
|
{ type: 'table', location: { first_line: 8, last_line: 8, first_column: 21, last_column: 24 }, identifierChain: [{ name: 'sample_07' }] },
|
|
|
- { type: 'column', location: { first_line: 8, last_line: 8, first_column: 25, last_column: 31 }, identifierChain: [{ name: 'salary'}], tables: [{ identifierChain: [{ name: 'sample_07' }], alias: 's07' }]}
|
|
|
|
|
- ]
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- it('should report locations for "SELECT * FROM foo WHERE bar IN (id+1-1, id+1-2);|"', function() {
|
|
|
|
|
- assertLocations({
|
|
|
|
|
- beforeCursor: 'SELECT * FROM foo WHERE bar IN (id+1-1, id+1-2);',
|
|
|
|
|
- expectedLocations: [
|
|
|
|
|
- { type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 48 } },
|
|
|
|
|
- { type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
|
|
|
- { type: 'column', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain:[{ name: 'bar'}], tables: [{ identifierChain: [{ name: 'foo' }] }]},
|
|
|
|
|
- { type: 'column', location: { first_line: 1, last_line: 1, first_column: 33, last_column: 35 }, identifierChain: [{ name: 'id'}], tables: [{ identifierChain: [{ name: 'foo' }] }]},
|
|
|
|
|
- { type: 'column', location: { first_line: 1, last_line: 1, first_column: 41, last_column: 43 }, identifierChain: [{ name: 'id'}], tables: [{ identifierChain: [{ name: 'foo' }] }]}
|
|
|
|
|
|
|
+ { type: 'column', location: { first_line: 8, last_line: 8, first_column: 25, last_column: 31 }, identifierChain: [{ name: 'salary'}], tables: [{ identifierChain: [{ name: 'sample_07' }], alias: 's07' }]},
|
|
|
|
|
+ { type: 'limitClause', missing: false, location: { first_line: 9, last_line: 9, first_column: 1, last_column: 11 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -228,8 +238,11 @@
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'bl' }], tables: [{ identifierChain: [{ name: 'blablabla' }] }, { subQuery: 's1' }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'bl' }], tables: [{ identifierChain: [{ name: 'blablabla' }] }, { subQuery: 's1' }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 16, last_column: 25 }, identifierChain: [{ name: 'blablabla' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 16, last_column: 25 }, identifierChain: [{ name: 'blablabla' }] },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 39, last_column: 40 }, tables: [{ identifierChain: [{ name: 'blablabla' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 39, last_column: 40 }, tables: [{ identifierChain: [{ name: 'blablabla' }] }] },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 46, last_column: 55 }, identifierChain: [{ name: 'blablabla' }] }]
|
|
|
|
|
-
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 46, last_column: 55 }, identifierChain: [{ name: 'blablabla' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 55, last_column: 55 }}, // Subquery
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 55, last_column: 55 }}, // Subquery
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 59, last_column: 59 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 59, last_column: 59 }}]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -261,10 +274,14 @@
|
|
|
{ type: 'database', location: { first_line: 6, last_line: 6, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'db1' }]},
|
|
{ type: 'database', location: { first_line: 6, last_line: 6, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'db1' }]},
|
|
|
{ type: 'table', location: { first_line: 6, last_line: 6, first_column: 12, last_column: 15 }, identifierChain: [{ name: 'db1' }, { name: 'foo' }]},
|
|
{ type: 'table', location: { first_line: 6, last_line: 6, first_column: 12, last_column: 15 }, identifierChain: [{ name: 'db1' }, { name: 'foo' }]},
|
|
|
{ type: 'table', location: { first_line: 6, last_line: 6, first_column: 21, last_column: 24 }, identifierChain: [{ name: 'bar' }]},
|
|
{ type: 'table', location: { first_line: 6, last_line: 6, first_column: 21, last_column: 24 }, identifierChain: [{ name: 'bar' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: false, location: { first_line: 6, last_line: 6, first_column: 29, last_column: 67 } },
|
|
|
{ type: 'table', location: { first_line: 6, last_line: 6, first_column: 35, last_column: 38 }, identifierChain: [{ name: 'bar' }]},
|
|
{ type: 'table', location: { first_line: 6, last_line: 6, first_column: 35, last_column: 38 }, identifierChain: [{ name: 'bar' }]},
|
|
|
{ type: 'column', location: { first_line: 6, last_line: 6, first_column: 39, last_column: 42 }, identifierChain: [{ name: 'bla' }], tables: [{ identifierChain: [{ name: 'bar' }], alias: 'baa' }] },
|
|
{ type: 'column', location: { first_line: 6, last_line: 6, first_column: 39, last_column: 42 }, identifierChain: [{ name: 'bla' }], tables: [{ identifierChain: [{ name: 'bar' }], alias: 'baa' }] },
|
|
|
{ type: 'column', location: { first_line: 6, last_line: 6, first_column: 54, last_column: 57 }, identifierChain: [{ name: 'ble' }], tables: [{ identifierChain: [{ name: 'bla' }] }] },
|
|
{ type: 'column', location: { first_line: 6, last_line: 6, first_column: 54, last_column: 57 }, identifierChain: [{ name: 'ble' }], tables: [{ identifierChain: [{ name: 'bla' }] }] },
|
|
|
- { type: 'table', location: { first_line: 6, last_line: 6, first_column: 63, last_column: 66 }, identifierChain: [{ name: 'bla' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 6, last_line: 6, first_column: 63, last_column: 66 }, identifierChain: [{ name: 'bla' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 6, last_line: 6, first_column: 66, last_column: 66 } }, // Subquery
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 6, last_line: 6, first_column: 66, last_column: 66 } }, // Subquery
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 6, last_line: 6, first_column: 67, last_column: 67 } }
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -277,7 +294,9 @@
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
{ type: 'asterisk', location:{ first_line: 1, last_line: 1, first_column: 12, last_column: 13 }, tables: [{ alias: 'tta', identifierChain: [{ name: 'testTableA' }] }] },
|
|
{ type: 'asterisk', location:{ first_line: 1, last_line: 1, first_column: 12, last_column: 13 }, tables: [{ alias: 'tta', identifierChain: [{ name: 'testTableA' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 19, last_column: 29}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 19, last_column: 29}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 35, last_column: 45}, identifierChain: [{ name: 'testTableB' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 35, last_column: 45}, identifierChain: [{ name: 'testTableB' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 45, last_column: 45 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 45, last_column: 45 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -288,7 +307,9 @@
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 31 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 31 } },
|
|
|
{ type: 'function', location:{ first_line: 1, last_line: 1, first_column: 8, last_column: 12}, function: 'count'},
|
|
{ type: 'function', location:{ first_line: 1, last_line: 1, first_column: 8, last_column: 12}, function: 'count'},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 31}, identifierChain: [{ name: 'testTable' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 31}, identifierChain: [{ name: 'testTable' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 31, last_column: 31 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 31, last_column: 31 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -327,6 +348,7 @@
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 68 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 68 } },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ alias: 't1', identifierChain: [{ name: 'testTable' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ alias: 't1', identifierChain: [{ name: 'testTable' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 24 }, identifierChain: [{ name: 'testTable' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 24 }, identifierChain: [{ name: 'testTable' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 27, last_column: 27 }},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 37, last_column: 39 }, identifierChain: [{ name: 'testTable' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 37, last_column: 39 }, identifierChain: [{ name: 'testTable' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 40, last_column: 41 }, identifierChain: [{ name: 'a' }], tables: [{ identifierChain: [{ name: 'testTable' }], alias: 't1' }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 40, last_column: 41 }, identifierChain: [{ name: 'a' }], tables: [{ identifierChain: [{ name: 'testTable' }], alias: 't1' }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 47, last_column: 49 }, identifierChain: [{ name: 'testTable' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 47, last_column: 49 }, identifierChain: [{ name: 'testTable' }]},
|
|
@@ -335,14 +357,19 @@
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 56, last_column: 57 }, identifierChain: [{ name: 'c' }], tables: [{ identifierChain: [{ name: 'testTable' }], alias: 't1' }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 56, last_column: 57 }, identifierChain: [{ name: 'c' }], tables: [{ identifierChain: [{ name: 'testTable' }], alias: 't1' }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 64, last_column: 66 }, identifierChain: [{ name: 'testTable' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 64, last_column: 66 }, identifierChain: [{ name: 'testTable' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 67, last_column: 68 }, identifierChain: [{ name: 'd' }], tables: [{ identifierChain: [{ name: 'testTable' }], alias: 't1' }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 67, last_column: 68 }, identifierChain: [{ name: 'd' }], tables: [{ identifierChain: [{ name: 'testTable' }], alias: 't1' }]},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 68, last_column: 68 }},
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 69, last_column: 33 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 69, last_column: 33 } },
|
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'testTable2' }]},
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'testTable2' }]},
|
|
|
{ type: 'column', location: { first_line: 2, last_line: 2, first_column: 11, last_column: 14 }, identifierChain: [{ name: 'bla' }], tables: [{ identifierChain: [{ name: 'testTable2' }], alias: 't1' }]},
|
|
{ type: 'column', location: { first_line: 2, last_line: 2, first_column: 11, last_column: 14 }, identifierChain: [{ name: 'bla' }], tables: [{ identifierChain: [{ name: 'testTable2' }], alias: 't1' }]},
|
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 20, last_column: 30 }, identifierChain: [{ name: 'testTable2' }]},
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 20, last_column: 30 }, identifierChain: [{ name: 'testTable2' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 33, last_column: 33 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 33, last_column: 33 }},
|
|
|
{ type: 'statement', location: { first_line: 2, last_line: 3, first_column: 34, last_column: 43 } },
|
|
{ type: 'statement', location: { first_line: 2, last_line: 3, first_column: 34, last_column: 43 } },
|
|
|
{ type: 'asterisk', location: { first_line: 3, last_line: 3, first_column: 8, last_column: 9 }, tables: [{ alias: 't3', identifierChain: [{ name: 'testTable3' }]}, { alias: 't4', identifierChain: [{ name: 'testTable4' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 3, last_line: 3, first_column: 8, last_column: 9 }, tables: [{ alias: 't3', identifierChain: [{ name: 'testTable3' }]}, { alias: 't4', identifierChain: [{ name: 'testTable4' }] }] },
|
|
|
{ type: 'table', location: { first_line: 3, last_line: 3, first_column: 15, last_column: 25 }, identifierChain: [{ name: 'testTable3' }]},
|
|
{ type: 'table', location: { first_line: 3, last_line: 3, first_column: 15, last_column: 25 }, identifierChain: [{ name: 'testTable3' }]},
|
|
|
- { type: 'table', location: { first_line: 3, last_line: 3, first_column: 30, last_column: 40 }, identifierChain: [{ name: 'testTable4' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 3, last_line: 3, first_column: 30, last_column: 40 }, identifierChain: [{ name: 'testTable4' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 3, last_line: 3, first_column: 43, last_column: 43 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 3, last_line: 3, first_column: 43, last_column: 43 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -362,7 +389,9 @@
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 90, last_column: 92 }, identifierChain: [{ name: 'table1' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 90, last_column: 92 }, identifierChain: [{ name: 'table1' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 93, last_column: 95 }, identifierChain: [{ name: 'c1' }], tables: [{ identifierChain: [{ name: 'table1' }], alias: 't1' }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 93, last_column: 95 }, identifierChain: [{ name: 'c1' }], tables: [{ identifierChain: [{ name: 'table1' }], alias: 't1' }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 98, last_column: 104 }, identifierChain: [{ name: 'table2' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 98, last_column: 104 }, identifierChain: [{ name: 'table2' }]},
|
|
|
- { type: 'column', location: { first_line: 1, last_line: 1, first_column: 105, last_column: 107 }, identifierChain: [{ name: 'c2' }], tables: [{ identifierChain: [{ name: 'table2' }] }]}
|
|
|
|
|
|
|
+ { type: 'column', location: { first_line: 1, last_line: 1, first_column: 105, last_column: 107 }, identifierChain: [{ name: 'c2' }], tables: [{ identifierChain: [{ name: 'table2' }] }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 108, last_column: 108 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 108, last_column: 108 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -375,9 +404,13 @@
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 51 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 51 } },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: false, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 51 }},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain:[{ name: 'bar'}], tables: [{ identifierChain: [{ name: 'foo' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain:[{ name: 'bar'}], tables: [{ identifierChain: [{ name: 'foo' }] }]},
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 40, last_column: 41 }, tables: [{ identifierChain: [{ name: 'bla' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 40, last_column: 41 }, tables: [{ identifierChain: [{ name: 'bla' }] }] },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 47, last_column: 50 }, identifierChain: [{ name: 'bla' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 47, last_column: 50 }, identifierChain: [{ name: 'bla' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 50, last_column: 50 }}, // Subquery
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 50, last_column: 50 }}, // Subquery
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 51, last_column: 51 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -389,7 +422,9 @@
|
|
|
afterCursor: ' FROM testTableA',
|
|
afterCursor: ' FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 32 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 32 } },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 32}, identifierChain: [{ name: 'testTableA' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 32}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 32, last_column: 32 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 32, last_column: 32 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -402,7 +437,9 @@
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 34 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 34 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 10, last_column: 11 }, identifierChain: [{ name: 'a' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 10, last_column: 11 }, identifierChain: [{ name: 'a' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 24, last_column: 34}, identifierChain: [{ name: 'testTableA' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 24, last_column: 34}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 34, last_column: 34 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 34, last_column: 34 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -414,7 +451,9 @@
|
|
|
afterCursor: ' FROM testTableA',
|
|
afterCursor: ' FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 27 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 27 } },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 27}, identifierChain: [{ name: 'testTableA' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 27}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 27, last_column: 27 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 27, last_column: 27 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -426,7 +465,9 @@
|
|
|
afterCursor: ' \nFROM testTableA',
|
|
afterCursor: ' \nFROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 1, last_column: 16 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 1, last_column: 16 } },
|
|
|
- { type: 'table', location: { first_line: 2, last_line: 2, first_column: 6, last_column: 16}, identifierChain: [{ name: 'testTableA' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 2, last_line: 2, first_column: 6, last_column: 16}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -438,7 +479,9 @@
|
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 28 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 28 } },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 18, last_column: 28}, identifierChain: [{ name: 'testTableA' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 18, last_column: 28}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 28, last_column: 28 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 28, last_column: 28 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -450,7 +493,9 @@
|
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 33 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 33 } },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 23, last_column: 33}, identifierChain: [{ name: 'testTableA' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 23, last_column: 33}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 33, last_column: 33 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 33, last_column: 33 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -463,7 +508,9 @@
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 37 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 37 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 27, last_column: 37}, identifierChain: [{ name: 'testTableA' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 27, last_column: 37}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 37, last_column: 37 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 37, last_column: 37 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -477,7 +524,9 @@
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 40 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 40 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9}, identifierChain: [{ name: 'b' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9}, identifierChain: [{ name: 'b' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 14}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 14}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 30, last_column: 40}, identifierChain: [{ name: 'testTableA' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 30, last_column: 40}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 40, last_column: 40 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 40, last_column: 40 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -490,7 +539,9 @@
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 38 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 38 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 28, last_column: 38}, identifierChain: [{ name: 'testTableA' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 28, last_column: 38}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 38, last_column: 38 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 38, last_column: 38 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -504,7 +555,9 @@
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 33 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 33 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 15 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 15 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 21, last_column: 29 }, identifierChain: [{ name: 'some_tbl' }] }
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 21, last_column: 29 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 33, last_column: 33 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 33, last_column: 33 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -519,7 +572,9 @@
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 15 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 15 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
|
{ type: 'complex', location: { first_line: 1, last_line: 1, first_column: 16, last_column: 20 }, identifierChain: [{ name: 'col' }, { name: 'cplx' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
{ type: 'complex', location: { first_line: 1, last_line: 1, first_column: 16, last_column: 20 }, identifierChain: [{ name: 'col' }, { name: 'cplx' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 26, last_column: 34 }, identifierChain: [{ name: 'some_tbl' }] }
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 26, last_column: 34 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 38, last_column: 38 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 38, last_column: 38 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -534,7 +589,9 @@
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 16 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 16 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 20 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }] }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 20 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }] }] },
|
|
|
{ type: 'complex', location: { first_line: 1, last_line: 1, first_column: 21, last_column: 25 }, identifierChain: [{ name: 'col' }, { name: 'cplx' }], tables: [{ identifierChain: [{ name: 'some_tbl' }] }] },
|
|
{ type: 'complex', location: { first_line: 1, last_line: 1, first_column: 21, last_column: 25 }, identifierChain: [{ name: 'col' }, { name: 'cplx' }], tables: [{ identifierChain: [{ name: 'some_tbl' }] }] },
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 39 }, identifierChain: [{ name: 'some_tbl' }] }
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 39 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 39, last_column: 39 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 39, last_column: 39 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -555,7 +612,9 @@
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 51, last_column: 54 }, identifierChain: [{ name: 'bla' }], tables: [{ identifierChain: [{ name: 'testTableA' }], alias: 'tta' }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 51, last_column: 54 }, identifierChain: [{ name: 'bla' }], tables: [{ identifierChain: [{ name: 'testTableA' }], alias: 'tta' }]},
|
|
|
{ type: 'function', location: { first_line: 1, last_line: 1, first_column: 56, last_column: 58 }, function: 'cos' },
|
|
{ type: 'function', location: { first_line: 1, last_line: 1, first_column: 56, last_column: 58 }, function: 'cos' },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 68, last_column: 78 }, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 68, last_column: 78 }, identifierChain: [{ name: 'testTableA' }]},
|
|
|
- { type: 'table', location: { first_line: 1, last_line: 1, first_column: 84, last_column: 94 }, identifierChain: [{ name: 'testTableB' }]}
|
|
|
|
|
|
|
+ { type: 'table', location: { first_line: 1, last_line: 1, first_column: 84, last_column: 94 }, identifierChain: [{ name: 'testTableB' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 94, last_column: 94 }},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 94, last_column: 94 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -594,10 +653,14 @@
|
|
|
{ type: 'function', location: { first_line: 1, last_line: 1, first_column: 178, last_column: 181 }, function: 'year' },
|
|
{ type: 'function', location: { first_line: 1, last_line: 1, first_column: 178, last_column: 181 }, function: 'year' },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 183, last_column: 187 }, identifierChain: [{ name:'tran' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 183, last_column: 187 }, identifierChain: [{ name:'tran' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 188, last_column: 194 }, identifierChain: [{ name: 'tran_d' }], tables: [{ identifierChain: [{ name:'tran' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 188, last_column: 194 }, identifierChain: [{ name: 'tran_d' }], tables: [{ identifierChain: [{ name:'tran' }] }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 218, last_column: 218 }},
|
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 228, last_column: 234 }, identifierChain: [{ name: 'tstDb1' }]},
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 228, last_column: 234 }, identifierChain: [{ name: 'tstDb1' }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 235, last_column: 237 }, identifierChain: [{ name:'tstDb1' },{ name: 'b1' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 235, last_column: 237 }, identifierChain: [{ name:'tstDb1' },{ name: 'b1' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 238, last_column: 241 }, identifierChain: [{ name: 'cat' }], tables: [{ identifierChain: [{ name:'tstDb1' }, {name: 'b1' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 238, last_column: 241 }, identifierChain: [{ name: 'cat' }], tables: [{ identifierChain: [{ name:'tstDb1' }, {name: 'b1' }] }]},
|
|
|
- { type: 'column', location: { first_line: 1, last_line: 1, first_column: 256, last_column: 257 }, identifierChain: [{ name: 'r' }], tables: [{ subQuery: 'tmp' }]}
|
|
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 241, last_column: 241 }},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 246, last_column: 246 }},
|
|
|
|
|
+ { type: 'column', location: { first_line: 1, last_line: 1, first_column: 256, last_column: 257 }, identifierChain: [{ name: 'r' }], tables: [{ subQuery: 'tmp' }]},
|
|
|
|
|
+ { type: 'limitClause', missing: false, location: { first_line: 1, last_line: 1, first_column: 263, last_column: 271 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -611,10 +674,12 @@
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 53 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 53 } },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'testTable' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'testTable' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 24 }, identifierChain: [{ name: 'testTable' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 24 }, identifierChain: [{ name: 'testTable' }]},
|
|
|
|
|
+ { type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 24, last_column: 24 }},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 34, last_column: 35 }, identifierChain: [{ name: 'a'}], tables: [{ identifierChain: [{ name:'testTable' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 34, last_column: 35 }, identifierChain: [{ name: 'a'}], tables: [{ identifierChain: [{ name:'testTable' }] }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 41, last_column: 42 }, identifierChain: [{ name: 'b'}], tables: [{ identifierChain: [{ name:'testTable' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 41, last_column: 42 }, identifierChain: [{ name: 'b'}], tables: [{ identifierChain: [{ name:'testTable' }] }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 44, last_column: 45 }, identifierChain: [{ name: 'c'}], tables: [{ identifierChain: [{ name:'testTable' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 44, last_column: 45 }, identifierChain: [{ name: 'c'}], tables: [{ identifierChain: [{ name:'testTable' }] }]},
|
|
|
- { type: 'column', location: { first_line: 1, last_line: 1, first_column: 52, last_column: 53 }, identifierChain: [{ name: 'd'}], tables: [{ identifierChain: [{ name:'testTable' }] }]}
|
|
|
|
|
|
|
+ { type: 'column', location: { first_line: 1, last_line: 1, first_column: 52, last_column: 53 }, identifierChain: [{ name: 'd'}], tables: [{ identifierChain: [{ name:'testTable' }] }]},
|
|
|
|
|
+ { type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 53, last_column: 53 }}
|
|
|
]
|
|
]
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|