NAME

MySQL::Insert - extended inserts for MySQL via DBI

SYNOPSIS

# Insert two rows into sample_table using $dbh database handle

use MySQL::Insert;

$MySQL::Insert::MAX_ROWS_TO_QUERY = 1000;

my $inserter = MySQL::Insert->new( $dbh, 'sample_table', [ field_names ] );

$inserter->insert_row( { fldname => 'fldvalue1' } );
$inserter->insert_row( { fldname => 'fldvalue2' } );

# Insert row into sample_table using $dbh database handle
# If fldvalue3 is passed as scalar ref then it is not quoted
# Used to insert MySQL built-in functions like NOW() and NULL values.

$inserter->insert_row( { fldname => \'NOW()' } );

undef $inserter;

DESCRIPTION

Use multiple-row INSERT syntax that include several VALUES lists. (for example INSERT INTO test VALUES ('1',Some data',2234),('2','Some More Data',23444)). EXTENDED INSERT syntax is more efficient of execution many insert queries. It is not compatible with most RDBMSes.

FUNCTIONS / METHODS

The following methods are available:

new

Create new MySQL::Insert object

insert_row

Schedule row for insertion

AUTHORS

Gleb Tumanov <gleb at reg.ru> (original author) Walery Studennikov <despair at cpan.org> (CPAN distribution)

BUGS

Please report any bugs or feature requests to bug-mysql-insert at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MySQL-Insert. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Copyright 2008 Gleb Tumanov (gleb at reg.ru), all rights reserved.

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