Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor clarifications #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ Every clause method returns a new immutable `q` query object.
- `q.from(tablename | subquery, alias)`
- `q.join(tablename | subquery, [alias], on_expression)`
- `q.leftJoin(tablename | subquery, [alias], on_expression)`
- `q.where(expression, [comparator, [value]])`
- `q.orWhere(expression, [comparator, [value]])`
- `q.where(expression, [[comparator], value])`
- `q.orWhere(expression, [[comparator], value])`
- `q.whereLike(expression, value)`
- `q.orWhereLike(expression, value)`
- `q.having(expression, [comparator, [value]])`
- `q.orHaving(expression, [comparator, [value]])`
- `q.having(expression, [[comparator], value])`
- `q.orHaving(expression, [[comparator], value])`
Comment on lines +128 to +133
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah that is what I meant...

- `q.groupBy(expression1, expression2, etc)`
- `q.orderBy(expression1, expression2, etc)`
- `q.limit(offset)`
Expand All @@ -139,7 +139,7 @@ Every clause method returns a new immutable `q` query object.

`expression` strings are inserted without being parameterized, but you can also pass in [tagged template strings](#tagged-template-strings) to do anything special.

All `value`s are automatically parameterized. If a `value` is `NULL` it will be automatically compared with `IS`, and if it's an array it will be automatically compared with `IN()`:
If a `value` is `NULL` it will be automatically compared with `IS`, and if it's an array it will be automatically compared with `IN()`. Otherwise, it will be compared with `=`.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is more what I meant

Suggested change
If a `value` is `NULL` it will be automatically compared with `IS`, and if it's an array it will be automatically compared with `IN()`. Otherwise, it will be compared with `=`.
All `value`s will be automatically escaped. If a `value` is `NULL` it will be automatically compared with `IS`, and if it's an array it will be automatically compared with `IN()`. Otherwise, it will be compared with `=`.


```js
const whereInResult = q.select('fancy')
Expand All @@ -156,7 +156,7 @@ whereInResult.sql // => whereInQuery
whereInResult.values // => [ [ 'fancy', 'boring' ] ]
```

Put another way, calling `q.select('column1, column2')` is just as acceptable as calling `q.select('column1', 'column2')` and you should use whichever you prefer.
All `value`s are automatically parameterized. Put another way, calling `q.select('column1, column2')` is just as acceptable as calling `q.select('column1', 'column2')` and you should use whichever you prefer.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"parameterized" isn't terribly clear but I meant to be talking about the arguments I called value in the functions above, not the expression arguments I talked about in this paragraph for something like select.


#### Clause order

Expand Down