本文整理汇总了PHP中DataHandler::convertDateToDB方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::convertDateToDB方法的具体用法?PHP DataHandler::convertDateToDB怎么用?PHP DataHandler::convertDateToDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataHandler
的用法示例。
在下文中一共展示了DataHandler::convertDateToDB方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addFilter
public function addFilter(&$query, $id, $active, $email, $date, $date_symbol)
{
if ($id !== NULL) {
$query .= " AND id = '" . DataHandler::forceInt($id) . "'";
}
if ($active !== NULL) {
$query .= " AND `active` = '" . DataHandler::forceInt($active) . "'";
}
if ($email !== NULL) {
$query .= " AND `email` = '" . DataHandler::forceString($email) . "'";
}
if ($date !== NULL) {
$date_symbol = parent::compareSimble($date_symbol);
$date = parent::dateHandlerScape(DataHandler::convertDateToDB($date));
$query .= " AND `date` {$date_symbol} {$date} ";
}
}
示例2: setDate
/**
* @param $date (date)
* @return void
*/
public function setDate($date)
{
$this->date = DataHandler::convertDateToDB($date);
}
示例3: update
/**
* @param $id
* @param $active
* @param $name
* @param $title
* @param $hat
* @param $description
* @param $content
* @param $author
* @param $template_url
* @param $slug
* @param $key_words
* @param $date
* @param $date_in
* @param $date_out
* @param $order
* @return ReturnDataVO
*/
public function update($id, $active = 0, $name = NULL, $title = NULL, $hat = NULL, $description = NULL, $content = NULL, $author = NULL, $template_url = NULL, $slug = NULL, $key_words = NULL, $date = NUL, $date_in = NULL, $date_out = NULL, $order)
{
$ReturnDataVO = new ReturnDataVO();
$query = "UPDATE content SET ";
if ($id == NULL && $id <= 0) {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_ID;
return $ReturnDataVO;
}
$comma = "";
if ($active !== NULL) {
$query .= $comma . " `active` = '" . DataHandler::forceInt($active) . "'";
$comma = ", ";
}
if ($name !== NULL) {
$query .= $comma . " `name` = '" . DataHandler::forceString($name) . "'";
$comma = ", ";
}
if ($title !== NULL) {
$query .= $comma . " `title` = '" . DataHandler::forceString($title) . "'";
$comma = ", ";
}
if ($hat !== NULL) {
$query .= $comma . " `hat` = '" . DataHandler::forceString($hat) . "'";
$comma = ", ";
}
if ($description !== NULL) {
$query .= $comma . " `description` = '" . DataHandler::forceString($description) . "'";
$comma = ", ";
}
if ($content !== NULL) {
$query .= $comma . " `content` = '" . DataHandler::forceString($content) . "'";
$comma = ", ";
}
if ($author !== NULL) {
$query .= $comma . " `author` = '" . DataHandler::forceString($author) . "'";
$comma = ", ";
}
if ($template_url !== NULL) {
$query .= $comma . " `template_url` = '" . DataHandler::removeSpecialCharacters($template_url) . "'";
$comma = ", ";
}
if ($slug !== NULL) {
$query .= $comma . " `slug` = '" . DataHandler::removeSpecialCharacters($slug) . "'";
$comma = ", ";
}
if ($key_words !== NULL) {
$query .= $comma . " `key_words` = '" . DataHandler::forceString($key_words) . "'";
$comma = ", ";
}
if ($date !== NULL) {
$date = $date == "now()" ? "now()" : "'" . DataHandler::convertDateToDB($date) . "'";
$query .= $comma . " `date` = {$date} ";
$comma = ", ";
}
if ($date_in !== NULL) {
$query .= $comma . " `date_in` = '" . DataHandler::convertDateToDB($date_in) . "'";
$comma = ", ";
}
if ($date_out !== NULL) {
$query .= $comma . " `date_out` = '" . DataHandler::convertDateToDB($date_out) . "'";
$comma = ", ";
}
if ($order !== NULL) {
$query .= $comma . " `order` = '" . DataHandler::forceInt($order) . "'";
$comma = ", ";
}
$query .= "\tWHERE id = '" . DataHandler::forceInt($id) . "' LIMIT 1";
if ($comma == "") {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_UPDATES;
//Debug::print_r($ReturnDataVO);
return $ReturnDataVO;
} else {
$ReturnDataVO = parent::query($query);
//Debug::print_r($ReturnDataVO);
return $ReturnDataVO;
}
}
示例4: update
/**
* @param $id
* @param $active
* @param $table
* @param $table_id
* @param $user_id
* @param $title
* @param $description
* @param $date
* @param $order
* @return ReturnDataVO
*/
public function update($id = NULL, $active = NULL, $table = NULL, $table_id = NULL, $user_id = NULL, $title = NULL, $description = NULL, $date = NULL, $order = NULL)
{
$ReturnDataVO = new ReturnDataVO();
$query = "UPDATE comment SET ";
if ($id == NULL && $id <= 0) {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_ID;
return $ReturnDataVO;
}
$comma = "";
if ($active !== NULL) {
$query .= $comma . " `active` = '" . DataHandler::forceInt($active) . "'";
$comma = ", ";
}
if ($table > 0) {
$query .= $comma . " `table` = '" . DataHandler::forceString($table) . "'";
$comma = ", ";
}
if ($user_id > 0) {
$query .= $comma . " `user_id` = '" . DataHandler::forceInt($user_id) . "'";
$comma = ", ";
}
if ($table_id > 0) {
$query .= $comma . " `table_id` = '" . DataHandler::forceInt($table_id) . "'";
$comma = ", ";
}
if ($title !== NULL) {
$query .= $comma . " `title` = '" . DataHandler::forceString($title) . "'";
$comma = ", ";
}
if ($description !== NULL) {
$query .= $comma . " `description` = '" . DataHandler::forceString($description) . "'";
$comma = ", ";
}
if ($date !== NULL) {
$query .= $comma . " `date` = '" . DataHandler::convertDateToDB($date) . "'";
$comma = ", ";
}
if ($order !== NULL) {
$query .= $comma . " `order` = '" . DataHandler::forceInt($order) . "'";
$comma = ", ";
}
$query .= "\tWHERE id = '" . DataHandler::forceInt($id) . "' LIMIT 1";
if ($comma == "") {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_UPDATES;
//Debug::print_r($ReturnDataVO);
return $ReturnDataVO;
} else {
$ReturnDataVO = parent::query($query);
//Debug::print_r($ReturnDataVO);
return $ReturnDataVO;
}
}
示例5: setValueByType
/**
* @param $type
* @param $value
* @return void
*/
public function setValueByType($value, $type)
{
//echo "vai comparar ".strtolower($type)." com :".$this->TYPE_INT;
switch (strtolower($type)) {
case ParametherDAO::TYPE_NUMBER:
$this->number = $value;
break;
case ParametherDAO::TYPE_TEXT:
case ParametherDAO::TYPE_JSON:
$this->text = $value;
break;
case ParametherDAO::TYPE_INT:
$this->int = $value;
break;
case ParametherDAO::TYPE_DATE:
$this->date = DataHandler::convertDateToDB($value);
break;
default:
$this->varchar = $value;
break;
}
}
示例6: setDateOut
/**
* @param date_out (datetime)
*/
public function setDateOut($date_out)
{
if ($date_out !== NULL) {
$this->date_out = DataHandler::convertDateToDB($date_out);
}
}
示例7: update
/**
* @param $id
* @param $active
* @param $name
* @param $link
* @param $content
* @param $image_url
* @param $date
* @param $date_in
* @param $date_out
* @param $order
* @return ReturnDataVO
*/
public function update($id, $active = 0, $name = NULL, $link = NULL, $content = NULL, $image_url = NULL, $date = NUL, $date_in = NULL, $date_out = NULL, $order)
{
$ReturnDataVO = new ReturnDataVO();
$query = "UPDATE highlights SET ";
if ($id == NULL && $id <= 0) {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_ID;
return $ReturnDataVO;
}
$comma = "";
if ($active !== NULL) {
$query .= $comma . " `active` = '" . DataHandler::forceInt($active) . "'";
$comma = ", ";
}
if ($name !== NULL) {
$query .= $comma . " `name` = '" . DataHandler::forceString($name) . "'";
$comma = ", ";
}
if ($link !== NULL) {
$query .= $comma . " `link` = '" . DataHandler::forceString($link) . "'";
$comma = ", ";
}
if ($content !== NULL) {
$query .= $comma . " `content` = '" . DataHandler::forceString($content) . "'";
$comma = ", ";
}
if ($image_url !== NULL) {
$query .= $comma . " `image_url` = '" . DataHandler::removeSpecialCharacters($image_url) . "'";
$comma = ", ";
}
if ($date !== NULL) {
$query .= $comma . " `date` = '" . DataHandler::convertDateToDB($date) . "'";
$comma = ", ";
}
if ($date_in !== NULL) {
$query .= $comma . " `date_in` = '" . DataHandler::convertDateToDB($date_in) . "'";
$comma = ", ";
}
if ($date_out !== NULL) {
$query .= $comma . " `date_out` = '" . DataHandler::convertDateToDB($date_out) . "'";
$comma = ", ";
}
if ($order !== NULL) {
$query .= $comma . " `order` = '" . DataHandler::forceInt($order) . "'";
$comma = ", ";
}
$query .= "\tWHERE id = '" . DataHandler::forceInt($id) . "' LIMIT 1";
if ($comma == "") {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_UPDATES;
//Debug::print_r($ReturnDataVO);
return $ReturnDataVO;
} else {
$ReturnDataVO = parent::query($query);
//Debug::print_r($ReturnDataVO);
return $ReturnDataVO;
}
}
示例8: setRegistred
/**
* @param registred (date)
*/
public function setRegistred($registred)
{
$this->registred = DataHandler::convertDateToDB($registred);
}
示例9: update
/**
* @param $table
* @param $table_id
* @param $name
* @param $type
* @param $active
* @param $locale
* @param $varchar
* @param $text
* @param $number
* @param $int
* @param $date
* @return ReturnDataVO
*/
public function update($id, $table, $table_id, $name = NULL, $type = ParametherDAO::TYPE_VARCHAR, $active = 1, $locale = NULL, $varchar = NULL, $text = NULL, $number = NULL, $int = NULL, $date = NULL)
{
$ReturnDataVO = new ReturnDataVO();
if ($id == NULL && $id <= 0) {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_PARAMETHER_UPDATE_DONOT_HAVE_ID;
return $ReturnDataVO;
}
$query = "UPDATE `paramether` SET ";
$comma = "";
if ($active !== NULL) {
$query .= "{$comma} `active` = '" . DataHandler::forceInt($active) . "'";
$comma = ", ";
}
if ($table !== NULL) {
$query .= " {$comma} `table` = '" . DataHandler::forceString($table) . "'";
$comma = " , ";
}
if ($table_id !== NULL) {
$query .= " {$comma} `table_id` = '" . DataHandler::forceInt($table_id) . "'";
$comma = " , ";
}
if ($name !== NULL) {
$query .= "{$comma} `name` = '" . DataHandler::forceString($name) . "'";
$comma = ", ";
}
if ($type !== NULL) {
$query .= " {$comma} `type` = '" . DataHandler::forceString($type) . "'";
$comma = " , ";
}
if ($locale !== NULL) {
$query .= " {$comma} `locale` = '" . DataHandler::forceString($locale) . "'";
$comma = ", ";
}
if ($varchar !== NULL) {
$query .= " {$comma} `varchar` = '" . DataHandler::forceString($varchar) . "'";
$comma = ", ";
}
if ($text !== NULL) {
$query .= " {$comma} `text` = '" . DataHandler::forceString($text) . "'";
$comma = ", ";
}
if ($number !== NULL) {
$query .= " {$comma} `number` = '" . DataHandler::forceNumber($number) . "'";
$comma = ", ";
}
if ($int !== NULL) {
$query .= " {$comma} `int` = '" . DataHandler::forceInt($int) . "'";
$comma = ", ";
}
if ($date !== NULL) {
$query .= " {$comma} `date` = '" . DataHandler::convertDateToDB($date) . "'";
$comma = ", ";
}
$query .= " WHERE id = '" . DataHandler::forceInt($id) . "' LIMIT 1 ";
//echo $query;
if ($comma == "") {
$ReturnDataVO->success = FALSE;
$ReturnDataVO->code_return = DbInterface::ERROR_PARAMETHER_UPDATE_DONOT_HAVE_UPDATES;
return $ReturnDataVO;
} else {
$ReturnDataVO = parent::query($query);
if (!$ReturnDataVO->success) {
$ReturnDataVO->code_return = DbInterface::ERROR_PARAMETHER_UPDATE_COMMIT;
}
return $ReturnDataVO;
}
}
示例10: addFilter
private function addFilter(&$query, $id = NULL, $address_id = NULL, $name = NULL, $last_name = NULL, $birthday = NULL, $mobile = NULL, $telephone = NULL, $email = NULL, $rg = NULL, $cpf = NULL, $company = NULL, $website = NULL, $sex = NULL, $recive_news = NULL, $registred = NULL, $user_type_id = NULL, $date = NULL, $date_symbol = ">=")
{
if ($id !== NULL) {
$query .= " AND user.id = '" . DataHandler::forceInt($id) . "'";
}
if ($name !== NULL) {
$query .= " AND `name` LIKE '%" . DataHandler::forceString($name) . "%'";
}
if ($last_name !== NULL) {
$query .= " AND `last_name` ='" . DataHandler::forceString($last_name) . "'";
}
if ($birthday !== NULL) {
$query .= " AND `birthday` =" . $this->dateHandlerScape($birthday);
}
if ($mobile !== NULL) {
$query .= " AND `mobile` ='" . DataHandler::forceString($mobile) . "'";
}
if ($telephone !== NULL) {
$query .= " AND `telephone` ='" . DataHandler::forceString($telephone) . "'";
}
if ($email !== NULL) {
$query .= " AND `email` ='" . DataHandler::forceString($email) . "'";
}
if ($rg !== NULL) {
$query .= " AND `rg` ='" . DataHandler::forceString($rg) . "'";
}
if ($cpf !== NULL) {
$query .= " AND `cpf` ='" . DataHandler::forceString($cpf) . "'";
}
if ($company !== NULL) {
$query .= " AND `company` ='" . DataHandler::forceString($company) . "'";
}
if ($website !== NULL) {
$query .= " AND `website` ='" . DataHandler::forceString($website) . "'";
}
if ($sex !== NULL) {
$query .= " AND `sex` ='" . DataHandler::forceInt($sex) . "'";
}
if ($recive_news !== NULL) {
$query .= " AND `recive_news` ='" . DataHandler::forceInt($recive_news) . "'";
}
if ($registred !== NULL) {
$query .= " AND `registred` =" . $this->dateHandlerScape($registred) . "";
}
if ($user_type_id != NULL) {
$query .= " AND `user_type_id` =" . DataHandler::forceInt($user_type_id) . "";
}
if ($date !== NULL) {
$date_symbol = parent::compareSimble($date_symbol);
$date = parent::dateHandlerScape(DataHandler::convertDateToDB($date));
$query .= " AND `registred` {$date_symbol} {$date} ";
}
}
示例11: setFetchObject
/**
* @param (object) $obj_dados
* @return void
*/
function setFetchObject($obj_dados)
{
$this->id = DataHandler::getValueByStdObjectIndex($obj_dados, "id");
$this->user_id = DataHandler::getValueByStdObjectIndex($obj_dados, "user_id");
$this->table_id = DataHandler::getValueByStdObjectIndex($obj_dados, "table_id");
$this->table = DataHandler::getValueByStdObjectIndex($obj_dados, "table");
$this->active = DataHandler::getValueByStdObjectIndex($obj_dados, "active");
$this->title = DataHandler::getValueByStdObjectIndex($obj_dados, "title");
$this->description = DataHandler::getValueByStdObjectIndex($obj_dados, "description");
$this->date = DataHandler::convertDateToDB(DataHandler::getValueByStdObjectIndex($obj_dados, "date"));
$this->order = DataHandler::getValueByStdObjectIndex($obj_dados, "order");
}