Note that there are some explanatory texts on larger screens.

plurals
  1. POSlow parent::__construct in extended mysqli class
    primarykey
    data
    text
    <p>I'm extending mysqli in a database class. I've noticed that calling the parent constructor takes nearly 2 seconds. It is possible, I suppose, that it is my environment since I am developing on my desktop prior to deployment. But that does not seem very likely to me.</p> <p>Environment: </p> <ul> <li>OS - Windows 7 Pro</li> <li>WAMP server</li> <li>Apache/2.2.17 (Win32) </li> <li>PHP 5.3.4 </li> <li>MySql ver 5.1.53 </li> <li>NetBeans IDE 6.9.1</li> </ul> <p>The code in question:</p> <pre><code>class DGMysqliLink extends MySQLi { public function __construct($aDSN) { // Construct the DSN $aDSN['dbhost'] = (empty($aDSN['dbhost']))?ini_get("mysqli.default_host"):$aDSN['dbhost']; $aDSN['dbuser'] = (empty($aDSN['dbuser']))?ini_get("mysqli.default_user"):$aDSN['dbuser']; $aDSN['dbpass'] = (empty($aDSN['dbpass']))?ini_get("mysqli.default_pw"):$aDSN['dbpass']; $aDSN['dbname'] = (empty($aDSN['dbname']))?'':$aDSN['dbname']; $aDSN['dbport'] = (empty($aDSN['dbport']))?ini_get("mysqli.default_port"):$aDSN['dbport']; $aDSN['dbsock']= (empty($aDSN['dbsock']))?ini_get("mysqli.default_socket"):$aDSN['dbsock']; // Instantiate the object by invoking the parent's constructor. // This takes nearly 2 seconds parent::__construct($aDSN['dbhost'],$aDSN['dbuser'],$aDSN['dbpass'], $aDSN['dbname'],$aDSN['dbport'],$aDSN['dbsock']); // If there are any errors, deal with them now if($this-&gt;connect_error){/* Do some stuff */} } } </code></pre> <p>Why does calling this constructor take so long and how can I fix it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload