skip.test.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. var Test = require('../../support/test-runner');
  2. describe('Query Generation ::', function() {
  3. describe('SKIP statements', function() {
  4. it('should generate a simple query with a SKIP statement', function(done) {
  5. Test({
  6. query: {
  7. select: ['*'],
  8. from: 'users',
  9. skip: 10
  10. },
  11. outcomes: [
  12. {
  13. dialect: 'postgresql',
  14. sql: 'select * from "users" offset $1',
  15. bindings: ['10']
  16. },
  17. {
  18. dialect: 'mysql',
  19. sql: 'select * from `users` limit 18446744073709551615 offset ?',
  20. bindings: ['10']
  21. },
  22. {
  23. dialect: 'sqlite3',
  24. sql: 'select * from "users" limit ? offset ?',
  25. bindings: ['-1', '10']
  26. },
  27. {
  28. dialect: 'oracle',
  29. sql: 'select * from (select row_.*, ROWNUM rownum_ from (select * from "users") row_ where rownum <= :1) where rownum_ > :2',
  30. bindings: ['10000000000010', '10']
  31. },
  32. {
  33. dialect: 'mariadb',
  34. sql: 'select * from `users` limit 18446744073709551615 offset ?',
  35. bindings: ['10']
  36. }
  37. ]
  38. }, done);
  39. });
  40. });
  41. });