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 GetSQL() { try { $obj = $this->object; $fields = GerenciadorSQL::GetFields($obj, true); $values = GerenciadorSQL::GetValues($obj, $fields, true); $numf = count($values); $sql = null; $sql .= "UPDATE " . $obj->GetTableName(); $sql .= " SET " . $this->MontaUpdate($numf, $fields, $values); $sql .= $this->MontaWherePK($numf, $fields, $values); $sql = trim($sql); return $sql; } catch (Exception $e) { $this->ShowException($e); } }
public function GetSQL() { try { $obj = $this->object; $fields = GerenciadorSQL::GetFields($obj, true); $values = GerenciadorSQL::GetValues($obj, $fields, true); $numf = count($values); $sql = null; $sql .= "INSERT INTO " . $obj->GetTableName(); $sql .= "(" . $this->MontaFieldsInsert($numf, $fields) . ")"; $sql .= " VALUES "; $sql .= "(" . $this->MontaValuesInsert($numf, $values) . ")"; $sql = trim($sql); return $sql; } catch (Exception $e) { $this->ShowException($e); } }
public function GetSQL($isList = false) { try { $obj = $this->object; $fields = GerenciadorSQL::GetFields($obj, false); $values = GerenciadorSQL::GetValues($obj, $fields, false); $numf = count($values); $sql = null; $sql .= "SELECT *\n"; $sql .= " FROM " . $obj->GetTableName() . "\n"; if (!$isList) { $sql .= $this->MontaWhere($numf, $fields, $values); } $sql = trim($sql); return $sql; } catch (Exception $e) { $this->ShowException($e); } }