本文整理汇总了PHP中DB_Helper::buildList方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_Helper::buildList方法的具体用法?PHP DB_Helper::buildList怎么用?PHP DB_Helper::buildList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_Helper
的用法示例。
在下文中一共展示了DB_Helper::buildList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
/**
* Method used to remove user-selected categories from the
* database.
*
* @return boolean Whether the removal worked or not
*/
public static function remove()
{
$items = $_POST['items'];
$stmt = 'DELETE FROM
{{%project_category}}
WHERE
prc_id IN (' . DB_Helper::buildList($items) . ')';
try {
DB_Helper::getInstance()->query($stmt, $items);
} catch (DbException $e) {
return false;
}
return true;
}
示例2: remove
/**
* Method used to remove a specific list of checkins
*
* @param int[] $items list to remove
* @return integer 1 if the update worked, -1 otherwise
*/
public static function remove($items)
{
$itemlist = DB_Helper::buildList($items);
$stmt = "SELECT\n isc_iss_id\n FROM\n {{%issue_checkin}}\n WHERE\n isc_id IN ({$itemlist})";
$issue_id = DB_Helper::getInstance()->getOne($stmt, $items);
$stmt = "DELETE FROM\n {{%issue_checkin}}\n WHERE\n isc_id IN ({$itemlist})";
try {
DB_Helper::getInstance()->query($stmt, $items);
} catch (DbException $e) {
return -1;
}
// need to mark this issue as updated
Issue::markAsUpdated($issue_id);
$usr_id = Auth::getUserID();
History::add($issue_id, $usr_id, 'scm_checkin_removed', 'SCM Checkins removed by {user}', array('user' => User::getFullName($usr_id)));
return 1;
}
示例3: remove
/**
* Method used to remove resolutions by using the administrative
* interface of the system.
*
* @return boolean
*/
public static function remove()
{
$items = $_POST['items'];
$itemlist = DB_Helper::buildList($items);
// gotta fix the issues before removing the resolution
$stmt = "UPDATE\n {{%issue}}\n SET\n iss_res_id=0\n WHERE\n iss_res_id IN ({$itemlist})";
try {
DB_Helper::getInstance()->query($stmt, $items);
} catch (DbException $e) {
return false;
}
$stmt = "DELETE FROM\n {{%resolution}}\n WHERE\n res_id IN ({$itemlist})";
try {
DB_Helper::getInstance()->query($stmt, $items);
} catch (DbException $e) {
return false;
}
return true;
}
示例4: removeRepliers
/**
* Removes the specified authorized replier
*
* @param integer[] $iur_ids The ids of the authorized repliers
* @return int
*/
public static function removeRepliers($iur_ids)
{
$iur_list = DB_Helper::buildList($iur_ids);
// get issue_id for logging
$stmt = "SELECT\n iur_iss_id\n FROM\n {{%issue_user_replier}}\n WHERE\n iur_id IN ({$iur_list})";
try {
$issue_id = DB_Helper::getInstance()->getOne($stmt, $iur_ids);
} catch (DbException $e) {
return false;
}
foreach ($iur_ids as $id) {
$replier = self::getReplier($id);
$stmt = "DELETE FROM\n {{%issue_user_replier}}\n WHERE\n iur_id IN ({$iur_list})";
try {
DB_Helper::getInstance()->query($stmt, $iur_ids);
} catch (DbException $e) {
return -1;
}
$usr_id = Auth::getUserID();
History::add($issue_id, $usr_id, 'replier_removed', 'Authorized replier {replier} removed by {user}', array('replier' => $replier, 'user' => User::getFullName($usr_id)));
return 1;
}
}
示例5: remove
public static function remove($ids)
{
$sql = 'DELETE FROM
{{%product}}
WHERE
pro_id IN (' . DB_Helper::buildList($ids) . ')';
try {
DB_Helper::getInstance()->query($sql, $ids);
} catch (DbException $e) {
return -1;
}
return 1;
}
示例6: removeNotes
/**
* Removes the selected notes from the database.
*
* @param array $ids An array of cno_id's to be deleted.
* @return int
*/
public static function removeNotes($ids)
{
$stmt = 'DELETE FROM
{{%customer_note}}
WHERE
cno_id IN (' . DB_Helper::buildList($ids) . ')';
try {
DB_Helper::getInstance()->query($stmt, $ids);
} catch (DbException $e) {
return -1;
}
return 1;
}
示例7: remove
/**
* Method used to remove user-selected priorities from the
* database.
*
* @param array $sev_ids Severity ids to remove
* @return boolean Whether the removal worked or not
*/
public static function remove($sev_ids)
{
if (count($sev_ids) < 1) {
return true;
}
$items = DB_Helper::buildList($sev_ids);
$sql = "DELETE FROM\n {{%project_severity}}\n WHERE\n sev_id IN ({$items})";
try {
DB_Helper::getInstance()->query($sql, $sev_ids);
} catch (DbException $e) {
return false;
}
return true;
}
示例8: remove
/**
* Method used to remove reminder conditions by using the administrative
* interface of the system.
*
* @return boolean
*/
public static function remove()
{
$items = $_POST['items'];
$stmt = 'DELETE FROM
{{%reminder_level_condition}}
WHERE
rlc_id IN (' . DB_Helper::buildList($items) . ')';
DB_Helper::getInstance()->query($stmt, $items);
}
示例9: removeUserByProjects
/**
* Method used to remove all project/user associations for a given
* set of projects.
*
* @param array $ids The project IDs
* @param array $users_to_not_remove Users that should not be removed
* @return boolean
*/
public static function removeUserByProjects($ids, $users_to_not_remove = null)
{
$stmt = 'DELETE FROM
{{%project_user}}
WHERE
pru_prj_id IN (' . DB_Helper::buildList($ids) . ')';
$params = $ids;
if ($users_to_not_remove) {
$stmt .= " AND\n pru_usr_id NOT IN (" . DB_Helper::buildList($users_to_not_remove) . ')';
$params = array_merge($params, $users_to_not_remove);
}
try {
DB_Helper::getInstance()->query($stmt, $params);
} catch (DbException $e) {
return false;
}
return true;
}
示例10: changeStatus
/**
* Method used to change the status of users, making them inactive
* or active.
*
* @param int[] $usr_ids
* @param string $status
* @return boolean
*/
public static function changeStatus($usr_ids, $status)
{
// check if the user being inactivated is the last one
if ($status == self::USER_STATUS_INACTIVE) {
$stmt = 'SELECT
COUNT(*)
FROM
{{%user}}
WHERE
usr_status=?';
$total_active = DB_Helper::getInstance()->getOne($stmt, array(self::USER_STATUS_ACTIVE));
if ($total_active < 2) {
return false;
}
}
$usr_ids = (array) $usr_ids;
$items = DB_Helper::buildList($usr_ids);
$stmt = "UPDATE\n {{%user}}\n SET\n usr_status=?\n WHERE\n usr_id IN ({$items})";
$params = array_merge(array($status), $usr_ids);
try {
DB_Helper::getInstance()->query($stmt, $params);
} catch (DbException $e) {
return false;
}
return true;
}
示例11: remove
/**
* Method used to remove user-selected priorities from the
* database.
*
* @return boolean Whether the removal worked or not
*/
public static function remove()
{
$items = $_POST['items'];
$itemlist = DB_Helper::buildList($items);
$stmt = "DELETE FROM\n {{%project_priority}}\n WHERE\n pri_id IN ({$itemlist})";
try {
DB_Helper::getInstance()->query($stmt, $items);
} catch (DbException $e) {
return false;
}
return true;
}
示例12: associateFiles
/**
* Associate uploaded files to an "attachment".
* Additionally cleanups stale uploads.
*
* @param int $attachment_id
* @param int[] $iaf_ids
*/
private static function associateFiles($attachment_id, $iaf_ids)
{
// TODO: verify that all $iaf_ids actually existed, not expired
$list = DB_Helper::buildList($iaf_ids);
$stmt = "UPDATE {{%issue_attachment_file}} SET iaf_iat_id=? WHERE iaf_id in ({$list})";
$params = $iaf_ids;
array_unshift($params, $attachment_id);
DB_Helper::getInstance()->query($stmt, $params);
// run cleanup of stale uploads
$stmt = "DELETE FROM {{%issue_attachment_file}} WHERE iaf_iat_id=0 AND iaf_created_date>'0000-00-00 00:00:00' AND iaf_created_date < ?";
$expire_date = time() - self::ATTACHMENT_EXPIRE_TIME;
$params = array(Date_Helper::convertDateGMT($expire_date));
DB_Helper::getInstance()->query($stmt, $params);
}
示例13: removeByProjects
/**
* Method used to remove all custom fields associated with
* a given set of projects.
*
* @param array $ids The array of project IDs
* @return boolean
*/
public static function removeByProjects($ids)
{
$stmt = 'DELETE FROM
{{%project_custom_field}}
WHERE
pcf_prj_id IN (' . DB_Helper::buildList($ids) . ')';
try {
DB_Helper::getInstance()->query($stmt, $ids);
} catch (DbException $e) {
return false;
}
return true;
}
示例14: removeProjectAssociations
/**
* Method used to remove the project associations for a given
* email response entry.
*
* @param integer $ere_id The email response ID
* @param integer $prj_id The project ID
* @return boolean
*/
public function removeProjectAssociations($ere_id, $prj_id = null)
{
if (!is_array($ere_id)) {
$ere_id = array($ere_id);
}
$stmt = 'DELETE FROM
{{%project_email_response}}
WHERE
per_ere_id IN (' . DB_Helper::buildList($ere_id) . ')';
$params = $ere_id;
if ($prj_id) {
$stmt .= ' AND per_prj_id=?';
$params[] = $prj_id;
}
try {
DB_Helper::getInstance()->query($stmt, $params);
} catch (DbException $e) {
return false;
}
return true;
}
示例15: getMessageRecipients
public static function getMessageRecipients($types, $type_id)
{
if (!is_array($types)) {
$types = array($types);
}
$types_list = DB_Helper::buildList($types);
$sql = "SELECT\n maq_recipient\n FROM\n {{%mail_queue}}\n WHERE\n maq_type IN ({$types_list}) AND\n maq_type_id = ?";
$params = $types;
$params[] = $type_id;
try {
$res = DB_Helper::getInstance()->getColumn($sql, $params);
} catch (DbException $e) {
return false;
}
foreach ($res as &$row) {
// FIXME: what does quote stripping fix here
$row = Mime_Helper::decodeAddress(str_replace('"', '', $row));
}
return $res;
}