Esempio n. 1
0
 /**
  * CAO::__construct()
  *
  * @return
  */
 function __construct()
 {
     if (!is_resource(CAO::$p_connection)) {
         CAO::$mdrAllocations = 0;
     }
     if (!CAO::$mdrAllocations++) {
         try {
             //master and slave CANNOT be the same dsn|username|password combo as
             //the second call tries to re-use it and it doesn't do so gracefully.
             CAO::$p_connection = mysql_connect(DSN, USERNAME, PASSWORD, true) or sqlerrorhandler("(" . mysql_errno() . ") " . mysql_error(), $query, $_SERVER['PHP_SELF'], __LINE__);
             mysql_select_db(DATABASE, CAO::$p_connection) or sqlerrorhandler("(" . mysql_errno() . ") " . mysql_error(), $query, $_SERVER['PHP_SELF'], __LINE__);
             CAO::$p_master_connection = mysql_connect(DSN_M, USERNAME_M, PASSWORD_M, true) or sqlerrorhandler("(" . mysql_errno() . ") " . mysql_error(), $query, $_SERVER['PHP_SELF'], __LINE__);
             mysql_select_db(DATABASE_M, CAO::$p_master_connection) or sqlerrorhandler("(" . mysql_errno() . ") " . mysql_error(), $query, $_SERVER['PHP_SELF'], __LINE__);
             //                CAO::$p_master_connection = mysql_connect('10.168.18.118', 'root', 'fc3582');
             //                mysql_select_db('mdr', CAO::$p_master_connection);
             // MCB | KLK : second connection using same credentials and dsn info steps on previous.
             // the following can be used only if the dsn info is different that the other connection.
             /*
             CAO::$p_master_connection = mysql_connect(Connection::$master_dsn, Connection::$master_username, Connection::$master_password);
             */
             //              //  mysql_select_db(Connection::$master_database, CAO::$p_master_connection);
         } catch (Exception $e) {
             //echo 'e$:'. $e;
         }
         $this->InitQueries();
     }
     $this->p_saveOnDestroy = false;
     $this->p_isPersistent = false;
     $this->p_isProcessed = false;
 }