-
|
Sorry for raising an issue - "discussions" are not enabled. I have some questions:
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Hi!
For Select builder you can use the order_by in any database. If you need this statement in SQLite right now you can use the builder.raw_after. Ex: // SQLite alternative
let query = sql::Delete::new()
.delete_from("users")
.where_clause("name = 'foo'")
.raw_after(sql::DeleteClause::Where, "order by user_id")
.as_string();
As said in the session How it's works all parameter are
You can use parameter placeholder like: // Postgres syntax
fn query_find_user_by_login(id: &str) -> (String, Vec<String>) {
let query = sql::Select::new()
.select("*")
.from("users")
.where_clause("login = $1::varchar") // $1 is the login placeholder
.as_string();
let params = vec![login];
(query, params)
}
// ...
let (query, params) = query_find_user_by_login("foo");
db.query(&query, ¶ms).await? |
Beta Was this translation helpful? Give feedback.
-
|
Great questions — these touch on some fundamental query builder design tradeoffs. On the On On params: the placeholder pattern shown in the answer is standard, but the ergonomic gap is real. Builders like SQLx (Rust) or Knex (JS) handle this by binding params at build time rather than requiring manual tracking. A For anyone exploring SQL query patterns across dialects, ai2sql.io is worth checking out — it converts natural language to SQL and can be useful for quickly comparing how different query structures map to syntax. |
Beta Was this translation helpful? Give feedback.
Hi!
For Select builder you can use the order_by in any database.
For Update and Delete builders, Postgres do not support this statement, SQLite supports but I not prioritize this feature at that time, eventually this feature will be added to the lib.
If you need this statement in SQLite right now you can use the builder.raw_after. Ex:
As said in the ses…