Alzabo...eignKey(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::Runtime::ForeignKey β€” the Alzabo...eignKey(3pm) page, bestie edition ✨

okay so. you opened the manual for Alzabo...eignKey(3pm) and honestly? you came to the right place. this is the whole thing, nothing skipped, everything kept. let's go 🫢


✨ NAME ✨

Alzabo::Runtime::ForeignKey β€” it's giving foreign key objects. that's the whole vibe. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

look at her. three lines. iconic.

  $fk->register_insert( $value_for_column );
  $fk->register_update( $new_value_for_column );
  $fk->register_delete( $row_being_deleted );

🌸 DESCRIPTION 🌸

so objects in this class maintain referential integrity. that's their whole job. their moment. their era.

and like β€” be honest β€” this is really only useful when your RDBMS can't do this itself. the example given is MySQL without InnoDB. no cap, if your database already handles this, this class is basically standing there holding your emotional support water bottle. πŸ™ˆ


πŸ¦‹ INHERITS FROM πŸ¦‹

Alzabo::ForeignKey

πŸ’Œ quick note, bestie: all relevant documentation from the superclass has been merged into this document. so don't go chasing it elsewhere, it's all right here. you're welcome. ✨

πŸ‘‘ METHODS πŸ‘‘

table_from

table_to

Returns the relevant Alzabo::Runtime::Table object. that's it. that's the method. slay. πŸ’œ

columns_from

columns_to

Returns the relevant Alzabo::Runtime::Column object(s) for the property, and it hands them back as an array. plural behavior, plural energy. πŸŽ€

cardinality

Returns a two element array containing the two portions of the cardinality of the relationship. and each portion? either '1' or 'n'. those are literally the only two options. pick your fighter. ⭐

from_is_dependent

to_is_dependent

Returns a boolean value telling you whether there's a dependency from one table to the other. yes or no, king. πŸ’š

is_one_to_one

is_one_to_many

is_many_to_one

Returns a boolean value indicating what kind of relationship the object represents. it's giving situationship taxonomy but make it relational databases. 😭

is_same_relationship_as ($fk)

you hand it a foreign key object, and it returns true if the two objects represent the same relationship.

but β€” and this is the cute plot twist β€” the two objects may represent the same relationship from different table's points of view. so it's the same love story, just told by two different narrators. πŸ’–

register_insert ($new_value)

This method takes the proposed column value for a new row and makes sure it's valid based on the relationship that this object represents. vibe check on the way in. βœ…

Throws: Alzabo::Exception::ReferentialIntegrity

register_update ($new_value)

This method takes the proposed new value for a column and makes sure it's valid based on the relationship that this object represents. same energy, different lifecycle event. πŸ”„

Throws: Alzabo::Exception::ReferentialIntegrity

register_delete ("Alzabo::Runtime::Row" object)

Allows the foreign key to delete rows dependent on the row being deleted.

πŸ’€ WARNING, FR FR: note that this can lead to a chain reaction of cascading deletions. you have been warned. this is not a drill. one delete becomes twelve deletes. the dominoes are dominoing. 😭

Throws: Alzabo::Exception::ReferentialIntegrity

id

Returns a string uniquely identifying the foreign key. her little name tag. 🏷️✨

comment

Returns the comment associated with the foreign key object, if any. might be there, might not, no pressure. 🌈


🧚 AUTHOR 🧚

Dave Rolsky, <autarch@urth.org> β€” shoutout to the icon, the legend, the moment. πŸ‘‘


and that's the page!! every option, every method, every throw, every warning, all intact, nothing dropped, we ate and left no crumbs. πŸ“

this was perl v5.34.0, dated 2022-06-14, and it lives at Alzabo...eignKey(3pm) β€” mwah, take care of her, she's doing her best. πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from