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 }
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 561234-1.patch | 910 bytes | mooreds |
Comments
Comment #1
mooreds commentedAttaching patch for this issue.
Comment #2
hefox commentedThis looks hard to reproduce/review.
Any further issues? I'm tempted to just commit it.
Comment #3
hefox commentedhttp://drupalcode.org/viewvc/drupal/contributions/modules/dbscripts/dbsc...