limit.test.js 1.1 KB

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