Skip to content
This repository has been archived by the owner on Apr 12, 2019. It is now read-only.

Commit

Permalink
Set maximum LIMIT value.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderzobnin committed Apr 3, 2017
1 parent 0ed1d0d commit 1dd2330
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion dist/query_builder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/query_builder.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions dist/query_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import _ from 'lodash';

// Maximum LIMIT value
let MAX_LIMIT = 500000000;

export class CrateQueryBuilder {
schema: string;
table: string;
Expand Down Expand Up @@ -146,6 +149,7 @@ export class CrateQueryBuilder {
query += " ASC";

if (limit) {
limit = Math.min(limit, MAX_LIMIT);
query += ` LIMIT ${limit}`;
}

Expand Down Expand Up @@ -199,6 +203,7 @@ export class CrateQueryBuilder {
query += " ASC";

if (limit) {
limit = Math.min(limit, MAX_LIMIT);
query += ` LIMIT ${limit}`;
}

Expand Down
5 changes: 5 additions & 0 deletions src/query_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import _ from 'lodash';

// Maximum LIMIT value
let MAX_LIMIT = 500000000;

export class CrateQueryBuilder {
schema: string;
table: string;
Expand Down Expand Up @@ -146,6 +149,7 @@ export class CrateQueryBuilder {
query += " ASC";

if (limit) {
limit = Math.min(limit, MAX_LIMIT);
query += ` LIMIT ${limit}`;
}

Expand Down Expand Up @@ -199,6 +203,7 @@ export class CrateQueryBuilder {
query += " ASC";

if (limit) {
limit = Math.min(limit, MAX_LIMIT);
query += ` LIMIT ${limit}`;
}

Expand Down

0 comments on commit 1dd2330

Please sign in to comment.