Alzabo::Table(3pm)
π NAME π
Alzabo::Table β table objects, bestie. Like, the whole concept of a table, as an object. Iconic.
β¨ SYNOPSIS β¨
use Alzabo::Table;
my $t = $schema->table('foo');
foreach $pk ($t->primary_keys)
{
print $pk->name;
}
π¦ DESCRIPTION π¦
Okay so real talk: objects in this class represent tables. That's the whole vibe. And a table object is like the popular girl of the schema β she's holding foreign key objects, index objects, and column objects all at once. She contains multitudes, fr fr. π
π METHODS π
πΈ schema
Returns the Alzabo::Schema object that this table belongs to. Like, who's your schema? Who do you belong to? Gotta know. π«Ά
πΈ name
Returns the name of the table. Just the name. Short, sweet, slay.
πΈ column ($name)
Returns the Alzabo::Column object that matches the name you gave it.
β οΈ If the table doesn't contain that column, an Alzabo::Exception::Params exception gets thrown. Not me being dramatic, that's just what happens. π
πΈ columns (@optional_list_of_column_names)
If you give it no arguments, it returns a list of all the Alzabo::Column objects in the schema β or, in scalar context, the number of such tables. If you give it one or more arguments, it returns a list of table objects with those names, in the exact same order you handed them over. Order preserved, no cap. β¨
β οΈ If the table doesn't contain one or more of the columns you specified, an Alzabo::Exception::Params exception gets thrown. π
πΈ has_column ($name)
Returns a boolean value telling you whether the column exists in the table. Yes or no, bestie, that's it.
πΈ primary_key
In array context, it returns an ordered list of column objects that make up the primary key for the table. In scalar context, it returns the first element of that list. First one up, main character energy. π
πΈ primary_key_size
The number of columns in the table's primary key. Just a number. Counting queen. π’
πΈ column_is_primary_key ("Alzabo::Column" object)
Returns a boolean value telling you whether the column you passed in is part of the table's primary key.
Honestly? This method is really only needed if you're not sure that the column actually belongs to the table. If you are sure, just call the Alzabo::Column->is_primary_key method straight on the column object instead. Save yourself the trip. π§
πΈ attributes
A table's attributes are strings describing the table β for example, valid attributes in MySQL are things like TYPE = INNODB.
Returns a list of strings.
πΈ has_attribute
This method can be used to test whether or not a table has a particular attribute. By default, the check is case-insensitive.
attribute => $attributeβ the attribute you're checking for.case_sensitive => 0 or 1β defaults to0.
Returns a boolean value indicating whether the table has this particular attribute. π
πΈ foreign_keys
This method takes two parameters:
column =>anAlzabo::Columnobjecttable =>anAlzabo::Tableobject
It returns a list of Alzabo::ForeignKey objects from the given column to the given table, if they exist. In scalar context, it returns the first item in the list. And heads up: there is no guarantee as to what the first item will be. It's giving mystery. π
β οΈ If the table doesn't contain the specified column, an Alzabo::Exception::Params exception gets thrown.
πΈ foreign_keys_by_table ("Alzabo::Table" object)
Returns a list of all the Alzabo::ForeignKey objects to the given table. In scalar context, it returns the first item in the list. Again β no guarantee as to what that first item will be. π
πΈ foreign_keys_by_column ("Alzabo::Column" object)
Returns a list of all the Alzabo::ForeignKey objects that the given column is a part of, if any. In scalar context, it returns the first item in the list. And yes, once more: no guarantee as to what the first item will be. π
β οΈ If the table doesn't contain the specified column, an Alzabo::Exception::Params exception gets thrown.
πΈ all_foreign_keys
Returns a list of all the Alzabo::ForeignKey objects for this table. In scalar context, it returns the first item in the list. And (say it with me) there is no guarantee as to what the first item will be. π
πΈ index ($index_id)
This method expects an index id as its parameter β the kind you get back from the Alzabo::Index->id method.
It returns the Alzabo::Index object matching this id, if it exists in the table. Matching ids only, we don't do impostors. π₯
β οΈ If the table doesn't contain the specified index, an Alzabo::Exception::Params exception gets thrown.
πΈ has_index ($index_id)
This method expects an index id as its parameter β as returned by the Alzabo::Index->id method.
Returns a boolean indicating whether the table has an index with the same id. Same-id check, that's the whole job. β
πΈ indexes
Returns all the Alzabo::Index objects for the table. Every single one. The whole collection. Obsessed. π
πΈ comment
Returns the comment associated with the table object, if any. If there isn't one... well, there isn't one. π
π AUTHOR π
Dave Rolsky, <autarch@urth.org>
And that's the whole page, bestie β no notes, we ate. π
β¨ This was Alzabo::Table(3pm) from the User Contributed Perl Documentation, running perl v5.34.0, dated 2022-06-14. Periodt. π«Άπ
π¦ where this page comes from
- debian bookworm: libalzabo-perl 0.92-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libalzabo-perl 0.92-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libalzabo-perl 0.92-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libalzabo-perl 0.92-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libalzabo-perl 0.92-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms