#!/usr/bin/env perl use strict; require DBD::mysql; my ($dbh, $sth, $num, %d); $num = 1045; $dbh = DBI->connect("DBI:mysql:blog:localhost", "user", "pass"); $sth = $dbh->prepare("SELECT entry_id, entry_created_on FROM `mt_entry` ORDER BY `entry_id` ASC "); $sth->execute; for (my $i = 1; $i <= $num; $i++) { my @d = $sth->fetchrow_array; if ($d[0] != $i) { $d{$i} = $d[1]; $i++; } } $sth->finish; foreach my $id (keys %d) { $sth = $dbh->prepare("INSERT INTO `mt_entry` ( `entry_id` , `entry_blog_id` , `entry_status` , `entry_author_id` , `entry_allow_comments` , `entry_allow_pings` , `entry_convert_breaks` , `entry_category_id` , `entry_title` , `entry_excerpt` , `entry_text` , `entry_text_more` , `entry_to_ping_urls` , `entry_pinged_urls` , `entry_keywords` , `entry_tangent_cache` , `entry_created_on` , `entry_modified_on` , `entry_created_by` , `entry_modified_by` , `entry_basename` ) VALUES ('$id', '1', '1', '1', '1', '1', '__default__', NULL , 'ダミー', NULL , 'ダミー', NULL , NULL , NULL , NULL , NULL , '$d{$id}', NOW( ) , NULL , NULL , '')"); $sth->execute; $sth->finish; } $dbh->disconnect; exit;