keelson_sqlite/update.rs
1//! Mods for [`sqlite::update`](crate::update()).
2//!
3//! [`table`] is the table being written to; [`from`] is the extra from-item
4//! `UPDATE … FROM` allows, and the joins attach to *that*, never to the target —
5//! which is the whole reason the two are different mods.
6//!
7//! ```
8//! use keelson_sqlite as sqlite;
9//! use keelson_sqlite::{Chain, arg, quote, update};
10//!
11//! let q = sqlite::update((
12//! update::table(quote("posts")).as_("p"),
13//! update::set_col("views").to(quote(("p", "views")).plus(arg(1i32))),
14//! update::from(quote("users")).as_("u"),
15//! update::where_(quote(("u", "id")).eq(quote(("p", "user_id")))),
16//! update::returning(quote(("p", "id"))),
17//! ));
18//! ```
19//!
20//! There is no `limit`, no `offset` and no `order_by`: SQLite's parser accepts them
21//! on an `UPDATE`, but only a build compiled with
22//! `SQLITE_ENABLE_UPDATE_DELETE_LIMIT` does, and the ordinary one — including the
23//! SQLite these tests link against — rejects them. There is no `where_current_of`
24//! either, because SQLite has no cursors.
25
26pub use crate::shared::{
27 cross_join, extra_from_item as from_also, from_item as from, full_join, inner_join, left_join,
28 or_abort, or_fail, or_ignore, or_replace, or_rollback, recursive, returning, right_join, set,
29 set_col, target_table as table, where_, with,
30};