Expand description
Mods for sqlite::update.
table is the table being written to; from is the extra from-item
UPDATE … FROM allows, and the joins attach to that, never to the target —
which is the whole reason the two are different mods.
use keelson_sqlite as sqlite;
use keelson_sqlite::{Chain, arg, quote, update};
let q = sqlite::update((
update::table(quote("posts")).as_("p"),
update::set_col("views").to(quote(("p", "views")).plus(arg(1i32))),
update::from(quote("users")).as_("u"),
update::where_(quote(("u", "id")).eq(quote(("p", "user_id")))),
update::returning(quote(("p", "id"))),
));There is no limit, no offset and no order_by: SQLite’s parser accepts them
on an UPDATE, but only a build compiled with
SQLITE_ENABLE_UPDATE_DELETE_LIMIT does, and the ordinary one — including the
SQLite these tests link against — rejects them. There is no where_current_of
either, because SQLite has no cursors.
Re-exports§
pub use crate::shared::cross_join;pub use crate::shared::extra_from_item as from_also;pub use crate::shared::from_item as from;pub use crate::shared::full_join;pub use crate::shared::inner_join;pub use crate::shared::left_join;pub use crate::shared::or_abort;pub use crate::shared::or_fail;pub use crate::shared::or_ignore;pub use crate::shared::or_replace;pub use crate::shared::or_rollback;pub use crate::shared::recursive;pub use crate::shared::returning;pub use crate::shared::right_join;pub use crate::shared::set;pub use crate::shared::set_col;pub use crate::shared::target_table as table;pub use crate::shared::where_;pub use crate::shared::with;