DBIx-Class-ResultSet-RecursiveUpdate

 view release on metacpan or  search on metacpan

t_dbic/lib/DBICTest.pm  view on Meta::CPAN

312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
sub deploy_schema {
    my $self = shift;
    my $schema = shift;
    my $args = shift || {};
 
    if ($ENV{"DBICTEST_SQLT_DEPLOY"}) {
        $schema->deploy($args);
    } else {
        my $filename = Path::Class::File->new(__FILE__)->dir
          ->file('sqlite.sql')->stringify;
        my $sql = do { local (@ARGV, $/) = $filename ; <> };
        for my $chunk ( split (/;\s*\n+/, $sql) ) {
          if ( $chunk =~ / ^ (?! --\s* ) \S /xm ) {  # there is some real sql in the chunk - a non-space at the start of the string which is not a comment
            $schema->storage->dbh_do(sub { $_[1]->do($chunk) }) or print "Error on SQL: $chunk\n";
          }
        }
    }
    return;
}
 
=head2 populate_schema



( run in 1.262 second using v1.01-cache-2.11-cpan-49f99fa48dc )