Ejemplo n.º 1
0
 /**
  * Gets constraint rules for a foreign key constraint
  * @param string $constraintName The constraint name as input parameter
  * @param ConstraintRule $onUpdate The update rule as output parameter
  * @param ConstraintRule $onDelete The delete rule as output parameter
  */
 private function GetConstraintRules($constraintName, ConstraintRule &$onUpdate = null, ConstraintRule &$onDelete = null)
 {
     $sql = new Sql\Builder($this);
     $tbl = $sql->Table('information_schema.REFERENTIAL_CONSTRAINTS', array('CONSTRAINT_NAME', 'UPDATE_RULE', 'DELETE_RULE'));
     $where = $sql->Equals($tbl->Field('CONSTRAINT_NAME'), $sql->Value($constraintName));
     $selectList = $sql->SelectList($tbl->Field('UPDATE_RULE'));
     $selectList->Add($tbl->Field('DELETE_RULE'));
     $select = $sql->Select(false, $selectList, $tbl, $where);
     $reader = $this->ExecuteQuery((string) $select);
     if ($reader->Read()) {
         $onUpdate = ConstraintRule::ByValue($reader->ByName('UPDATE_RULE'));
         $onDelete = ConstraintRule::ByValue($reader->ByName('DELETE_RULE'));
     }
 }
Ejemplo n.º 2
0
 private function FetchInstalledBundles()
 {
     try {
         $sql = new Sql\Builder($this->connection);
         $tbl = $sql->Table('pc_core_installed_bundle', array('Bundle', 'Version'));
         $fields = $sql->SelectList($tbl->Field('Bundle'));
         $fields->Add($tbl->Field('Version'));
         $select = $sql->Select(false, $fields, $tbl);
         $reader = $this->connection->ExecuteQuery((string) $select);
         while ($reader->Read()) {
             $this->installedBundles[$reader->ByName('Bundle')] = $reader->ByName('Version');
         }
     } catch (\Exception $e) {
         //Table just not there...
         return;
     }
 }