public function select($typeOfReturn = NULL, $id = NULL, $active = NULL, $name = NULL, $url = NULL, $author = NULL, $order_type = DbInterface::ORDER_ASC, $quant_limit = NULL, $quant_started = NULL) { $typeOfReturn = $typeOfReturn === NULL ? NULL : $typeOfReturn; $order_type = parent::verifyOrderType($order_type); //echo "login[".$login."] - password[".$password."]"; $arrayFilter = array(); $query = "SELECT * FROM `image` WHERE 1"; if ($id !== NULL) { $query .= " AND `id` = '" . DataHandler::forceInt($id) . "'"; } if ($active !== NULL) { $query .= " AND `active` = '" . DataHandler::forceInt($active) . "'"; } if ($name !== NULL) { $query .= " AND `name` = '" . DataHandler::forceString($name) . "'"; } if ($url !== NULL) { $query .= " AND `url` = '" . DataHandler::forceString($url) . "'"; } if ($author !== NULL) { $query .= " AND `author` = '" . DataHandler::forceString($author) . "'"; } //limite $query .= parent::limit($quant_limit, $quant_started); $query .= " ORDER BY `order` {$order_type} "; //executa a query $ReturnDataVO = parent::query($query); //verifica se conseguiu ocorreu tudo certo if ($ReturnDataVO->success) { switch ($typeOfReturn) { case DbInterface::RETURN_ARRAY: $ReturnDataVO->fetchAll(ReturnDataVO::TYPE_FETCH_ARRAY); break; case DbInterface::RETURN_VO: $ReturnDataVO->fetchAllVO($this); break; case DbInterface::RETURN_STD_OBJECT: default: //retornar tudo em objeto $ReturnDataVO->fetchAll(ReturnDataVO::TYPE_FETCH_OBJECT); break; } return $ReturnDataVO; } else { return $ReturnDataVO; } }
private function addFilter(&$query, $id, $active, $table, $table_id, $user_id, $title, $description, $date, $symble_date, $order_type) { if ($id > 0) { $query .= " AND id = '" . DataHandler::forceInt($id) . "'"; } if ($active !== NULL) { $query .= " AND `active` = '" . DataHandler::forceInt($active) . "'"; } if ($table !== NULL) { $query .= " AND `table` = '" . DataHandler::forceString($table) . "'"; } if ($table_id > 0) { $query .= " AND `table_id` = '" . DataHandler::forceInt($table_id) . "'"; } if ($user_id > 0) { $query .= " AND `user_id` = '" . DataHandler::forceInt($user_id) . "'"; } if ($title !== NULL) { $query .= " AND `title` = '" . DataHandler::forceString($title) . "'"; } if ($description !== NULL) { $query .= " AND `description` = '" . DataHandler::forceString($description) . "'"; } if ($date !== NULL) { $symble_date = parent::compareSimble($symble_date); $date = parent::dateHandlerScape($date); $query .= " AND `date` {$symble_date} {$date} "; } //adiciona a ordenação na query $orderBy = ""; if ($order_type != NULL) { $order_type = parent::verifyOrderType($order_type); $orderBy .= ", `order` " . $order_type; } if ($orderBy != NULL) { $query .= " ORDER BY " . $orderBy; } $query .= "ORDER BY date DESC"; }
private function addFilter(&$query, $id, $active, $name, $title, $hat, $description, $content, $author, $template_url, $slug, $key_words, $date, $date_symbol, $date_in, $date_in_symbol, $date_out, $date_out_symbol, $order_type) { if ($id !== NULL) { $query .= " AND `content`.id = '" . DataHandler::forceInt($id) . "'"; } if ($active !== NULL) { $query .= " AND `content`.active = '" . DataHandler::forceInt($active) . "'"; } if ($name !== NULL) { $query .= " AND `content`.name = '" . DataHandler::forceString($name) . "'"; } if ($title !== NULL) { $query .= " AND `content`.title = '" . DataHandler::forceString($title) . "'"; } if ($hat !== NULL) { $query .= " AND `content`.hat = '" . DataHandler::forceString($hat) . "'"; } if ($description !== NULL) { $query .= " AND `content`.description = '" . DataHandler::forceString($description) . "'"; } if ($content !== NULL) { $query .= " AND `content`.content = '" . DataHandler::forceString($content) . "'"; } if ($author !== NULL) { $query .= " AND `content`.author = '" . DataHandler::forceString($author) . "'"; } if ($template_url !== NULL) { $query .= " AND `content`.template_url = '" . DataHandler::removeSpecialCharacters($template_url) . "'"; } if ($slug !== NULL) { $query .= " AND `content`.slug = '" . DataHandler::removeSpecialCharacters($slug) . "'"; } if ($key_words !== NULL) { $query .= " AND `content`.key_words = '" . DataHandler::removeSpecialCharacters($key_words) . "'"; } if ($date !== NULL) { $date_symbol = parent::compareSimble($date_symbol); $date = parent::dateHandlerScape($date); $query .= " AND `date` {$date_symbol} {$date} "; } if ($date_in !== NULL) { $date_in_symbol = parent::compareSimble($date_in_symbol); $date_in = parent::dateHandlerScape($date_in); $query .= " AND `date_in` {$date_in_symbol} {$date_in} "; } if ($date_out !== NULL) { $date_out_symbol = parent::compareSimble($date_out_symbol); $date_out = parent::dateHandlerScape($date_out); $query .= " AND `date_out` {$date_out_symbol} {$date_out} "; } //adiciona a ordenação na query $orderBy = ""; if ($order_type != NULL) { $order_type = parent::verifyOrderType($order_type); $orderBy .= ", `order` " . $order_type; } if ($orderBy != NULL) { $query .= " ORDER BY " . $orderBy; } }
private function addFilter(&$query, $id, $active, $category_id, $name, $slug, $order_type) { if ($id !== NULL) { $query .= " AND id = '" . DataHandler::forceInt($id) . "'"; } if ($active !== NULL) { $query .= " AND `active` = '" . DataHandler::forceInt($active) . "'"; } if ($category_id !== NULL) { $query .= " AND `category_id` = '" . DataHandler::forceInt($category_id) . "'"; } if ($name !== NULL) { $query .= " AND `name` = '" . DataHandler::forceString($name) . "'"; } if ($slug !== NULL) { $query .= " AND `slug` = '" . DataHandler::forceString($slug) . "'"; } //adiciona a ordenação na query $orderBy = ""; if ($order_type != NULL) { $order_type = parent::verifyOrderType($order_type); $orderBy .= " `order` " . $order_type; } if ($orderBy != NULL) { $query .= " ORDER BY " . $orderBy; } }
private function addFilter(&$query, $id, $active, $name, $link, $content, $image_url, $date, $date_symbol, $date_in, $date_in_symbol, $date_out, $date_out_symbol, $order_type) { if ($id !== NULL) { $query .= " AND id = '" . DataHandler::forceInt($id) . "'"; } if ($active !== NULL) { $query .= " AND `active` = '" . DataHandler::forceInt($active) . "'"; } if ($name !== NULL) { $query .= " AND `name` = '" . DataHandler::forceString($name) . "'"; } if ($link !== NULL) { $query .= " AND `link` = '" . DataHandler::forceString($link) . "'"; } if ($content !== NULL) { $query .= " AND `content` = '" . DataHandler::forceString($content) . "'"; } if ($image_url !== NULL) { $query .= " AND `image_url` = '" . DataHandler::removeSpecialCharacters($image_url) . "'"; } if ($date !== NULL) { $date_symbol = parent::compareSimble($date_symbol); $date = parent::dateHandlerScape($date); $query .= " AND `date` {$date_symbol} {$date} "; } if ($date_in !== NULL) { $date_in_symbol = parent::compareSimble($date_in_symbol); $date_in = parent::dateHandlerScape($date_in); $query .= " AND `date_in` {$date_in_symbol} {$date_in} "; } if ($date_out !== NULL) { $date_out_symbol = parent::compareSimble($date_out_symbol); $date_out = parent::dateHandlerScape($date_out); $query .= " AND `date_out` {$date_out_symbol} {$date_out} "; } //adiciona a ordenação na query $orderBy = ""; if ($order_type != NULL) { $order_type = parent::verifyOrderType($order_type); $orderBy .= ", `order` " . $order_type; } if ($orderBy != NULL) { $query .= " ORDER BY " . $orderBy; } }