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



NAME

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


DESCRIPTION

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

     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

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

flush [ $DISCARD = 0 ]

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


SEE ALSO

the DBI manpage, the DBIx::Roles manpage.


COPYRIGHT

Copyright (c) 2005 catpipe Systems ApS. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


AUTHOR

Dmitry Karasik <dk@catpipe.net>