Comments (9)
I also expected Where
and Join
Β to accept subqueries. E.g.:
sqlBuilder.
Select("id").
From("documents").
Where(squirrel.Eq("id": sqlBuilder.
Select("source_id").
From("refs").
Where(squirrel.Eq{"target_id", ids})))
This issue hasn't received any love since 2014. Seems Squirrel doesn't have much activity.
from squirrel.
If you use squirrel and postgres, you probably have something like this
var psql = sq.StatementBuilder.PlaceholderFormat(sq.Dollar)
in your code.
Don't use that when writing code which uses subqueries. Instead, simply use squirrel directly.
query := sq.Select()....
Then, just before calling .ToSql()
, convert the placeholders:
sql, args, err := query.PlaceholderFormat(sq.Dollar).ToSql()
from squirrel.
Any fix for SelectFrom since this was closed? I am having problems passing arguments using select from and postgres. I keep getting pq: got 1 parameters but the statement requires 0. Workarounds would be satisfactory as well. Thanks!
from squirrel.
This main problem with this and #20 is handling Postgres placeholders. Postgres needs to have unique placeholders (e.g. $1, $2, $3), which is difficult to achieve when combining multiple queries in the current code.
from squirrel.
In my view, It works well with change timing PlaceholderFormat.Placeholders() in selectData.ToSql().
Can I write prototype?
from squirrel.
Go for it. If it works I'll be happy to accept.
from squirrel.
I tried fix this issue on fffd5d6.
I changed SelectBuilder.From() to acceptable SelectBuilder type.
thanks!
from squirrel.
Hi guys! You can also check alternative with no additional builders implementation ;)
https://github.com/elgris/sqrl
If it looks good, I can prepare PR for squirrel.
from squirrel.
AFAIK this is supported with SelectFrom
which does not support parameters correctly
from squirrel.
Related Issues (20)
- Reusable conditional where query HOT 2
- "update table set column1=column1+1", this sql would set column1=0 HOT 1
- Question about tuple IN condition
- Limit and Offset use prepare statement placeholder HOT 2
- How to generate paging queries for SQLserver
- Syntax Error with `squirrel.Or` in Postgres
- CopyFrom, CopyTo support
- Inserting array value on postgresql
- Where condition placeholder HOT 2
- join argument wrong order HOT 3
- insert using select that has a non string column
- Request: parse slice of floating-point to vector HOT 1
- Where clause compare column of table HOT 3
- ToSQL placeholders no longer compatible with MySQL 8 HOT 1
- Add GetOrderBy and RemoveOrderBy to get and remove the OrderByParts from the query
- Multiple value where clause using squirrel HOT 3
- Upsert/On Conflict support
- Passing time.Time value type into WHERE arguments HOT 1
- Having both $ed and raw values in `SetMap` map
- Where with parametrized INTERVAL HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from squirrel.