Mojo::...saction(3pm)

πŸ’… NAME πŸ’…

Mojo::SQLite::Transaction β€” bestie, it's literally a Transaction ✨

(also, fun fact, this page lives in the User Contributed Perl Documentation section of the manual, iykyk πŸŽ€)


✨ SYNOPSIS ✨

okay so here's the whole vibe in four lines, no cap:

use Mojo::SQLite::Transaction;

my $tx = Mojo::SQLite::Transaction->new(db => $db);
$tx->commit;

that's it. that's the whole thing. slay πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

Mojo::SQLite::Transaction is a scope guard for DBD::SQLite transactions β€” the ones that Mojo::SQLite::Database actually uses. so like, it's giving "the responsible friend who makes sure the transaction gets handled" energy πŸ‘‘. it hangs around and does the right thing when the scope ends. periodt.


🌸 ATTRIBUTES 🌸

Mojo::SQLite::Transaction implements the following attributes β€” yes, there's exactly one, we love a minimal queen:

πŸŽ€ db

my $db = $tx->db;
$tx    = $tx->db(Mojo::SQLite::Database->new);

this is the Mojo::SQLite::Database object that this transaction belongs to β€” its main character, fr fr.

⚠️ heads up bestie: this attribute is weakened. like, the reference doesn't hold it up, so don't expect it to keep the object alive on its own. important detail, don't skip it πŸ™ˆ

πŸ’– METHODS πŸ’–

Mojo::SQLite::Transaction inherits all methods from Mojo::Base (the whole family tree, we love to see it) and implements the following new ones:

⭐ new

my $tx = Mojo::SQLite::Transaction->new;
my $tx = Mojo::SQLite::Transaction->new(db => Mojo::SQLite::Database->new);
my $tx = Mojo::SQLite::Transaction->new({db => Mojo::SQLite::Database->new});

constructs a brand new Mojo::SQLite::Transaction object ✨. three ways to call it, pick your fighter β€” no args, a list of key/value pairs, or a hashref. all valid, all iconic.

πŸ”₯ commit

$tx->commit;

commits the transaction πŸ”₯. that's the whole description. do with that what you will. ate, honestly.


πŸ’€ BUGS πŸ’€

found something cursed? report any issues on the public bugtracker. don't suffer in silence bestie 🫢


🧚 AUTHOR 🧚

Dan Book, dbook@cpan.org β€” the icon behind all this πŸ’œ


Copyright 2015, Dan Book.

This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0. so like, go off, but legally 🌈


🌟 SEE ALSO 🌟

  • Mojo::SQLite β€” the main event, go read it next πŸ’–

okay that's the whole page!! πŸŽ€ source/version vibes: this is perl v5.42.0, dated 2022-03-23 β€” a whole little time capsule, and honestly? she still slays πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from