Exemple #1
0
 /**
  * Overloaded constructor, allows us to set up error codes and connect to
  * the database.
  *
  * @param   string  $dbkey        @see {ADatabaseRestore}
  * @param   array   $dbiniValues  @see {ADatabaseRestore}
  */
 public function __construct($dbkey, $dbiniValues)
 {
     parent::__construct($dbkey, $dbiniValues);
     // Set up allowed error codes
     $this->allowedErrorCodes = array(1262, 1263, 1264, 1265, 1266, 1287, 1299);
     // Set up allowed comment delimiters
     $this->comment = array('#', '\'-- ', '---', '/*!');
     // Connect to the database
     $this->getDatabase();
     // Suppress foreign key checks
     if ($this->dbiniValues['foreignkey']) {
         $this->db->setQuery('SET FOREIGN_KEY_CHECKS = 0');
         try {
             $this->db->execute();
         } catch (Exception $exc) {
             // Do nothing if that fails. Maybe we can continue with the restoration.
         }
     }
     // Suppress auto value on zero
     if ($this->dbiniValues['noautovalue']) {
         $this->db->setQuery('SET NO_AUTO_VALUE_ON_ZERO = 1');
         try {
             $this->db->execute();
         } catch (Exception $exc) {
             // Do nothing if that fails. Maybe we can continue with the restoration.
         }
     }
 }
Exemple #2
0
 /**
  * Overloaded constructor, allows us to set up error codes and connect to
  * the database.
  *
  * @param   string  $dbkey        @see {ADatabaseRestore}
  * @param   array   $dbiniValues  @see {ADatabaseRestore}
  */
 public function __construct($dbkey, $dbiniValues)
 {
     parent::__construct($dbkey, $dbiniValues);
     // Set up allowed error codes
     $this->allowedErrorCodes = array();
     // Set up allowed comment delimiters
     $this->comment = array('#', '\'-- ', '---', '/*!');
     // Connect to the database
     $this->getDatabase();
     // Suppress foreign key checks
     if ($this->dbiniValues['foreignkey']) {
         // @TODO PostgreSQL does not support that. You can do
         // ALTER TABLE tablename DISABLE TRIGGER ALL
         // but does it really make any sense?
     }
     // Suppress auto value on zero
     if ($this->dbiniValues['noautovalue']) {
         // @TODO PostgreSQL does not support that.
     }
 }
Exemple #3
0
 /**
  * Overloaded constructor, allows us to set up error codes and connect to
  * the database.
  *
  * @param   string  $dbkey        @see {ADatabaseRestore}
  * @param   array   $dbiniValues  @see {ADatabaseRestore}
  */
 public function __construct($dbkey, $dbiniValues)
 {
     parent::__construct($dbkey, $dbiniValues);
     // Set up allowed error codes
     $this->allowedErrorCodes = array();
     // Set up allowed comment delimiters
     $this->comment = array('#', '\'-- ', '---', '/*!');
     // Connect to the database
     $this->getDatabase();
     // Suppress foreign key checks
     if ($this->dbiniValues['foreignkey']) {
         $this->db->setQuery('EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"');
         try {
             $this->db->execute();
         } catch (Exception $exc) {
             // Do nothing if that fails. Maybe we can continue with the restoration.
         }
     }
     // Suppress auto value on zero
     if ($this->dbiniValues['noautovalue']) {
         // @TODO PostgreSQL does not support that.
     }
 }