Alzabo...Column(3pm)
π 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::Tableobjectname=>$namenullable=>0or1(optional) β defaults to false.sequenced=>0or1(optional) β defaults to false.default=>$default(optional)default_is_raw=>$boolean(optional) β ifdefault_is_rawis 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, likeNOW(). πattributes=>\@attributes(optional)length=>$length(optional)precision=>$precision(optional) β one of either ...type=>$typeβ ... or ...definition=>Alzabo::Create::ColumnDefinitionobjectcomment=>$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=>$typelength=>$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=>$attributecase_sensitive=>0or1(defaults to0)
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=>$lengthprecision=>$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
- 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