NOTNULL DATETIME column created without default value is incorrectly mapped to 1970-01-01

Bug #288717 reported by Stephane Mikaty (eCircle AG)
2
Affects Status Importance Assigned to Milestone
Persephone
Fix Committed
Undecided
Unassigned

Bug Description

Having created a table with a DATETIME column.

CREATE TABLE IF NOT EXISTS `props` (
  ...
  `DATETIME_VALUE` datetime NOT NULL,
  ...
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

SELECT DATETIME_VALUE FROM `props` LIMIT 0 , 30
returns: 0000-00-00 00:00:00

Now, having declared the following in my schema file:

provider db_xyz {
 var db_xyz;
 type DBSource;

 table props {
                ...
  DATETIME_VALUE<DateTime>;
 }
}

entity SomeEntity {
 fields {
               ...
  Value<DateTime>;
 }
}

mapper SomeEntity {
 provider db_xyz;
 fields {
  using props {
   @DATETIME_VALUE = Value;
  }
 }
}

$lastrun = strftime( "%Y-%m-%d %H:%M:%S", SomeEntity::findWithXYZ( ... )->value);

$lastrun is 1970-01-01 01:00:00, not 0000-00-00 00:00:00

Revision history for this message
e.mortoray (e-mortoray) wrote :
Changed in persephone:
status: New → Confirmed
Revision history for this message
e.mortoray (e-mortoray) wrote :

Rev113
using the Pear Date class for Date and DateTime
http://persephone.brainbrain.net/Entry:50/Date_and_DateTime_field_types

Changed in persephone:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.