Skip to content
This repository has been archived by the owner on Oct 15, 2018. It is now read-only.

query method mis-documented #97

Open
devinivy opened this issue Sep 26, 2015 · 3 comments
Open

query method mis-documented #97

devinivy opened this issue Sep 26, 2015 · 3 comments

Comments

@devinivy
Copy link
Contributor

At https://github.com/balderdashy/waterline-docs/blob/master/queries/query-methods.md#query-query-data-callback- the format of the query is shown as,

Movie.query('SELECT * FROM movie WHERE title = $1', [title] //...

but it should use ? instead, as such,

Movie.query('SELECT * FROM movie WHERE title = ?', [title] //...

Related: https://github.com/balderdashy/sails-mysql/issues/245

@particlebanana
Copy link
Contributor

@devinivy wouldn't this depend on the adapter you are using? Postgresql accepts $1 just fine.

@devinivy
Copy link
Contributor Author

devinivy commented Oct 2, 2015

Ah, yeah it probably does. That method just uses the driver's query method directly. The mysql driver wants ?s. As long as they're consistent, I don't think there's any problem, but it sounds like there's an update needed. Maybe both adapters could support both syntaxes for now?

@particlebanana
Copy link
Contributor

We don't do any parsing of the strings sent to the .query method. The actual drivers are different so one accepts $1 and one accepts ?. We would have to parse the query string to make it support both. We can just change the example or put one example with a postgresql label and one with a mysql label sort of how Knex shows examples for different databases.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants