Help for this page

Select Code to Download


  1. or download this
    person_id    mediumint unsigned auto_increment primary key,
    sex          char(1) default '?' not null,
    modified     date not null
    
  2. or download this
    name_id      mediumint unsigned auto_increment primary key,
    name         varchar(255) not null
    
  3. or download this
    person       mediumint unsigned not null, /* references 'person' */
    firstname    mediumint unsigned not null, /* references 'name' */
    lastname     mediumint unsigned not null  /* references 'name' */
    
  4. or download this
    package Person;
    use strict;
    ...
    Person->has_many( names => 'PersonName' );
    
    1;
    
  5. or download this
    package Name;
    use strict;
    ...
    Name->columns( All => qw(name_id name) );
    
    1;
    
  6. or download this
    package PersonName;
    use strict;
    ...
    PersonName->columns( All => qw(person firstname name) );
    PersonName->has_a( firstname => 'Name' );
    PersonName->has_a( lastname => 'Name' );
    
  7. or download this
    #!/usr/bin/perl
    #
    ...
    while ( my $Name = $names->next() ) {
        print $Name->lastname()->name() . ', ' . $Name->firstname()->name(
    +) . "\n";
    }