Alzabo...Column(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

πŸ’– Alzabo::Create::Column β€” bestie edition ✨

okay so this is Alzabo::Create::Column, straight out of the User Contributed Perl Documentation corner of your local perldoc setup. pull up a chair, grab a boba, we're doing columns today πŸ§‹


🌸 NAME 🌸

Alzabo::Create::Column β€” Column objects for use in schema creation πŸ’…


✨ SYNOPSIS ✨

use Alzabo::Create::Column;

πŸ¦‹ DESCRIPTION πŸ¦‹

So this object represents a column. it holds data specific to a column. that's its whole job, and it does it beautifully.

but wait β€” there's more. additional data lives in an Alzabo::Create::ColumnDefinition object, and the reason for that split is genuinely iconic: it lets two columns share a type. and why do we care?? because when two columns in different tables are related, sharing a type means if you change the type of one, the other changes too. automatic. no cap. πŸ”₯


πŸ‘‘ INHERITS FROM πŸ‘‘

Alzabo::Column

Note: all relevant documentation from the superclass has been merged into this document. so nothing's hiding, bestie, it's all right here 🫢

πŸ’… METHODS πŸ’…

new

the constructor, obviously. it accepts these parameters:

  • table => Alzabo::Create::Table object
  • name => $name
  • nullable => 0 or 1 (optional) β€” defaults to false.
  • sequenced => 0 or 1 (optional) β€” defaults to false.
  • default => $default (optional)
  • default_is_raw => $boolean (optional) β€” if default_is_raw is true, then it will not be quoted when passed to the DBMS in SQL statements. this is the move when your default is a function, like NOW(). πŸ•
  • attributes => \@attributes (optional)
  • length => $length (optional)
  • precision => $precision (optional) β€” one of either ...
  • type => $type β€” ... or ...
  • definition => Alzabo::Create::ColumnDefinition object
  • comment => $comment β€” an optional comment.

it returns a new Alzabo::Create::Column object. slay ✨

Throws: Alzabo::Exception::Params


type

returns the column's type as a string. short. sweet. iconic.


alter

this method lets you change a column's type, length, and precision as a single operation. it should be used instead of calling set_type() followed by set_length(). one glow-up, not two πŸ’…

it takes the following parameters:

  • type => $type
  • length => $length (optional)
  • precision => $precision (optional)

Throws: Alzabo::Exception::Params, Alzabo::Exception::RDBMSRules


set_type ($type)

sets the column's type.

Throws: Alzabo::Exception::Params, Alzabo::Exception::RDBMSRules


set_table ("Alzabo::Create::Table" object)

sets the Alzabo::Create::Table object in which this column is located. like, where does this column live? here, bestie 🏠

Throws: Alzabo::Exception::Params


name

returns the column's name as a string.


set_name ($name)

sets the column's name (a string).

Throws: Alzabo::Exception::Params, Alzabo::Exception::RDBMSRules


nullable

returns a boolean value indicating whether or not NULLs are allowed in this column.


set_nullable (0 or 1)

sets the nullability of the column (this determines whether nulls are allowed in the column or not). must be 0 or 1. no vibes-based middle ground, sorry 😭

Throws: Alzabo::Exception::Params


attributes

a column's attributes are strings describing the column β€” for example, valid attributes in MySQL are 'UNSIGNED' or 'ZEROFILL'.

this method returns a list of strings of such strings. yes, a list of strings of strings, that's just how it is πŸ“


has_attribute

this method can be used to test whether or not a column has a particular attribute. by default, the check is case-insensitive.

it takes the following parameters:

  • attribute => $attribute
  • case_sensitive => 0 or 1 (defaults to 0)

it returns a boolean value indicating whether or not the column has this particular attribute. vibe check complete βœ…


set_attributes (@attributes)

sets the column's attributes. these are strings describing the column β€” for example, valid attributes in MySQL are "PRIMARY KEY" or "AUTO_INCREMENT".

Throws: Alzabo::Exception::RDBMSRules


add_attribute ($attribute)

add an attribute to the column's list of attributes. one more for the collection πŸŽ€

Throws: Alzabo::Exception::RDBMSRules


delete_attribute ($attribute)

delete the given attribute from the column's list of attributes. we love a clean slate 🧹

Throws: Throws: Alzabo::Exception::Params, Alzabo::Exception::RDBMSRules


default

returns the default value of the column as a string, or undef if there is no default.


set_default ($default)

sets the column's default value.


length

returns the length attribute of the column, or undef if there is none.


precision

returns the precision attribute of the column, or undef if there is none.


set_length

this method takes the following parameters:

  • length => $length
  • precision => $precision (optional)

this method sets the column's length and precision. the precision parameter is optional (though some column types may require it if the length is set). iykyk.

Throws: Alzabo::Exception::RDBMSRules


sequenced

okay so the meaning of a sequenced column varies from one RDBMS to another. in those with sequences, it means that a sequence is created and that values for this column will be drawn from it for inserts into this table. in databases without sequences, the nearest analog for a sequence is used (in MySQL the column is given the AUTO_INCREMENT attribute, in Sybase the identity attribute).

in general, this only has meaning for the primary key column of a table with a single column primary key. setting the column as sequenced means its value never has to be provided when calling Alzabo::Runtime::Table->insert. it just shows up. main character energy πŸ‘‘

returns a boolean value indicating whether or not this column is sequenced.


set_sequenced (0 or 1)

sets the value of the column's sequenced attribute.

Throws: Alzabo::Exception::Params, Alzabo::Exception::RDBMSRules


is_primary_key

returns a boolean value indicating whether or not this column is part of its table's primary key.


is_numeric

returns a boolean value indicating whether the column is a numeric type column.


is_character

returns a boolean value indicating whether the column is a character type column.

this is true only for any columns which are defined to hold text data, regardless of size.


is_blob

returns a boolean value indicating whether the column is a blob column.

this is true for any columns defined to hold binary data, regardless of size.


definition

the definition object is very rarely of interest. use the type() method if you are only interested in the column's type. fr fr, don't overthink it.

this method returns the Alzabo::Create::ColumnDefinition object which holds this column's type information.


set_definition ("Alzabo::Create::ColumnDefinition" object)

sets the Alzabo::Create::ColumnDefinition object which holds this column's type information.


former_name

if the column's name has been changed since the last time the schema was instantiated, this method returns the column's previous name. it's giving... glow-up receipts πŸ’€


comment

returns the comment associated with the column object, if any.


set_comment ($comment)

set the comment for the column object.


and that's the whole page, bestie 🫢 this was Alzabo...Column(3pm) from the User Contributed Perl Documentation, shipped with perl v5.34.0 and dated 2022-06-14. go forth and build schemas, you absolute icon πŸŒˆπŸ’–βœ¨

πŸ“¦ where this page comes from