Skip to content

manage raw where clause with array as param#1044

Merged
jwoertink merged 2 commits intoluckyframework:mainfrom
davidepaolotua:manage-raw-query-with-array-params
Jun 16, 2024
Merged

manage raw where clause with array as param#1044
jwoertink merged 2 commits intoluckyframework:mainfrom
davidepaolotua:manage-raw-query-with-array-params

Conversation

@davidepaolotua
Copy link
Contributor

Implements #1031

Btw, is there any reason for which the raw does param substitution and does not use bind variables? Albeit small, there might be a perf hit, in that case

Copy link
Member

@jwoertink jwoertink left a comment

Choose a reason for hiding this comment

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

oh awesome! You know, I'm not sure why the ? was used instead of bind variables... My only guess is because that's what Rails did? 🤷‍♂️ I know it has made a few of the jsonb operations a bit difficult.

I guess thinking about it.... If you did UserQuery.new.admin(true).where("something = ?", whatever) you'd have to know that the admin(true) is already using $1, so your ? would need to be $2 in this case. That could get real messy trying to track that in larger queries where you might use methods for a larger portion like

UserQuery.new.for_some_special_case.where("something = $5", whatever)

😂 I don't know if that's the real reason or not, but that's my best guess.

@jwoertink jwoertink merged commit 3a27ebb into luckyframework:main Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants