本文整理汇总了PHP中SQLQBuilder::simpleInsert方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLQBuilder::simpleInsert方法的具体用法?PHP SQLQBuilder::simpleInsert怎么用?PHP SQLQBuilder::simpleInsert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLQBuilder
的用法示例。
在下文中一共展示了SQLQBuilder::simpleInsert方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addLeaveType
/**
* Add the Leave Type
*
*/
public function addLeaveType()
{
$this->leaveTypeId = UniqueIDGenerator::getInstance()->getNextID('hs_hr_leavetype', 'leave_type_id', 'LTY');
$arrRecordsList[0] = "'" . $this->getLeaveTypeId() . "'";
$arrRecordsList[1] = "'" . $this->getLeaveTypeName() . "'";
$arrRecordsList[2] = $this->availableStatusFlag;
$sqlBuilder = new SQLQBuilder();
$arrTable = "`hs_hr_leavetype`";
$query = $sqlBuilder->simpleInsert($arrTable, $arrRecordsList);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
return $result;
}
示例2: _addDay
/**
* Adds a day incase the day is not there.
*
* Unlikely to happen, but added as an auto heal feature.
* Needs a filled object.
*
* @access private
*/
private function _addDay()
{
$arrRecordsList[0] = $this->getDay();
$arrRecordsList[1] = $this->getLength();
$insertTable = "`" . self::WEEKENDS_TABLE . "`";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleInsert($insertTable, $arrRecordsList) . " ON DUPLICATE KEY UPDATE " . self::WEEKENDS_TABLE_LENGTH . " = " . $this->getLength();
//echo $query;
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
}
示例3: addTimesheet
/**
* Add a new timesheet
*
* Status will be overwritten
*/
public function addTimesheet()
{
$newId = UniqueIDGenerator::getInstance()->getNextID(self::TIMESHEET_DB_TABLE_TIMESHEET, self::TIMESHEET_DB_FIELD_TIMESHEET_ID);
$this->setTimesheetId($newId);
if ($this->getStartDate() == '' || $this->getEndDate() == '') {
$this->_getNewDates();
}
$this->setStatus(self::TIMESHEET_STATUS_NOT_SUBMITTED);
$sql_builder = new SQLQBuilder();
$insertTable = self::TIMESHEET_DB_TABLE_TIMESHEET;
$insertFields[0] = "`" . self::TIMESHEET_DB_FIELD_TIMESHEET_ID . "`";
$insertFields[1] = "`" . self::TIMESHEET_DB_FIELD_EMPLOYEE_ID . "`";
$insertFields[2] = "`" . self::TIMESHEET_DB_FIELD_TIMESHEET_PERIOD_ID . "`";
$insertFields[3] = "`" . self::TIMESHEET_DB_FIELD_START_DATE . "`";
$insertFields[4] = "`" . self::TIMESHEET_DB_FIELD_END_DATE . "`";
$insertFields[5] = "`" . self::TIMESHEET_DB_FIELD_STATUS . "`";
$insertValues[0] = $this->getTimesheetId();
$insertValues[1] = $this->getEmployeeId();
$insertValues[2] = $this->getTimesheetPeriodId();
$insertValues[3] = "'" . $this->getStartDate() . "'";
$insertValues[4] = "'" . $this->getEndDate() . "'";
$insertValues[5] = $this->getStatus();
$insertValues = $sql_builder->quoteCorrect($insertValues);
$query = $sql_builder->simpleInsert($insertTable, $insertValues, $insertFields);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result && mysql_affected_rows() > 0) {
return true;
}
return false;
}
示例4: addTimeEvent
/**
* Add new time event
*
* Time event id will be over written
*
* @throws TimeEventException Overlapping time period 2
*/
public function addTimeEvent()
{
if ($this->getStartTime() != null && $this->getEmployeeId() != null) {
$this->_checkStartTimeInTimeEvent();
}
$this->_isOverlapping();
$newId = UniqueIDGenerator::getInstance()->getNextID(self::TIME_EVENT_DB_TABLE_TIME_EVENT, self::TIME_EVENT_DB_FIELD_TIME_EVENT_ID);
$this->setTimeEventId($newId);
$insertTable = "`" . self::TIME_EVENT_DB_TABLE_TIME_EVENT . "`";
$insertFields[0] = "`" . self::TIME_EVENT_DB_FIELD_TIME_EVENT_ID . "`";
$insertFields[1] = "`" . self::TIME_EVENT_DB_FIELD_PROJECT_ID . "`";
$insertFields[2] = "`" . self::TIME_EVENT_DB_FIELD_ACTIVITY_ID . "`";
$insertFields[3] = "`" . self::TIME_EVENT_DB_FIELD_EMPLOYEE_ID . "`";
$insertFields[4] = "`" . self::TIME_EVENT_DB_FIELD_TIMESHEET_ID . "`";
$insertValues[0] = $this->getTimeEventId();
$insertValues[1] = $this->getProjectId();
$insertValues[2] = $this->getActivityId();
$insertValues[3] = $this->getEmployeeId();
$insertValues[4] = $this->getTimesheetId();
if ($this->getStartTime() != null) {
$insertFields[] = "`" . self::TIME_EVENT_DB_FIELD_START_TIME . "`";
$insertValues[] = "'" . $this->getStartTime() . "'";
}
if ($this->getEndTime() != null) {
$insertFields[] = "`" . self::TIME_EVENT_DB_FIELD_END_TIME . "`";
$insertValues[] = "'" . $this->getEndTime() . "'";
}
if ($this->getReportedDate() != null) {
$insertFields[] = "`" . self::TIME_EVENT_DB_FIELD_REPORTED_DATE . "`";
$insertValues[] = "'" . $this->getReportedDate() . "'";
}
if ($this->getDuration() != null) {
$insertFields[] = "`" . self::TIME_EVENT_DB_FIELD_DURATION . "`";
$insertValues[] = $this->getDuration();
}
if ($this->getDescription() != null) {
$insertFields[] = "`" . self::TIME_EVENT_DB_FIELD_DESCRIPTION . "`";
$insertValues[] = "'" . $this->getDescription() . "'";
}
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleInsert($insertTable, $insertValues, $insertFields);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result) {
if (mysql_affected_rows() > 0) {
return true;
}
}
return false;
}
示例5: _addLeaveRequest
/**
* Adds Record to Leave Request
*
* @access private
*/
private function _addLeaveRequest()
{
$newId = UniqueIDGenerator::getInstance()->getNextID('hs_hr_leave_requests', 'leave_request_id');
$this->setLeaveRequestId($newId);
$this->_getLeaveTypeName();
$this->setDateApplied(date('Y-m-d'));
$arrRecordsList[0] = $this->getLeaveRequestId();
$arrRecordsList[1] = "'" . $this->getLeaveTypeId() . "'";
$arrRecordsList[2] = "'" . $this->getLeaveTypeName() . "'";
$arrRecordsList[3] = "'" . $this->getDateApplied() . "'";
$arrRecordsList[4] = "'" . $this->getEmployeeId() . "'";
$arrTable = "`hs_hr_leave_requests`";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleInsert($arrTable, $arrRecordsList);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
return $result;
}
示例6: saveInitialSummaryForOneEmployee
/**
* This function is to save initial summary data for one employee. Used when a new
* employee is added at PIM module.
*/
public static function saveInitialSummaryForOneEmployee($empId)
{
$both = self::getYearsAndPlans();
if (!empty($both)) {
$count1 = count($both);
for ($i = 0; $i < $count1; $i++) {
$count2 = count($both[$i]['plan']);
for ($j = 0; $j < $count2; $j++) {
$insertTable = "`" . parent::DB_TABLE_HSP_SUMMARY . "`";
$insertFields[0] = "`" . parent::DB_FIELD_SUMMARY_ID . "`";
$insertFields[1] = "`" . parent::DB_FIELD_EMPLOYEE_ID . "`";
$insertFields[2] = "`" . parent::DB_FIELD_HSP_PLAN_ID . "`";
$insertFields[3] = "`" . parent::DB_FIELD_HSP_PLAN_YEAR . "`";
$insertFields[4] = "`" . parent::DB_FIELD_HSP_PLAN_STATUS . "`";
$insertFields[5] = "`" . parent::DB_FIELD_ANNUAL_LIMIT . "`";
$insertFields[6] = "`" . parent::DB_FIELD_EMPLOYER_AMOUNT . "`";
$insertFields[7] = "`" . parent::DB_FIELD_EMPLOYEE_AMOUNT . "`";
$insertFields[8] = "`" . parent::DB_FIELD_TOTAL_ACCRUED . "`";
$insertFields[9] = "`" . parent::DB_FIELD_TOTAL_USED . "`";
$insertValues[0] = UniqueIDGenerator::getInstance()->getNextID(parent::DB_TABLE_HSP_SUMMARY, parent::DB_FIELD_SUMMARY_ID);
$insertValues[1] = $empId;
$insertValues[2] = $both[$i]['plan'][$j];
$insertValues[3] = $both[$i]['year'];
$insertValues[4] = 1;
$insertValues[5] = 0;
$insertValues[6] = 0;
$insertValues[7] = 0;
$insertValues[8] = 0;
$insertValues[9] = 0;
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleInsert($insertTable, $insertValues, $insertFields);
$dbConnection = new DMLFunctions();
$dbConnection->executeQuery($query);
}
}
}
}
示例7: addLeaveQuota
/**
* Add Leave Quota of an employee
*
* @param String $employeeId
* @return boolean
* @access public
*/
public function addLeaveQuota($employeeId)
{
$this->setEmployeeId($employeeId);
$sqlBuilder = new SQLQBuilder();
$insertTable = "`" . self::LEAVEQUOTA_DB_TABLE_EMPLOYEE_LEAVE_QUOTA . "`";
$insertFields[0] = "`" . self::LEAVEQUOTA_DB_FIELD_YEAR . "`";
$insertFields[1] = "`" . self::LEAVEQUOTA_DB_FIELD_LEAVE_TYPE_ID . "`";
$insertFields[2] = "`" . self::LEAVEQUOTA_DB_FIELD_EMPLOYEE_ID . "`";
$insertFields[3] = "`" . self::LEAVEQUOTA_DB_FIELD_NO_OF_DAYS_ALLOTED . "`";
$insertValues[0] = "'" . $this->getYear() . "'";
$insertValues[1] = "'" . $this->getLeaveTypeId() . "'";
$insertValues[2] = "'" . $this->getEmployeeId() . "'";
$insertValues[3] = $this->getNoOfDaysAllotted();
$query = $sqlBuilder->simpleInsert($insertTable, $insertValues, $insertFields);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result) {
return true;
}
return false;
}
示例8: add
/**
* Add Holiday - one at a time
*
* The object needs to be filled, except for the id.
*
* @access public
*/
public function add()
{
$this->holidayId = UniqueIDGenerator::getInstance()->getNextID(self::HOLIDAYS_TABLE, self::HOLIDAYS_TABLE_HOLIDAY_ID);
$arrRecordsList[0] = $this->getHolidayId();
$arrRecordsList[1] = "'" . $this->getDescription() . "'";
$arrRecordsList[2] = "'" . $this->getDate() . "'";
$arrRecordsList[3] = $this->getRecurring();
$arrRecordsList[4] = $this->getLength();
$arrTable = self::HOLIDAYS_TABLE;
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleInsert($arrTable, $arrRecordsList);
//echo $query;
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
}
示例9: _addLeave
/**
* Adds Leave
*
* @access protected
*/
protected function _addLeave()
{
$this->leaveId = UniqueIDGenerator::getInstance()->getNextID('hs_hr_leave', 'leave_id');
$this->_getLeaveTypeName();
$this->setDateApplied(date('Y-m-d'));
$this->_adjustLeaveLength();
$insertFields[0] = '`leave_id`';
$insertFields[1] = '`leave_date`';
$insertFields[2] = '`leave_length_hours`';
$insertFields[3] = '`leave_length_days`';
$insertFields[4] = '`leave_status`';
$insertFields[5] = '`leave_comments`';
$insertFields[6] = '`leave_request_id`';
$insertFields[7] = '`leave_type_id`';
$insertFields[8] = '`employee_id`';
$arrRecordsList[0] = $this->getLeaveId();
$arrRecordsList[1] = "'" . $this->getLeaveDate() . "'";
$arrRecordsList[2] = "'" . $this->getLeaveLengthHours() . "'";
$arrRecordsList[3] = "'" . $this->getLeaveLengthDays() . "'";
$hours = $this->getLeaveLengthHours();
$days = $this->getLeaveLengthDays();
if ($hours == 0 && $days == 0) {
$arrRecordsList[4] = self::LEAVE_STATUS_LEAVE_CANCELLED;
} else {
$arrRecordsList[4] = $this->statusLeavePendingApproval;
}
$arrRecordsList[5] = "'" . $this->getLeaveComments() . "'";
$arrRecordsList[6] = "'" . $this->getLeaveRequestId() . "'";
$arrRecordsList[7] = "'" . $this->getLeaveTypeId() . "'";
$arrRecordsList[8] = "'" . $this->getEmployeeId() . "'";
if ($this->getStartTime() != null && $this->getEndTime() != null) {
$insertFields[9] = '`start_time`';
$arrRecordsList[9] = "'" . $this->getStartTime() . "'";
$insertFields[10] = '`end_time`';
$arrRecordsList[10] = "'" . $this->getEndTime() . "'";
}
$arrTable = "`hs_hr_leave`";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleInsert($arrTable, $arrRecordsList, $insertFields);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
return $result;
}
示例10: add
public function add()
{
$this->id = UniqueIDGenerator::getInstance()->getNextID(self::PAY_PERIOD_DB_TABLE, self::PAY_PERIOD_DB_FIELD_ID);
$arrTable = '`' . self::PAY_PERIOD_DB_TABLE . '`';
$insertFields[0] = '`' . self::PAY_PERIOD_DB_FIELD_ID . '`';
$insertFields[1] = '`' . self::PAY_PERIOD_DB_FIELD_START_DATE . '`';
$insertFields[2] = '`' . self::PAY_PERIOD_DB_FIELD_END_DATE . '`';
$insertFields[3] = '`' . self::PAY_PERIOD_DB_FIELD_CLOSE_DATE . '`';
$insertFields[4] = '`' . self::PAY_PERIOD_DB_FIELD_CHECK_DATE . '`';
$insertFields[5] = '`' . self::PAY_PERIOD_DB_FIELD_TIMESHEET_APROVAL_DUE_DATE . '`';
$arrRecordsList[0] = $this->id;
$arrRecordsList[1] = "'" . $this->startDate . "'";
$arrRecordsList[2] = "'" . $this->endDate . "'";
$arrRecordsList[3] = "'" . $this->closeDate . "'";
$arrRecordsList[4] = "'" . $this->checkDate . "'";
$arrRecordsList[5] = "'" . $this->timesheetAprovalDueDate . "'";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleInsert($arrTable, $arrRecordsList, $insertFields);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
/*if ($result) {
return mysql_affected_rows();
} else {
throw new HspPayPeriodException("Error in SQL Query", HspPayPeriodException::ERROR_IN_DB_QUERY);
}*/
return $result;
}
示例11: addHspRequest
public function addHspRequest()
{
$this->id = UniqueIDGenerator::getInstance()->getNextID(self::HSP_PAYMENT_REQUEST_DB_TABLE, self::DB_FIELD_ID);
$arrTable = '`' . self::HSP_PAYMENT_REQUEST_DB_TABLE . '`';
$insertFields[] = '`' . self::DB_FIELD_ID . '`';
$insertFields[] = '`' . self::DB_FIELD_HSP_ID . '`';
$insertFields[] = '`' . self::DB_FIELD_EMPLOYEE_ID . '`';
$insertFields[] = '`' . self::DB_FIELD_DATE_INCURRED . '`';
$insertFields[] = '`' . self::DB_FIELD_PROVIDER_NAME . '`';
$insertFields[] = '`' . self::DB_FIELD_PERSON_INCURRING_EXPENSE . '`';
$insertFields[] = '`' . self::DB_FIELD_EXPENSE_DESCRIPTION . '`';
$insertFields[] = '`' . self::DB_FIELD_EXPENSE_AMOUNT . '`';
$insertFields[] = '`' . self::DB_FIELD_PAYMENT_MADE_TO . '`';
$insertFields[] = '`' . self::DB_FIELD_THIRD_PARTY_ACCOUNT_NUMBER . '`';
$insertFields[] = '`' . self::DB_FIELD_MAIL_ADDRESS . '`';
$insertFields[] = '`' . self::DB_FIELD_COMMENTS . '`';
$insertFields[] = '`' . self::DB_FIELD_STATUS . '`';
$arrRecordsList[] = $this->id;
$arrRecordsList[] = "'" . $this->hspId . "'";
$arrRecordsList[] = "'" . $this->employeeId . "'";
$arrRecordsList[] = "'" . $this->dateIncurred . "'";
$arrRecordsList[] = "'" . $this->providerName . "'";
$arrRecordsList[] = "'" . $this->personIncurringExpense . "'";
$arrRecordsList[] = "'" . $this->expenseDescription . "'";
$arrRecordsList[] = "'" . $this->expenseAmount . "'";
$arrRecordsList[] = "'" . $this->paymentMadeTo . "'";
$arrRecordsList[] = "'" . $this->thirdPartyAccountNumber . "'";
$arrRecordsList[] = "'" . $this->mailAddress . "'";
$arrRecordsList[] = "'" . $this->comments . "'";
$arrRecordsList[] = "'" . $this->status . "'";
if ($this->datePaid != null) {
$insertFields[] = '`' . self::DB_FIELD_DATE_PAID . '`';
$arrRecordsList[] = "'" . $this->datePaid . "'";
}
if ($this->checkNumber != null) {
$insertFields[] = '`' . self::DB_FIELD_CHECK_NUMBER . '`';
$arrRecordsList[] = "'" . $this->checkNumber . "'";
}
if ($this->hrNotes != null) {
$insertFields[] = '`' . self::DB_FIELD_HR_NOTES . '`';
$arrRecordsList[] = "'" . $this->hrNotes . "'";
}
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleInsert($arrTable, $arrRecordsList, $insertFields);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
//if ($result) {
// return mysql_affected_rows();
//} else {
// throw new HspPaymentRequestException("Error in SQL Query", HspPaymentRequestException::ERROR_IN_DB_QUERY);
//}
if ($result) {
return true;
} else {
return false;
}
}
示例12: _addNotificationStatus
private function _addNotificationStatus()
{
$sqlQBuilder = new SQLQBuilder();
$arrFields[0] = '`user_id`';
$arrFields[1] = '`notification_type_id`';
$arrFields[2] = '`status`';
$insertValues[0] = "'{$this->getUserId()}'";
$insertValues[1] = "'{$this->getNotifcationTypeId()}'";
$insertValues[2] = $this->getNotificationStatus();
$arrTable = "`hs_hr_mailnotifications`";
$query = $sqlQBuilder->simpleInsert($arrTable, $insertValues, $arrFields, true);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
return $result;
}
示例13: addRecord
/**
*
*/
public function addRecord()
{
if (!isset($this->employeeId) || !isset($this->inDate) || !isset($this->inTime)) {
throw new AttendanceRecordException('Adding record: Required values are missing', AttendanceRecordException::ADDING_REQUIRED_VALUES_MISSING);
}
$insertTable = "`" . self::DB_TABLE . "`";
$insertFields[] = "`" . self::DB_FIELD_ATTENDANCE_ID . "`";
$insertValues[] = UniqueIDGenerator::getInstance()->getNextID(self::DB_TABLE, self::DB_FIELD_ATTENDANCE_ID);
$insertFields[] = "`" . self::DB_FIELD_EMPLOYEE_ID . "`";
$insertValues[] = "'{$this->employeeId}'";
$insertFields[] = "`" . self::DB_FIELD_PUNCHIN_TIME . "`";
$insertValues[] = "'{$this->inDate} {$this->inTime}'";
if (isset($this->inNote)) {
$insertFields[] = "`" . self::DB_FIELD_IN_NOTE . "`";
$insertValues[] = "'{$this->inNote}'";
}
$insertFields[] = "`" . self::DB_FIELD_TIMESTAMP_DIFF . "`";
$insertValues[] = "'{$this->timestampDiff}'";
$insertFields[] = "`" . self::DB_FIELD_STATUS . "`";
$insertValues[] = "'" . self::STATUS_ACTIVE . "'";
$sqlBuilder = new SQLQBuilder();
$query = $sqlBuilder->simpleInsert($insertTable, $insertValues, $insertFields);
$dbConnection = new DMLFunctions();
$result = $dbConnection->executeQuery($query);
if ($result) {
return true;
} else {
return false;
}
}