DBIx::Roles::Buffered - buffer write-only queries.


DBIx-Roles documentation  | view source Contained in the DBIx-Roles distribution.

Index


NAME

Top

DBIx::Roles::Buffered - buffer write-only queries.

DESCRIPTION

Top

Saves do() and selectrow_array() in a buffer, calls these as a single query later. Useful with lots of UPDATES and INSERTS over connections with high latency.

SYNOPSIS

Top

     use DBIx::Roles qw(Buffered);

     my $dbh = DBI-> connect(
           "dbi:Pg:dbname=template1",
	   "postgres",
	   "password",
	   { Buffered => 1, BufferSize => 2048 },
     );

     $dbh-> do('INSERT INTO moo VALUES(?)', {}, 1);
     $dbh-> do('INSERT INTO moo VALUES(?)', {}, 1);
     $dbh-> do('INSERT INTO moo VALUES(?)', {}, 1);
     $dbh-> flush;




Attributes

Top

Buffered $IS_BUFFERED

Boolean flag, does buffering only if 1 ; is 1 by default. When set to 0, flushes the buffer.

BufferLimit $BYTES

Tries to preserve buffer so that maximal query ( the SQL query, after the expansion ) is no longer than $BYTES.

Methods

Top

flush [ $DISCARD = 0 ]

Flushes the buffer; discards the buffer content if $DISCARD is 1.

SEE ALSO

Top

DBI, DBIx::Roles.

COPYRIGHT

Top

AUTHOR

Top

Dmitry Karasik <dk@catpipe.net>


DBIx-Roles documentation  | view source Contained in the DBIx-Roles distribution.