Alzabo::Table(3pm)

πŸ“¦
version 0.92 Β· 2 versions
  • 0.92 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.92 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 to 0.

Returns a boolean value indicating whether the table has this particular attribute. πŸ“

🌸 foreign_keys

This method takes two parameters:

  • column => an Alzabo::Column object
  • table => an Alzabo::Table object

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