DBD::Sponge(3pm)

DBD::Sponge3pm

Create a dbi statement handle from perl data

Usage

  my $sponge = DBI->connect("dbi:Sponge:","","",{ RaiseError => 1 });
  my $sth = $sponge->prepare($statement, {
          rows => $data,
          NAME => $names,
          %attr
      }
  );

Overview

DBD::Sponge is useful for making a Perl data structure accessible through a standard DBI statement handle. This may be useful to DBD module authors who need to transform data in this way.

Methods

connect()

  my $sponge = DBI->connect("dbi:Sponge:","","",{ RaiseError => 1 });

Here's a sample syntax for creating a database handle for the Sponge driver. No username and password are needed.

prepare()

  my $sth = $sponge->prepare($statement, {
          rows => $data,
          NAME => $names,
          %attr
      }
  );
•

The $statement here is an arbitrary statement or name you want to provide as identity of your data. If you're using DBI::Profile it will appear in the profile data.

Generally it's expected that you are preparing a statement handle as if a "select" statement happened.

•

$data is a reference to the data you are providing, given as an array of arrays.

•

$names is a reference an array of column names for the $data you are providing. The number and order should match the number and ordering of the $data columns.

•

%attr is a hash of other standard DBI attributes that you might pass to a prepare statement.

Currently only NAME, TYPE, and PRECISION are supported. TYPE defaults to SQL_VARCHAR. PRECISION will be lazily computed if not supplied.

Releases

12 releases since Debian 3.1 (Sarge); the text changed 11 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 6.0
  5. 7
  6. 8
  7. 9
  8. 10
  9. 11
  10. 12
  11. 13
  12. Arch

Bugs

Using this module to prepare INSERT-like statements is not currently documented.

From perl-dbi 1.656-2 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.