Class:...SQLite(3pm)

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

πŸ’– Class::DBI::Loader::SQLite πŸ’–

okay bestie, so this is the SQLite implementation of Class::DBI::Loader β€” like, the plug that lets your SQLite database show up as a whole lil family of Perl classes. it lives in the User Contributed Perl Documentation pile and it is genuinely so cute of it. 🫢


✨ NAME ✨

Class::DBI::Loader::SQLite β€” that's the module, and what it is, is the Class::DBI::Loader SQLite Implementation. boom. iconic. πŸ’…


🌸 SYNOPSIS 🌸

the way you literally just do this:

  use Class::DBI::Loader;

  # $loader is a Class::DBI::Loader::SQLite
  my $loader = Class::DBI::Loader->new(
    dsn       => "dbi:SQLite:dbname=/path/to/dbfile",
    namespace => "Data",
  );
  my $class = $loader->find_class('film'); # $class => Data::Film
  my $obj = $class->retrieve(1);

okay so quick tour: you use Class::DBI::Loader, you build yourself a loader with your dsn (dbi:SQLite:dbname=/path/to/dbfile, so yes, you point it right at your actual db file πŸ’€) plus a namespace, and ngl that $loader you just made is a Class::DBI::Loader::SQLite β€” that's the whole bit. then find_class('film') hands you back the class, so $class is Data::Film, and $class->retrieve(1) goes and grabs you the object. slay. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the tea:

  • Multi-column primary keys are supported. yes bestie, composite keys, we love to see it. πŸ‘‘
  • Multi-column foreign keys are also totally fine to define β€” you can write them, no one's stopping you, no cap β€” but they will be ignored, because Class::DBI does not support them. so like. they're giving decorative. πŸŽ€ it's not this module's fault, it's just how Class::DBI rolls. don't come for me.

and if you wanna go deeper, go see Class::DBI::Loader and Class::DBI::Loader::Generic.


🌈 SEE ALSO 🌈

  • Class::DBI::Loader
  • Class::DBI::Loader::Generic

πŸŽ€ the sign-off πŸŽ€

this whole lil page came from the User Contributed Perl Documentation, brought to you by perl v5.36.0, dated 2022-12-07 β€” so yeah, it's been out here being correct since then, and it ate. go build something, bestie. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from