Michael Shipper > DBIx-BulkLoader-Mysql-1.006 > DBIx::BulkLoader::Mysql

Download:
DBIx-BulkLoader-Mysql-1.006.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.006   Source  

NAME ^

DBIx::BulkLoader::Mysql - Perl extension for mysql bulk loading

SYNOPSIS ^

  use DBIx::BulkLoader::Mysql;

  # non repeating portion of the insert statement
  my $insert='insert into bulk_insert (col_a,col_b,col_c) values ';

  # repeating portion of the insert statement
  my $placeholders='(?,?,?)';

  # how many rows to buffer until insert is called
  my $bulk_insert_count=5;

  # db connection
  my $dbh=DBI->connect(db connection info here);
  my $placeholder_count=3;

  my ($bulk,$error)=DBIx::BulkLoader::Mysql->new(
                dbh=>$dbh
                ,sql_insert=>$insert
                ,placeholders=>$placeholders
   );
   die $error unless $bulk;

   for( 1 .. 50 ) {
     $bulk->insert(qw(a b c));
   }
   # inserted 50 rows at once

   $bulk->insert(qw(l l x));
   # inserted 0 rows

   $bulk->insert(qw(l l x));
   # inserted 0 rows

   $bulk->flush;
   # inserted 2 rows 1 at a time

DESCRIPTION ^

Simple buffering bulk loader interface for mysql.

EXPORT

None.

OO Methods

This section covers the OO methods for this package.

SEE ALSO ^

DBI, DBD::mysql

Source Forge Project ^

If you find this software usefil please donate to the Source Forge Project.

DBIx BulkLoader Mysql

AUTHOR ^

Michael Shipper

COPYRIGHT AND LICENSE ^

Copyright (C) 2010 by Michael Shipper

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: