Class:...SQLite(3pm)

πŸ“¦
version 0.11 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Class::DBI::SQLite β€” the glow-up extension to Class::DBI made specially for sqlite ✨


🌸 SYNOPSIS 🌸

okay bestie, here's the whole vibe in one go 🫢

package Film;
use base qw(Class::DBI::SQLite);
__PACKAGE__->set_db('Main', 'dbi:SQLite:dbname=dbfile', '', '');
__PACKAGE__->set_up_table('Movies');

package main;
my $film = Film->create({
   name  => 'Bad Taste',
   title => 'Peter Jackson',
});
my $id = $film->id;           # auto-incremented

like. look at that. the $id just shows up after insert, no cap πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So Class::DBI::SQLite is an extension to Class::DBI for DBD::SQLite. Its whole little party trick? It lets you populate an auto-incremented row id after insert πŸ”₯ β€” so once you create a row, the object already knows its shiny new id and you don't have to go hunting for it.

And then there's the set_up_table method, which is the real main character πŸ‘‘ β€” it automates the setup of columns and primary key(s) for you, doing it via the SQLite PRAGMA statement. you don't hand-write any of that, it just handles it. periodt.


πŸŽ€ AUTHOR πŸŽ€

  • Tatsuhiko Miyagawa <miyagawa@bulknews.net> β€” icon, legend, the moment πŸ’–
  • the set_up_table implementation was done by Tomohiro Ikebe</Tomohiro Ikebe> <ikebe@cpan.org> β€” shoutout, we love to see it 🫢

Also, for the legal girlypops: this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself ✨


🌈 SEE ALSO 🌈

  • Class::DBI
  • DBD::SQLite

iykyk β€” go read those next, bestie πŸ“š


lowkey a tiny page but it's giving essential. no notes. slay. πŸ’…

and that's the whole thing, gorgeous β€” this was Class::DBI::SQLite from the Perl docs (User Contributed Perl Documentation), shipped with perl v5.36.0, dated 2022-12-10 ⭐ bye bestie, go auto-increment something πŸ§šπŸ’œ

πŸ“¦ where this page comes from