Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #8373 ALTER TABLE bug when adding more than 1 column
Submitted: 2006-08-07 13:11 UTC
From: kaiser at unisolution dot de Assigned: lsmith
Status: Closed Package: MDB2_Driver_mssql (version 1.1.0)
PHP Version: 4.3.8 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-08-07 13:11 UTC] kaiser at unisolution dot de (Josh)
Description: ------------ There is a bug in the alterTable function. It works fine when adding only one column, but doesn´t work for more than 1 column. Problem is that it produces a sql statement like this: ALTER TABLE abc ADD column1 integer, ADD column2 integer but that doesn´t work in MS SQL, it should be: ALTER TABLE abc ADD column1 integer, column2 integer I fixed this bug by modifing the alterTable function in /Driver/Manager/mssql.php I replaced (starting from line 227) foreach ($changes['add'] as $field_name => $field) { if ($query) { $query.= ', '; } $query.= 'ADD '.$db->getDeclaration($field['type'], $field_name, $field); } by foreach ($changes['add'] as $field_name => $field) { if ($query) { $query.= ', '; } else { $query.= 'ADD '; } $query.= $db->getDeclaration($field['type'], $field_name, $field); } and now it seems to work correctly ...

Comments

 [2006-08-10 09:53 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.