File: Plain.pm

package info (click to toggle)
libdbix-class-resultset-recursiveupdate-perl 0.45-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,060 kB
  • sloc: perl: 5,130; sql: 640; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 704 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package # hide from PAUSE 
    DBICTest::Plain;

use strict;
use warnings;
use base qw/DBIx::Class::Schema/;
use DBI;

my $db_file = "t/var/Plain.db";

unlink($db_file) if -e $db_file;
unlink($db_file . "-journal") if -e $db_file . "-journal";
mkdir("t/var") unless -d "t/var";

my $dsn = "dbi:SQLite:${db_file}";

__PACKAGE__->load_classes("Test");
my $schema = __PACKAGE__->compose_connection(
  __PACKAGE__,
  $dsn,
  undef,
  undef,
  { AutoCommit => 1 }
);

my $dbh = DBI->connect($dsn);

my $sql = <<EOSQL;
CREATE TABLE test (
  id INTEGER NOT NULL,
  name VARCHAR(32) NOT NULL
);

INSERT INTO test (id, name) VALUES (1, 'DBIC::Plain is broken!');

EOSQL

$dbh->do($_) for split(/\n\n/, $sql);

1;