2024-03-27 10:33:25 +08:00
|
|
|
import { PLSQL } from 'src/parser/plsql';
|
2020-09-11 17:39:10 +08:00
|
|
|
|
|
|
|
describe('PLSQL Syntax Tests', () => {
|
2024-03-27 10:33:25 +08:00
|
|
|
const plsql = new PLSQL();
|
2020-09-11 17:39:10 +08:00
|
|
|
|
|
|
|
test('Test simple select Statement', () => {
|
|
|
|
const sql = 'select id,name from user1;';
|
2024-03-27 10:33:25 +08:00
|
|
|
const result = plsql.validate(sql);
|
2020-09-11 17:39:10 +08:00
|
|
|
|
|
|
|
expect(result.length).toBe(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
test(`Test select, where, order by`, () => {
|
|
|
|
const sql = `
|
|
|
|
select eid, emp_last, mgr_id, reportlevel
|
|
|
|
from reports_to_101 r, auto a
|
|
|
|
where r.c1 = a.c2
|
|
|
|
order by reportlevel, eid
|
|
|
|
`;
|
2024-03-27 10:33:25 +08:00
|
|
|
const result = plsql.validate(sql);
|
2020-09-11 17:39:10 +08:00
|
|
|
expect(result.length).toBe(0);
|
|
|
|
});
|
|
|
|
});
|