DBIx-Simple-Class

 view release on metacpan or  search on metacpan

examples/dsc_dump_schema.pl  view on Meta::CPAN


=encoding UTF-8

=head1 NAME

dsc_dump_schema.pl - script to dump a schema from a database

=head1 SYNOPSIS

  #dump all tables
  dsc_dump_schema.pl --dsn DBI:mysql:database=mydb;host=127.0.0.1;mysql_enable_utf8=1 \
  -u me -p mypassword --overwrite 1 --lib_root ./lib

  #dump only the "users" table - using short options and choosing a namespace
  dsc_dump_schema.pl -dsn dbi:SQLite:database=etc/ado.sqlite -n Ado::Model -l lib -t users
  
  dsc_dump_schema.pl -? #for more help
  
=head1 DESCRIPTION

This is a helper script to dump L<DBIx::Simple::Class> based classes from

t/01-dbix-simple-class-schema-mysql.t  view on Meta::CPAN

  use lib (Cwd::abs_path(dirname(__FILE__) . '/..') . '/examples/lib');
}
use Data::Dumper;
use DBIx::Simple::Class::Schema;


my $DSCS = 'DBIx::Simple::Class::Schema';
my $dbix;
eval {
  $dbix =
    DBIx::Simple->connect('dbi:mysql:database=test;host=127.0.0.1;mysql_enable_utf8=1',
    '', '');
}
  or plan skip_all => (
  $@ =~ /Can\'t connect to local/
  ? 'Start MySQL on localhost to enable this test.'
  : $@
  );

#=pod

t/02-dbix-simple-class-mysql.t  view on Meta::CPAN



my $DSC = 'DBIx::Simple::Class';

# In memory database! No file permission troubles, no I/O slowness.
# http://use.perl.org/~tomhukins/journal/31457 ++

my $dbix;
eval {
  $dbix =
    DBIx::Simple->connect('dbi:mysql:database=test;host=127.0.0.1;mysql_enable_utf8=1',
    '', '');
}
  or plan skip_all => (
  $@ =~ /Can't connect to local/
  ? 'Start MySQL on localhost to enable this test.'
  : $@
  );

My->dbix($dbix);
isa_ok(ref($DSC->dbix), 'DBIx::Simple');



( run in 0.256 second using v1.01-cache-2.11-cpan-00829025b61 )