Ticket #3458 (new defect)

Opened 2 years ago

Last modified 1 year ago

mySQL NULL not read

Reported by: anonymous Assigned to:
Priority: urgent Milestone: 3.0.0 release
Component: MySQL Version: trunk
Severity: block Keywords:
Cc:

Description

Null field values are returned as 0 for integers. I'm using using mySQL 5.0.

Change History

02/04/07 12:16:49 changed by Chris Graham <chris@ocportal.com>

Correction, they come out as empty strings. That means it's not so critical for me as I can differentiate based on that.

02/04/07 13:50:13 changed by Chris Graham <chris@ocportal.com>

NULL string fields are also returned as empty strings. Fortunately I can cope with this as I have avoided NULL strings in my database as Oracle can't do them -- I just need to clean up a few instances (non-matched JOINS).

02/20/07 13:48:08 changed by weyrick

  • owner changed from anonymous to weyrick.
  • status changed from new to assigned.

can you attach a quick script illustrating the problem? thanks

03/03/07 18:47:46 changed by anonymous

<?php

/* DB...

CREATE TABLE table (

field int(11) NOT NULL, field2 int(11) default NULL, PRIMARY KEY (field)

) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO table VALUES (1, NULL);

DB version is MySQL 5.0.27-community-nt */

$conn=mysql_connect('localhost','root',); mysql_select_db('test',$conn); $r=mysql_query('SELECT field2 FROM table'); $row=mysql_fetch_assoc($r); echo gettype($rowfield2?); // Outputs 'string'

?>

04/15/07 08:57:12 changed by weyrick

  • version changed from 2.1.0 beta to 2.9.0 beta.
  • milestone set to 2.9.x beta.

08/13/07 10:12:13 changed by weyrick

  • owner deleted.
  • status changed from assigned to new.