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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!