MySQL::Insert - extended inserts for MySQL via DBI


MySQL-Insert documentation  | view source Contained in the MySQL-Insert distribution.

Index


NAME

Top

MySQL::Insert - extended inserts for MySQL via DBI

SYNOPSIS

Top

    # 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

Top

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

Top

The following methods are available:

new

Create new MySQL::Insert object

set_fields

Set fields list (by plain list or list reference)

get_fields

Get fields list (or its quantity in scalar context)

insert_row

Schedule row for insertion

AUTHORS

Top

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

BUGS

Top

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.

LICENSE

Top

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


MySQL-Insert documentation  | view source Contained in the MySQL-Insert distribution.