root/trunk/t/lib/partitioned/Recipe.pm @ 58

Revision 58, 0.6 kB (checked in by sky, 4 years ago)

r61@crucially-3 (orig r988): btrott | 2005-09-23 12:53:40 -0700
Test scripts now create and teardown test databases, using DBD::SQLite

  • Property svn:keywords set to Id Revision
Line 
1# $Id$
2
3package Recipe;
4use strict;
5use base qw( Data::ObjectDriver::BaseObject );
6
7use Data::ObjectDriver::Driver::DBI;
8
9__PACKAGE__->install_properties({
10    columns => [ 'id', 'cluster_id', 'title' ],
11    datasource => 'recipes',
12    primary_key => 'id',
13    driver => Data::ObjectDriver::Driver::DBI->new(
14        dsn      => 'dbi:SQLite:dbname=global.db',
15        username => 'btrott',
16    ),
17});
18
19sub insert {
20    my $obj = shift;
21    ## Choose a cluster for this recipe. This isn't a very solid way of
22    ## doing this, but it works for testing.
23    $obj->cluster_id(int(rand 2) + 1);
24    $obj->SUPER::insert(@_);
25}
26
271;
Note: See TracBrowser for help on using the browser.