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

Request #1920 setFrom is slow
Submitted: 2004-07-20 09:24 UTC
From: contact at mann dot fr Assigned:
Status: Duplicate Package: DB_DataObject
PHP Version: Irrelevant OS: Linux (Debian i586)
Roadmaps: (Not assigned)    
Subscription  


 [2004-07-20 09:24 UTC] contact at mann dot fr
Description: ------------ Date slow the performance of the class in a significant manner. The require_once call is already in a conditional statement of the class.

Comments

 [2004-07-20 09:30 UTC] alan_k
not sure how include is going to speed things up? - the file is required, dataobjects will bork later if Date is not available.
 [2004-07-20 10:23 UTC] contact at mann dot fr
If Date is always needed, it should be in a require_once at the top of the file. Line 2993 DB_DataObject Version ??? Voici le code case ($cols[$col] & DB_DATAOBJECT_DATE): if (is_numeric($value)) { $this->$col = date('Y-m-d',$value); return true; } // try date!!!! include_once 'Date.php'; $x = new Date($value); $this->$col = $x->format("%Y-%m-%d"); return true;
 [2004-07-20 10:29 UTC] alan_k
Date is required if you run setFrom() & a few others, but not all the time (eg. select etc.). When it is used, it is required - hence the require_once. include_once only differs from require_once, by not exiting when the file is not found.. - which is the desired behaviour.
 [2004-07-20 14:54 UTC] contact at mann dot fr
Perhaps a note to the on-line php documentation. Date not being abailable, it is logical to exit. Of course. I had the feeling that include_once differed from require_once because when I profiled, I noticed that the performance was significantly different using one or the other calls. OK TO CLOSE BUG
 [2004-07-21 01:38 UTC] alan_k
dupe of #1127