I was using dbscripts on a unix box against mysql (5.1.31-1ubuntu2) and simply doing a dbscripts/dump.php (no other options) against a database that had been used for a while.

I was seeing create statements like this:

DROP TABLE IF EXISTS `watchdog`;
CREATE TABLE `watchdog` (
`wid` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0',
`type` varchar(16) NOT NULL DEFAULT '',
`message` longtext NOT NULL,
...
`hostname` varchar(128) NOT NULL DEFAULT '',
`timestamp` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`wid`),
KEY `type` (`type`)
) ENGINE=MyISAM155 DEFAULT CHARSET=utf8;

Note the MyISAM155

It happens that 155 is the auto_increment number, found using 'show create watchdog'.

I think the issue is around line 1466 of the dbscripts.module file. The 'grep' there should be a 'grep -i', otherwise this branch is never executed. Probably the same thing should be done on line 1479.

1464 $increment = FALSE;
1465 if(file_exists("$branch_location/tables/$table.sql")) {
1466 if (exec("grep 'auto_increment' $branch_location/tables/$table.sql")) {
1467 $inc_string = exec("grep 'AUTO_INCREMENT=' $branch_location/tables/$t able.sql");
1468
1469 $increment['num'] = '0';
1470 if ($inc_string) {
1471 $inc_string_parts = explode(' ', $inc_string);
1472 foreach ($inc_string_parts as $part) {
1473 if (strpos($part, 'AUTO_INCREMENT=') !== FALSE) {
1474 $increment['num'] = str_replace('AUTO_INCREMENT=', '', $part);
1475 }
1476 }
1477 }

CommentFileSizeAuthor
#1 561234-1.patch910 bytesmooreds

Comments

mooreds’s picture

Status: Active » Needs review
StatusFileSize
new910 bytes

Attaching patch for this issue.

hefox’s picture

Assigned: Unassigned » hefox

This looks hard to reproduce/review.

Any further issues? I'm tempted to just commit it.

hefox’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.