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

Knex.Builder.prototype.where should take Knex.Raw #15

Closed
moll opened this Issue Jun 8, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@moll
Collaborator

moll commented Jun 8, 2013

I was surprised to find out that instead of calling .where and passing it a Knex.Raw object (like the example does with Builder.prototype.select) one would have to call whereRaw. I'd strongly suggest having where take a Raw object directly to be consistent.

Currently it results in a very weird query if you do so:

"value" = $2 and "client" = $3 and "_debug" = $4 and "_promise" = $5 and "debug" = (select *) and "exec" = (select *) and "then" = (select *) and "toString" = (select *) and "connection" = (select *) and "_connection" = $6 and "_setType" = (select *) and "_cleanBindings" = (select *) and "runQuery" = (select *) and "_source" = $7 and "toSql" = (select *)'
@tgriesser

This comment has been minimized.

Owner

tgriesser commented Jun 8, 2013

@moll - good point, just added support for that - let me know if you see other places that it's not consistent.

I'm going to take a look at fixing the other ticket and then publish a new version in the next day or so.

@moll

This comment has been minimized.

Collaborator

moll commented Jun 8, 2013

Cool.

You know the code base better than me — I'd say each of those functions should take a Raw, such as HAVING clauses etc. if they don't already.

tgriesser added a commit that referenced this issue Jun 9, 2013

Merge branch 'master' into gh-pages
* master:
  0.1.5
  Adding beforeCreate and afterCreate as options on the pool's config #14
  Allowing Knex.Raw statements in where clauses, #15
  shouldn't need bindings on raw queries
  minor code tweak
@tgriesser

This comment has been minimized.

Owner

tgriesser commented Jun 9, 2013

Yep - they should now.

@tgriesser tgriesser closed this Jun 9, 2013

tgriesser added a commit that referenced this issue Jun 11, 2013

Merge branch 'master' into migrations
* master:
  Allowing Knex.Raw statements in where clauses, #15
  shouldn't need bindings on raw queries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment