Exemple #1
0
 public function GetPKs()
 {
     $obj = $this->object;
     $pk = array();
     $tb = $obj->GetTableName();
     $sql = "";
     $sql = "SHOW   KEYS\n";
     $sql .= "  FROM {$tb}\n";
     $sql .= " WHERE Key_Name = 'PRIMARY'";
     $sql = trim($sql);
     $pks = Database::ExecuteQuery($sql);
     $c = count($pks);
     for ($i = 0; $i < $c; $i++) {
         $pk[$i] = $pks[$i]["Column_name"];
     }
     if ($pks == "" || $pks == null) {
         throw new Exception("Ocorreu um erro ao tentar buscar PKs da tabela", 404);
     }
     return $pk;
 }
Exemple #2
0
 public function ExecuteDelete($obj)
 {
     try {
         $MontaDelete = new MontaDelete($obj);
         $sql = $MontaDelete->GetSQL();
         Database::ExecuteUpdate($sql);
     } catch (Exception $e) {
         $this->ShowException($e);
     }
 }