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

Bug #8359 Problem with NOT NULL / NULL when creating Table
Submitted: 2006-08-04 11:26 UTC
From: kaiser at unisolution dot de Assigned: lsmith
Status: Closed Package: MDB2 (version 1.1.0)
PHP Version: 4.3.8 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 25 - 7 = ?

 
 [2006-08-04 11:26 UTC] kaiser at unisolution dot de (Josh)
Description: ------------ I am working with MS SQL Server right now, and there seems to be a Problem with NULL / NOT NULL when creating a Table. in MS SQL you need to specify for each column that if NULL is allowed: NOT NULL -> null values not allowed NULL -> null values allowed [nothing] -> null values NOT allowed, i don't know if it's like this with every version of SQL Server, but the version of SQL Server 2000 i work with right now marks a column a NOT NULL if its not specified. The Problem now is, that MDB2 only adds a NOT NULL to the query is NULL is not allowed, but doesn't add anything if NULL should be allowed. Because of the SQL Server behaviour i described above, all columns are then specified as NOT NULL. a quick fix i tried today was to overwrite the functions _getDeclaration, _getCLOBDeclaration of MDB2/Driver/Datatype/Common.php in MDB2/Driver/Datatype/MSSQL.php and replace $notnull = (!empty($field['notnull'])) ? ' NOT NULL' : ''; by $notnull = (!empty($field['notnull'])) ? ' NOT NULL' : ' NULL '; in each of these functions. This fix worked for me, but maybe there is a better solution...

Comments

 [2006-08-04 12:25 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!
 [2006-08-05 17:23 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!