ForeignKeyIterator

ForeignKeyIterator iterates from or to a table by its foreign key constraints.  This is a special type of SchemaIterator with the same interface, so it can be used in place of a SchemaIterator, but internally it functions very differently.  Whereas a SchemaIterator is a real iterator that only gets the next schema object when called, a ForeignKeyIterator slurps the given SchemaIterator so it can discover foreign key constraints.

Summary
ForeignKeyIteratorForeignKeyIterator iterates from or to a table by its foreign key constraints.
Functions
new
next_schema_objectReturn the next schema object or undef when no more schema objects.
reset
_get_fk_refs
_recurse_fk_references
_d

Functions

new

sub new

Parameters

%argsArguments

Required Arguments

dbDatabase of tbl.
tblTable to iterate from to its referenced tables.
SchemaSchema object.
SchemaIteratorSchemaIterator object created with Schema and keep_ddl=>true.
TableParserTableParser object.
QuoterQuoter object.

Optional Arguments

reverseIterate in reverse, from referenced tables to tbl.

Returns

ForeignKeyIterator object

next_schema_object

sub next_schema_object

Return the next schema object or undef when no more schema objects.

Returns

Hashref of schema object with at least a db and tbl keys, like

{
   db         => 'test',
   tbl        => 'a',
   ddl        => 'CREATE TABLE `a` ( ...',
   tbl_struct => <TableParser::parse()> hashref of parsed ddl,
   fk_struct  => <TableParser::get_fks()> hashref of parsed fk constraints
}

reset

sub reset

_get_fk_refs

sub _get_fk_refs

_recurse_fk_references

sub _recurse_fk_references

_d

sub _d
sub new
sub next_schema_object
Return the next schema object or undef when no more schema objects.
sub reset
sub _get_fk_refs
sub _recurse_fk_references
sub _d
SchemaIterator iterates schema objects.
Schema encapsulates a data structure representing databases and tables.
TableParser parses SHOW CREATE TABLE.
Quoter handles value quoting, unquoting, escaping, etc.
Close