Class::...:SQLite(3)

okay bestie, welcome to the Class::DBI::Test::SQLite page πŸ’– it's hanging out in the User Contributed Perl Documentation, and it's here to make your Class::DBI test setup feel less like homework and more like a slay. No cap.

🌸 NAME 🌸

Class::DBI::Test::SQLite β€” Base class for Class::DBI tests. That's the whole name, and it's already telling you its main character job. ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

okay so here's the little setup vibe β€” keep the code exactly as it is, because this is literal code, not a suggestion:

use base 'Class::DBI::Test::SQLite';

__PACKAGE__->set_table('test');
__PACKAGE__->columns(All => qw/id name film salary/);

sub create_sql {
        return q{
                id     INTEGER PRIMARY KEY,
                name   CHAR(40),
                film   VARCHAR(255),
                salary INT
        }
}

πŸ’– DESCRIPTION πŸ’–

This gives you a simple base class for Class::DBI tests using SQLite. Each class for the test should inherit from this one, provide a create_sql() method that returns a string representing the SQL used to create the table for the class, and then call set_table() to create the table, and tie it to the class. It's giving "tiny setup helper with main character energy," and honestly? Obsessed. 🫢

πŸ’… METHODS πŸ’…

πŸ› οΈ set_table πŸ› οΈ

__PACKAGE__->set_table('test');

This combines creating the table with the normal Class::DBI table() call. So you get the table-making part and the normal table call together in one little move. Slay. ✨

🧚 create_sql (abstract) 🧚

sub create_sql {
        return q{
                id     INTEGER PRIMARY KEY,
                name   CHAR(40),
                film   VARCHAR(255),
                salary INT
        }
}

This should return, as a text string, the schema for the table represented by this class. The heading says (abstract), so this is the one you fill in β€” just hand over that schema string, bestie. πŸŽ€


mwah πŸ’‹ this page came from perl v5.42.0, dated 2011-04-08, and it's filed under Class::...:SQLite(3) β€” go make those tests iconic, and take care of yourself. πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from