本文整理汇总了PHP中SQLQBuilder::simpleUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLQBuilder::simpleUpdate方法的具体用法?PHP SQLQBuilder::simpleUpdate怎么用?PHP SQLQBuilder::simpleUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLQBuilder
的用法示例。
在下文中一共展示了SQLQBuilder::simpleUpdate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editTimeEvent
/**
* Editing time event
*
* All except time event id is editable
*/
public function editTimeEvent()
{
if ($this->_isOverlapping()) {
return false;
}
$sqlBuilder = new SQLQBuilder();
$updateTable = "`" . self::TIME_EVENT_DB_TABLE_TIME_EVENT . "`";
if ($this->getProjectId() != null) {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_PROJECT_ID . "`";
$updateValues[] = $this->getProjectId();
}
if ($this->getEmployeeId() != null) {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_EMPLOYEE_ID . "`";
$updateValues[] = $this->getEmployeeId();
}
if ($this->getActivityId() != null) {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_ACTIVITY_ID . "`";
$updateValues[] = $this->getActivityId();
}
if ($this->getTimesheetId() != null) {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_TIMESHEET_ID . "`";
$updateValues[] = $this->getTimesheetId();
}
if ($this->getStartTime() != null) {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_START_TIME . "`";
$updateValues[] = "'" . $this->getStartTime() . "'";
} else {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_START_TIME . "`";
$updateValues[] = "null";
}
if ($this->getEndTime() != null) {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_END_TIME . "`";
$updateValues[] = "'" . $this->getEndTime() . "'";
} else {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_END_TIME . "`";
$updateValues[] = "null";
}
if ($this->getReportedDate() != null) {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_REPORTED_DATE . "`";
$updateValues[] = "'" . $this->getReportedDate() . "'";
}
if ($this->getDuration() != null) {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_DURATION . "`";
$updateValues[] = $this->getDuration();
}
if ($this->getDescription() != null) {
$updateFields[] = "`" . self::TIME_EVENT_DB_FIELD_DESCRIPTION . "`";
$updateValues[] = "'" . $this->getDescription() . "'";
}
$updateConditions[] = "`" . self::TIME_EVENT_DB_FIELD_TIME_EVENT_ID . "` = {$this->getTimeEventId()}";
$query = $sqlBuilder->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result) {
if (mysql_affected_rows() > 0) {
return true;
} else {
return 2;
}
}
return false;
}
示例2: updateProject
/**
* Update project information
*/
public function updateProject()
{
if ($this->_isDuplicateName(true)) {
throw new ProjectsException("Duplicate name", 1);
}
$sql_builder = new SQLQBuilder();
$updateTable = self::TABLE_NAME;
if ($this->getCustomerId() != null) {
$updateFields[] = "`" . self::PROJECT_DB_FIELD_CUSTOMER_ID . "`";
$updateValues[] = "'" . $this->getCustomerId() . "'";
}
if ($this->getProjectName() != null) {
$updateFields[] = "`" . self::PROJECT_DB_FIELD_NAME . "`";
$updateValues[] = "'" . $this->getProjectName() . "'";
}
if ($this->getProjectDescription() != null) {
$updateFields[] = "`" . self::PROJECT_DB_FIELD_DESCRIPTION . "`";
$updateValues[] = "'" . $this->getProjectDescription() . "'";
}
if ($this->getDeleted() != null) {
$updateFields[] = "`" . self::PROJECT_DB_FIELD_DELETED . "`";
$updateValues[] = $this->getDeleted();
}
$updateConditions[] = "`" . self::PROJECT_DB_FIELD_PROJECT_ID . "` = {$this->getProjectId()}";
if (is_array($updateFields)) {
$updateValues = $sql_builder->quoteCorrect($updateValues);
$sqlQString = $sql_builder->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions);
$dbConnection = new DMLFunctions();
$message2 = $dbConnection->executeQuery($sqlQString);
//Calling the addData() function
// We don't check mysql_affected_rows here since the update may not have changed any
// of the database fields.
if ($message2) {
return true;
}
}
return false;
}
示例3: _changeTimesheetStatus
/**
* Change the status of the filled timesheet
*/
private function _changeTimesheetStatus()
{
$sql_builder = new SQLQBuilder();
$updateTable = self::TIMESHEET_DB_TABLE_TIMESHEET;
$updateFields[0] = "`" . self::TIMESHEET_DB_FIELD_STATUS . "`";
$updateValues[0] = $this->getStatus();
if ($this->getComment() != null) {
$updateFields[] = "`" . self::TIMESHEET_DB_FIELD_COMMENT . "`";
$updateValues[] = "'" . $this->getComment() . "'";
}
$updateConditions[] = "`" . self::TIMESHEET_DB_FIELD_TIMESHEET_ID . "` = {$this->getTimesheetId()}";
$query = $sql_builder->simpleUpdate($updateTable, $updateFields, $updateValues, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result) {
return true;
}
return false;
}
示例4: updateNotificationStatus
public function updateNotificationStatus()
{
$userObj = new Users();
$userObj->updateUserEmail($this->getUserId(), $this->getEmail());
if (!$this->_notificationConfigurationExsist()) {
return $this->_addNotificationStatus();
}
$sqlQBuilder = new SQLQBuilder();
$arrFields[0] = '`status`';
$changeValues[0] = $this->getNotificationStatus();
$arrTable = "`hs_hr_mailnotifications`";
$updateConditions[1] = "`user_id` = '{$this->getUserId()}'";
$updateConditions[2] = "`notification_type_id` = '{$this->getNotifcationTypeId()}'";
$query = $sqlQBuilder->simpleUpdate($arrTable, $arrFields, $changeValues, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
return $result;
}
示例5: _update
private function _update()
{
$updateTable = self::WORKSHIFT_TABLE;
$fields[0] = self::DB_FIELD_NAME;
$fields[1] = self::DB_FIELD_HOURS;
$updateValues[0] = "'" . $this->name . "'";
$updateValues[1] = $this->hoursPerDay;
$updateConditions[0] = self::DB_FIELD_WORKSHIFT_ID . " = " . $this->workshiftId;
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleUpdate($updateTable, $fields, $updateValues, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result === false) {
throw new WorkshiftException("Error in update", WorkshiftException::ERROR_IN_DB_QUERY);
}
return mysql_affected_rows();
}
示例6: undeleteLeaveType
public function undeleteLeaveType()
{
$sql_builder = new SQLQBuilder();
$selectTable = "`hs_hr_leavetype` ";
$changeFields[0] = "`available_flag`";
$changeValues[0] = "'" . $this->availableStatusFlag . "'";
$updateConditions[0] = "`leave_type_id` = '" . $this->getLeaveTypeId() . "'";
$query = $sql_builder->simpleUpdate($selectTable, $changeFields, $changeValues, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if (isset($result) && mysql_affected_rows() > 0) {
return true;
}
return false;
}
示例7: editDay
/**
* Updates the day
*
* requires a filled object
*
* @access pubic
*/
public function editDay()
{
$arrFieldList[0] = "`" . self::WEEKENDS_TABLE_LENGTH . "`";
$arrRecordsList[0] = $this->getLength();
$updateConditions[0] = "`" . self::WEEKENDS_TABLE_DAY . '` = ' . $this->getDay();
$updateTable = "`" . self::WEEKENDS_TABLE . "`";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleUpdate($updateTable, $arrFieldList, $arrRecordsList, $updateConditions);
//echo $query;
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if (mysql_affected_rows() == 0) {
return $this->_addDay();
}
return $result;
}
示例8: updateUserEmail
public function updateUserEmail($userId, $email)
{
$sqlQBuilder = new SQLQBuilder();
$arrFields[0] = '`email1`';
$changeValues[0] = $email;
$arrTable = "`hs_hr_users`";
$updateConditions[1] = "`id` = '{$userId}'";
$query = $sqlQBuilder->simpleUpdate($arrTable, $arrFields, $changeValues, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
return true;
}
示例9: edit
/**
* Edits holiday
*
* The object needs to be filled.
*
* @access public
*/
public function edit()
{
$arrFieldList[0] = "`" . self::HOLIDAYS_TABLE_DESCRIPTION . "`";
$arrFieldList[1] = "`" . self::HOLIDAYS_TABLE_DATE . "`";
$arrFieldList[2] = "`" . self::HOLIDAYS_TABLE_RECURRING . "`";
$arrFieldList[3] = "`" . self::HOLIDAYS_TABLE_LENGTH . "`";
$arrRecordsList[0] = "'" . $this->getDescription() . "'";
$arrRecordsList[1] = "'" . $this->getDate() . "'";
$arrRecordsList[2] = $this->getRecurring();
$arrRecordsList[3] = $this->getLength();
$updateConditions[0] = "`" . self::HOLIDAYS_TABLE_HOLIDAY_ID . '` = ' . $this->getHolidayId();
$arrTable = "`" . self::HOLIDAYS_TABLE . "`";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleUpdate($arrTable, $arrFieldList, $arrRecordsList, $updateConditions);
//echo $query;
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
}
示例10: updateLeavesForDate
/**
* This function will delete leave records for the given date. This will only for leave status other than 'taken'
* @param $date - string date for delete records
*/
public static function updateLeavesForDate($date, $length)
{
$sql_builder = new SQLQBuilder();
$updateTable = "`hs_hr_leave`";
$changeFields[] = "`leave_length_days`";
$changeFields[] = "`leave_length_hours`";
$changeValues[] = "(`leave_length_days` - ({$length} / " . self::LEAVE_LENGTH_FULL_DAY . "))";
$changeValues[] = "`leave_length_hours` - {$length}";
$updateConditions[] = "`leave_date` = '" . $date . "'";
$updateConditions[] = "`leave_status` <> '" . self::LEAVE_STATUS_LEAVE_TAKEN . "'";
$query = $sql_builder->simpleUpdate($updateTable, $changeFields, $changeValues, $updateConditions, false);
//echo $query."\n";
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
}
示例11: updateLeaveQuota
/**
* Update leave quota of an employee
*
* @return boolean
* @access public
*/
private function updateLeaveQuota()
{
$sqlBuilder = new SQLQBuilder();
$updateTable = "`" . self::LEAVEQUOTA_DB_TABLE_EMPLOYEE_LEAVE_QUOTA . "`";
$updateFileds[0] = "`" . self::LEAVEQUOTA_DB_FIELD_NO_OF_DAYS_ALLOTED . "`";
$updateValues[0] = "'" . $this->getNoOfDaysAllotted() . "'";
$updateConditions[0] = "`" . self::LEAVEQUOTA_DB_FIELD_YEAR . "` = '" . $this->getYear() . "'";
$updateConditions[1] = "`" . self::LEAVEQUOTA_DB_FIELD_LEAVE_TYPE_ID . "` = '" . $this->getLeaveTypeId() . "'";
$updateConditions[2] = "`" . self::LEAVEQUOTA_DB_FIELD_EMPLOYEE_ID . "` = '" . $this->getEmployeeId() . "'";
$query = $sqlBuilder->simpleUpdate($updateTable, $updateFileds, $updateValues, $updateConditions);
//echo $query."\n";
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result) {
return true;
}
return false;
}
示例12: update
public function update()
{
if (!CommonFunctions::isValidId($this->id)) {
throw new HspPayPeriodException("Invalid id", HspPayPeriodException::INVALID_ID);
}
$updateTable = '`' . self::PAY_PERIOD_DB_TABLE . '`';
$changeFields[0] = '`' . self::PAY_PERIOD_DB_FIELD_START_DATE . '`';
$changeFields[1] = '`' . self::PAY_PERIOD_DB_FIELD_END_DATE . '`';
$changeFields[2] = '`' . self::PAY_PERIOD_DB_FIELD_CLOSE_DATE . '`';
$changeFields[3] = '`' . self::PAY_PERIOD_DB_FIELD_CHECK_DATE . '`';
$changeFields[4] = '`' . self::PAY_PERIOD_DB_FIELD_TIMESHEET_APROVAL_DUE_DATE . '`';
$changeValues[0] = "'" . $this->startDate . "'";
$changeValues[1] = "'" . $this->endDate . "'";
$changeValues[2] = "'" . $this->closeDate . "'";
$changeValues[3] = "'" . $this->checkDate . "'";
$changeValues[4] = "'" . $this->timesheetAprovalDueDate . "'";
$updateConditions[0] = "`" . self::PAY_PERIOD_DB_FIELD_ID . "` = '" . $this->id . "'";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleUpdate($updateTable, $changeFields, $changeValues, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
return $result;
}
示例13: _update
private function _update()
{
if (!CommonFunctions::isValidId($this->id)) {
throw new HspPaymentRequest("Invalid id", HspPaymentRequest::INVALID_ID);
}
$arrTable = '`' . self::HSP_PAYMENT_REQUEST_DB_TABLE . '`';
if ($this->dateIncurred != null) {
$updateFields[] = '`' . self::DB_FIELD_DATE_INCURRED . '`';
$arrRecordsList[] = "'" . $this->dateIncurred . "'";
}
if ($this->providerName != null) {
$updateFields[] = '`' . self::DB_FIELD_PROVIDER_NAME . '`';
$arrRecordsList[] = "'" . $this->providerName . "'";
}
if ($this->personIncurringExpense != null) {
$updateFields[] = '`' . self::DB_FIELD_PERSON_INCURRING_EXPENSE . '`';
$arrRecordsList[] = "'" . $this->personIncurringExpense . "'";
}
if ($this->expenseDescription != null) {
$updateFields[] = '`' . self::DB_FIELD_EXPENSE_DESCRIPTION . '`';
$arrRecordsList[] = "'" . $this->expenseDescription . "'";
}
if ($this->expenseAmount != null) {
$updateFields[] = '`' . self::DB_FIELD_EXPENSE_AMOUNT . '`';
$arrRecordsList[] = "'" . $this->expenseAmount . "'";
}
if ($this->paymentMadeTo != null) {
$updateFields[] = '`' . self::DB_FIELD_PAYMENT_MADE_TO . '`';
$arrRecordsList[] = "'" . $this->paymentMadeTo . "'";
}
if ($this->thirdPartyAccountNumber != null) {
$updateFields[] = '`' . self::DB_FIELD_THIRD_PARTY_ACCOUNT_NUMBER . '`';
$arrRecordsList[] = "'" . $this->thirdPartyAccountNumber . "'";
}
if ($this->mailAddress != null) {
$updateFields[] = '`' . self::DB_FIELD_MAIL_ADDRESS . '`';
$arrRecordsList[] = "'" . $this->mailAddress . "'";
}
if ($this->comments != null) {
$updateFields[] = '`' . self::DB_FIELD_COMMENTS . '`';
$arrRecordsList[] = "'" . $this->comments . "'";
}
if ($this->status != null) {
$updateFields[] = '`' . self::DB_FIELD_STATUS . '`';
$arrRecordsList[] = "'" . $this->status . "'";
}
if ($this->datePaid != null) {
$updateFields[] = '`' . self::DB_FIELD_DATE_PAID . '`';
$arrRecordsList[] = "'" . $this->datePaid . "'";
}
if ($this->checkNumber != null) {
$updateFields[] = '`' . self::DB_FIELD_CHECK_NUMBER . '`';
$arrRecordsList[] = "'" . $this->checkNumber . "'";
}
if ($this->hrNotes != null) {
$updateFields[] = '`' . self::DB_FIELD_HR_NOTES . '`';
$arrRecordsList[] = "'" . $this->hrNotes . "'";
}
$updateConditions[0] = "`" . self::DB_FIELD_ID . "` = '" . $this->id . "'";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleUpdate($arrTable, $updateFields, $arrRecordsList, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result === false) {
throw new HspPaymentRequestException("Error in update", HspPaymentRequestException::ERROR_IN_DB_QUERY);
}
return mysql_affected_rows();
}
示例14: cancelLeaveTaken
public function cancelLeaveTaken($obj)
{
$sqlBuilder = new SQLQBuilder();
$updateTable = "`hs_hr_leave`";
$updateFileds[0] = "`leave_status`";
$updateFileds[1] = "`leave_comments`";
$updateValues[0] = "'" . $obj->getLeaveStatus() . "'";
$updateValues[1] = "'" . $obj->getLeaveComments() . "'";
$updateConditions[0] = "`leave_id` = '" . $obj->getLeaveId() . "'";
$query = $sqlBuilder->simpleUpdate($updateTable, $updateFileds, $updateValues, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result) {
return true;
} else {
return false;
}
}
示例15: delJobTitles
function delJobTitles($arrList)
{
$updateTable = "`hs_hr_job_title`";
$changeFields[0] = "`" . self::DB_FIELD_IS_ACTIVE . "`";
$changeValues[0] = self::DELETED_JOB_TITLE;
$updateConditions[0] = self::DB_FIELD_CODE . " IN('" . implode("','", $arrList[0]) . "')";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleUpdate($updateTable, $changeFields, $changeValues, $updateConditions);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result) {
return true;
}
return false;
}