The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Test::DB::Sqlite - Temporary Testing Databases for Sqlite

ABSTRACT

Temporary Sqlite Database for Testing

VERSION

0.10

SYNOPSIS

  package main;

  use Test::DB::Sqlite;

  my $tdbo = Test::DB::Sqlite->new;

  # my $dbh = $tdbo->create->dbh;

DESCRIPTION

This package provides methods for generating and destroying Sqlite databases for testing purposes.

ATTRIBUTES

This package has the following attributes:

dbh

  dbh(Object)

This attribute is read-only, accepts (Object) values, and is optional.

dsn

  dsn(Str)

This attribute is read-only, accepts (Str) values, and is optional.

database

  database(Str)

This attribute is read-only, accepts (Str) values, and is optional.

file

  file(Str)

This attribute is read-only, accepts (Str) values, and is optional.

uri

  uri(Str)

This attribute is read-only, accepts (Str) values, and is optional.

METHODS

This package provides the following methods:

clone

clone(Str $source) : Object

The clone method creates a temporary database from a database template.

clone example 1
  # given: synopsis

  $tdbo->clone('source.db');

  # <Test::DB::Sqlite>

create

create() : Object

The create method creates a temporary database and returns the invocant.

create example 1
  # given: synopsis

  $tdbo->create;

  # <Test::DB::Sqlite>

destroy

destroy() : Object

The destroy method destroys (drops) the database and returns the invocant.

destroy example 1
  # given: synopsis

  $tdbo->create;
  $tdbo->destroy;

  # <Test::DB::Sqlite>