Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DBD::mysql::st execute failed: Got a packet bigger than 'max_allowed_packet' bytes
- $data = "whatever data needs inserting";
- my $ins_sth=$dbh->prepare("insert into table_name (datacol) values(?)");
- my $upd_sth=$dbh->prepare("update table_name set datacol=datacol||? where id=?");
- my $max_size = 900_000; # Really max_packet_size - 200bytes
- my $pos = 0;
- $ins_sth->execute(substr($data,$pos,$max_size));
- my $id = $dbh->{'mysql_insertid'};
- $pos += $max_size;
- while ( $pos < length($data) ) {
- $upd_sth->execute(substr($data,$pos,$max_size));
- $pos+=$max_size;
- }
Add Comment
Please, Sign In to add comment