本文整理汇总了PHP中DBQuery::setDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP DBQuery::setDelete方法的具体用法?PHP DBQuery::setDelete怎么用?PHP DBQuery::setDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBQuery
的用法示例。
在下文中一共展示了DBQuery::setDelete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
function delete()
{
global $dPconfig;
$this->_message = "deleted";
addHistory('files', $this->file_id, 'delete', $this->file_name, $this->file_project);
// remove the file from the file system
@unlink("{$dPconfig['root_dir']}/files/{$this->file_project}/{$this->file_real_filename}");
// delete any index entries
$q = new DBQuery();
$q->setDelete('files_index');
$q->addQuery('*');
$q->addWhere("file_id = {$this->file_id}");
if (!$q->exec()) {
$q->clear();
return db_error();
}
// delete the main table reference
$q->clear();
$q->setDelete('files');
$q->addQuery('*');
$q->addWhere("file_id = {$this->file_id}");
if (!$q->exec()) {
$q->clear();
return db_error();
}
$q->clear();
return NULL;
}
示例2: resource_postsave
/**
* postsave functions are only called after a succesful save. They are
* used to perform database operations after the event.
*/
function resource_postsave()
{
global $other_resources;
global $obj;
$task_id = $obj->task_id;
dprint(__FILE__, __LINE__, 5, "saving resources, {$other_resources}");
if (isset($other_resources)) {
$value = array();
$reslist = explode(';', $other_resources);
foreach ($reslist as $res) {
if ($res) {
list($resource, $perc) = explode('=', $res);
$value[] = array($task_id, $resource, $perc);
}
}
// first delete any elements already there, then replace with this
// list.
$q = new DBQuery();
$q->setDelete('resource_tasks');
$q->addWhere('task_id = ' . $obj->task_id);
$q->exec();
$q->clear();
if (count($value)) {
foreach ($value as $v) {
$q->addTable('resource_tasks');
$q->addInsert('task_id,resource_id,percent_allocated', $v, true);
$q->exec();
$q->clear();
}
}
}
}
示例3: remove
public function remove()
{
$q = new DBQuery();
$q->setDelete('modules');
$q->addWhere("mod_directory = 'importers'");
$q->exec();
return true;
}
示例4: remove
function remove()
{
$q = new DBQuery();
$q->dropTable('links');
$q->exec();
$q->clear();
$q->setDelete('sysvals');
$q->addWhere('sysval_title = \'LinkType\'');
$q->exec();
}
示例5: testDeleteBD
function testDeleteBD()
{
$q = new DBQuery();
$q->addTable('eap');
$q->setDelete('eap');
$q->addWhere("nome ='Build Teste'");
$q->prepareDelete();
$this->assertEqual($q->exec(), true);
$q->clear();
}
示例6: delete
function delete()
{
$q = new DBQuery();
$q->setDelete('risks');
$q->addWhere('risk_id = ' . $this->risk_id);
if (!$q->exec()) {
return db_error();
} else {
return null;
}
}
示例7: delete
function delete()
{
global $dPconfig;
$this->_message = "deleted";
// delete the main table reference
$q = new DBQuery();
$q->setDelete('links');
$q->addWhere('link_id = ' . $this->link_id);
if (!$q->exec()) {
return db_error();
}
return NULL;
}
示例8: delete
function delete($oid = NULL)
{
$id = $this->user_id;
$result = parent::delete($oid);
if (!$result) {
$acl =& $GLOBALS['AppUI']->acl();
$acl->deleteLogin($id);
$q = new DBQuery();
$q->setDelete('user_preferences');
$q->addWhere('pref_user = ' . $this->user_id);
$q->exec();
$q->clear();
}
return $result;
}
示例9: unpinUserTask
public static function unpinUserTask($userId, $taskId)
{
$q = new DBQuery();
$q->setDelete('user_task_pin');
$q->addWhere('user_id = ' . (int) $userId);
$q->addWhere('task_id = ' . (int) $taskId);
if (!$q->exec()) {
return 'Error unpinning task';
} else {
return true;
}
}
示例10: store
function store()
{
$this->dPTrimAll();
$msg = $this->check();
if ($msg) {
return get_class($this) . '::store-check failed - ' . $msg;
}
if ($this->project_id) {
$ret = db_updateObject('projects', $this, 'project_id', false);
addHistory('projects', $this->project_id, 'update', $this->project_name, $this->project_id);
} else {
$ret = db_insertObject('projects', $this, 'project_id');
addHistory('projects', $this->project_id, 'add', $this->project_name, $this->project_id);
}
//split out related departments and store them seperatly.
$q = new DBQuery();
$q->setDelete('project_departments');
$q->addWhere('project_id=' . $this->project_id);
$q->exec();
$q->clear();
if ($this->project_departments) {
$departments = explode(',', $this->project_departments);
foreach ($departments as $department) {
$q->addTable('project_departments');
$q->addInsert('project_id', $this->project_id);
$q->addInsert('department_id', $department);
$q->exec();
$q->clear();
}
}
//split out related contacts and store them seperatly.
$q->setDelete('project_contacts');
$q->addWhere('project_id=' . $this->project_id);
$q->exec();
$q->clear();
if ($this->project_contacts) {
$contacts = explode(',', $this->project_contacts);
foreach ($contacts as $contact) {
if ($contact) {
$q->addTable('project_contacts');
$q->addInsert('project_id', $this->project_id);
$q->addInsert('contact_id', $contact);
$q->exec();
$q->clear();
}
}
}
return !$ret ? get_class($this) . '::store failed <br />' . db_error() : NULL;
}
示例11: delete
public function delete()
{
$q = new DBQuery();
$q->setDelete('forum_visits');
$q->addWhere('visit_message = ' . (int) $this->message_id);
$q->exec();
// No error if this fails, it is not important.
$q->clear();
$q->addTable('forum_messages');
$q->addQuery('message_forum');
$q->addWhere('message_id = ' . (int) $this->message_id);
$forumId = $q->loadResult();
$q->clear();
$q->setDelete('forum_messages');
$q->addWhere('message_id = ' . (int) $this->message_id);
if (!$q->exec()) {
$result = db_error();
} else {
$result = null;
}
$q->clear();
$q->addTable('forum_messages');
$q->addQuery('COUNT(message_id)');
$q->addWhere('message_forum = ' . (int) $forumId);
$messageCount = $q->loadResult();
$q->clear();
$q->addTable('forums');
$q->addUpdate('forum_message_count', $messageCount);
$q->addWhere('forum_id = ' . (int) $forumId);
$q->exec();
$q->clear();
return $result;
}
示例12: delete
/**
* Default delete method
*
* Can be overloaded/supplemented by the child class
* @return null|string null if successful otherwise returns and error message
*/
function delete($oid = null, $history_desc = '', $history_proj = 0)
{
$k = $this->_tbl_key;
if ($oid) {
$this->{$k} = intval($oid);
}
if (!$this->canDelete($msg)) {
return $msg;
}
$q = new DBQuery();
$q->setDelete($this->_tbl);
$q->addWhere($this->_tbl_key . " = '" . $this->{$k} . "'");
$result = !$q->exec() ? db_error() : null;
if (!$result) {
// only record history if deletion actually occurred
addHistory($this->_tbl, $this->{$k}, 'delete', $history_desc, $history_proj);
}
$q->clear();
return $result;
}
示例13: DBQuery
$cols = 13;
/****
// Let's figure out which tasks are selected
*/
$q = new DBQuery();
$pinned_only = intval(w2PgetParam($_GET, 'pinned', 0));
if (isset($_GET['pin'])) {
$pin = intval(w2PgetParam($_GET, 'pin', 0));
$msg = '';
// load the record data
if ($pin) {
$q->addTable('user_task_pin');
$q->addInsert('user_id', $AppUI->user_id);
$q->addInsert('task_id', $task_id);
} else {
$q->setDelete('user_task_pin');
$q->addWhere('user_id = ' . (int) $AppUI->user_id);
$q->addWhere('task_id = ' . (int) $task_id);
}
if (!$q->exec()) {
$AppUI->setMsg('ins/del err', UI_MSG_ERROR, true);
} else {
$q->clear();
}
$AppUI->redirect('', -1);
}
$AppUI->savePlace();
$durnTypes = w2PgetSysVal('TaskDurationType');
$taskPriority = w2PgetSysVal('TaskPriority');
$task_project = $project_id;
$task_sort_item1 = w2PgetParam($_GET, 'task_sort_item1', '');
示例14: updateAssigned
function updateAssigned($assigned)
{
// First remove the assigned from the user_events table
global $AppUI;
$q = new DBQuery();
$q->setDelete('user_events');
$q->addWhere('event_id = ' . $this->event_id);
$q->exec();
$q->clear();
if (is_array($assigned) && count($assigned)) {
foreach ($assigned as $uid) {
if ($uid) {
$q->addTable('user_events', 'ue');
$q->addInsert('event_id', $this->event_id);
$q->addInsert('user_id', $uid);
$q->exec();
$q->clear();
}
}
if ($msg = db_error()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
}
}
}
示例15: delete
function delete()
{
$q = new DBQuery();
$q->setDelete('custom_fields_lists');
$q->addWhere("field_id = {$this->field_id}");
$q->exec();
$q->clear();
}