Edit report at https://bugs.php.net/bug.php?id=60064&edit=1

 ID:                 60064
 Updated by:         fel...@php.net
 Reported by:        android at mikedev dot com
 Summary:            constants SQLSRV_NULLABLE_YES, SQLSRV_NULLABLE_NO
                     are reversed!
-Status:             Open
+Status:             Assigned
 Type:               Bug
 Package:            sqlsrv
 Operating System:   Windows 2003/2008
 PHP Version:        5.3.8
-Assigned To:        
+Assigned To:        jguerin
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2011-10-14 15:40:44] android at mikedev dot com

Description:
------------
---
>From manual page: 
>http://www.php.net/function.sqlsrv-field-metadata#refsect1-function.sqlsrv-field-metadata-returnvalues
---

constants SQLSRV_NULLABLE_YES, SQLSRV_NULLABLE_NO are actually reversed!

in my database, I set a field that is 'NOT NULL',
sqlsrv_field_metadata() reports it is SQLSRV_NULLABLE_YES and vice versa for 
the SQLSRV_NULLABLE_NO.

Test script:
---------------
// open database and make connection, etc.
// select * from mytable
// etc.


foreach( sqlsrv_field_metadata($stmt) as $fieldMetadata ) {
  print($fieldMetadata['Name'] . " is ");
  if ( $fieldMetadata['Nullable'] === SQLSRV_NULLABLE_YES )
    print("NULLABLE_YES\n");
  else if ( $fieldMetadata['Nullable'] === SQLSRV_NULLABLE_NO )
    print("NULLABLE_NO\n");
  else
    print("NULLABLE_UNKNOWN\n");
}


Expected result:
----------------
field1 is NULLABLE_YES
field2 is NULLABLE_NO
field3 is NULLABLE_NO


Actual result:
--------------
field1 is NULLABLE_NO
field2 is NULLABLE_YES
field3 is NULLABLE_YES



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60064&edit=1

Reply via email to