public function ExecuteSelectAll($obj) { try { $MontaSelect = new MontaSelect($obj); $sql = $MontaSelect->GetSQL(true); $retorno = Database::ExecuteQuery($sql); $fields = GerenciadorSQL::GetFields($obj, true); $props = GerenciadorSQL::GetProperties($obj); $reflection = new ReflectionClass($obj); return Convert::ToObject($retorno, $fields, $props, $reflection, $obj); } catch (Exception $e) { $this->ShowException($e); } }
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; }