本文整理汇总了PHP中SQLQBuilder::quoteCorrect方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLQBuilder::quoteCorrect方法的具体用法?PHP SQLQBuilder::quoteCorrect怎么用?PHP SQLQBuilder::quoteCorrect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLQBuilder
的用法示例。
在下文中一共展示了SQLQBuilder::quoteCorrect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例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;
}