Ticket #3458 (new defect)

Opened 4 years ago

Last modified 3 years ago

mySQL NULL not read

Reported by: anonymous Owned by:
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

Changed 4 years ago by Chris Graham <chris@…>

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

Changed 4 years ago by Chris Graham <chris@…>

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).

Changed 4 years ago by weyrick

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

can you attach a quick script illustrating the problem? thanks

Changed 4 years ago 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'

?>

Changed 3 years ago by weyrick

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

Changed 3 years ago by weyrick

  • owner weyrick deleted
  • status changed from assigned to new
Note: See TracTickets for help on using tickets.