sub ugly_formatting {
my %conn_data = @_;
my $dbh = DBI->connect( $conn_data{ data_source }, $conn_data{ user }, $conn_data{ pass },
{ RaiseError => 1,
AutoCommit => 0,
LongReadLen => 65_634 } ) or die DBI->errstr;
$dbh;
}
####
sub _connect
{
my %conn_data = @_;
my $dbh = DBI->connect(
$conn_data{ data_source },
$conn_data{ user },
$conn_data{ pass },
{
RaiseError => 1,
AutoCommit => 0,
LongReadLen => 65_634
}
) or die DBI->errstr;
$dbh;
}
##
##
if ( exists $database->{ $table }{ _unique } ) {
my @unique_fields = @{ $database->{ $table }{ _unique } };
foreach my $field ( @unique_fields ) {
my %field_count;
my $sql = "SELECT $field FROM $table";
my $fields = $dbh->selectall_arrayref( $sql );
foreach ( @$fields )
$field_count{ $_->[0] }++;
}
foreach ( keys %field_count ) {
if ( $field_count{$_} > 1 ) {
print $err "Table: '$table' Unique field: '$_' was found $field_count{$_} times\n";
$error_count++;
}
}
} # next $field
}
##
##
if ( exists $database->{ $table }{ _unique } )
{
my @unique_fields = @{ $database->{ $table }{ _unique } };
foreach my $field ( @unique_fields )
{
my %field_count;
my $sql = "SELECT $field FROM $table";
my $fields = $dbh->selectall_arrayref( $sql );
foreach ( @$fields )
$field_count{ $_->[0] }++;
}
foreach ( keys %field_count )
{
if ( $field_count{$_} > 1 )
{
print $err "Table: '$table' Unique field: '$_' was found $field_count{$_} times\n";
$error_count++;
}
}
} # next $field
}
##
##
my %page_control = ( Add => { EmploymentListing => { page => 'em-main-add-employment.tmpl',
function => \&add_employment }
},
Edit => { EmploymentListing => { page => 'em-main-update-del-employment.tmpl',
function => \&update_delete_employment }
},
Delete => { EmploymentListing => { page => 'em-main-update-del-employment.tmpl',
function => \&update_delete_employment }
##
##
my %page_control = ( Add => { EmploymentListing => { page => 'em-main-add-employment.tmpl',
function => \&add_employment }
},
Edit => { EmploymentListing => { page => 'em-main-update-del-employment.tmpl',
function => \&update_delete_employment }
},
Delete => { EmploymentListing => { page => 'em-main-update-del-employment.tmpl',
##
##
my %page_control = (
Add =>
{
EmploymentListing =>
{
page => 'em-main-add-employment.tmpl',
function => \&add_employment
}
},
Edit =>
{
EmploymentListing =>
{
page => 'em-main-update-del-employment.tmpl',
function => \&update_delete_employment
}
},
Delete =>
{
EmploymentListing =>
{
page => 'em-main-update-del-employment.tmpl',
function => \&update_delete_employment
}
}
};