MySQL-Util

 view release on metacpan or  search on metacpan

t/20-util.t  view on Meta::CPAN

#!perl

use Modern::Perl;
use String::Util ':all';
use Data::Dumper;
use Test::More;
use feature 'state';
use File::Which;
use MySQL::Util;

use lib '.', './t';
require 'testlib.pl';

use vars qw($Util);

########################

if ( !which('mysql') ) {
	plan skip_all => 'mysql not found';
}
elsif ( !check_connection() ) {
	plan skip_all => 'unable to connect to mysql';
}
else {
	drop_db();
	load_db();
	constructor();
	verify_auto_commit();
	clone_dbh();
	get_tables();
	use_db_and_get_dbname();
	get_depth();
	table_exists();
	has_ak();
	has_fks();
	get_indexes();
	get_ak_constraint();
	get_fk_constraints();
	create_data();
	drop_fks_and_apply_ddl();
	get_ak_indexes();
	get_ak_names();
	get_fk_indexes();
	get_max_depth();
	get_other_constraints();
	get_other_indexes();
	get_pk_index();
	is_column_nullable();
	drop_db();
	done_testing();
}


##################################

sub check_connection {

	my $mysql_cmd = get_mysql_cmdline();
	$mysql_cmd .= " -e 'show databases'";
	$mysql_cmd .= " 1>/dev/null 2>/dev/null";

	eval { system($mysql_cmd); };
	if ( $@ or $? ) {



( run in 0.649 second using v1.01-cache-2.11-cpan-39bf76dae61 )