当前位置: 首页>>代码示例>>PHP>>正文


PHP DBQuery::addUpdate方法代码示例

本文整理汇总了PHP中DBQuery::addUpdate方法的典型用法代码示例。如果您正苦于以下问题:PHP DBQuery::addUpdate方法的具体用法?PHP DBQuery::addUpdate怎么用?PHP DBQuery::addUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBQuery的用法示例。


在下文中一共展示了DBQuery::addUpdate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setComplete

function setComplete($id)
{
    global $AppUI;
    $task = new CTask();
    if ($task->load($id)) {
        $q = new DBQuery();
        $q->addTable('user_tasks');
        $q->addQuery('user_id');
        $q->addWhere('task_id = ' . $id);
        $q->addWhere('user_id = ' . $AppUI->user_id);
        $r = $q->loadResult();
        if ($r != $AppUI->user_id) {
            $p = new CProject($task->task_project);
            if (!$p->project_id || $p->getManager() != $AppUI->user_id) {
                return 'Error';
            }
        }
        $q->addTable('tasks');
        $q->addUpdate('task_percent_complete', '100');
        $q->addWhere('task_id = ' . $id);
        $q->exec();
        return 'OK';
    }
    return 'Error';
}
开发者ID:n2i,项目名称:xvnkb,代码行数:25,代码来源:complete.php

示例2: updateContactCompany

function updateContactCompany($contact_array, $company_id)
{
    $q = new DBQuery();
    $q->addTable('contacts');
    $q->addUpdate('contact_company = ' . $company_id);
    $q->addWhere('contact_id = ' . $contact_array['contact_id']);
    db_exec($q->prepareUpdate());
}
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:8,代码来源:upgrade_contacts_company.php

示例3: testUpdateBD

 function testUpdateBD()
 {
     $q = new DBQuery();
     $q->addTable('eap');
     $q->addQuery("id,nome,linha,coluna");
     $q->addUpdate(nome, 'Dot Project');
     $q->addWhere("id = 1");
     $q->prepareUpdate();
     $this->assertEqual($q->exec(), true);
     $q->clear();
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:11,代码来源:test_eap.php

示例4: _deDynamicLeafNodes

 protected function _deDynamicLeafNodes($projectId)
 {
     $q = new DBQuery();
     $q->addUpdate('task_dynamic', 0);
     $q->addWhere("task_project = {$projectId}");
     $q->addTable('tasks');
     $q->exec();
     $q->addQuery('distinct(task_parent)');
     $q->addTable('tasks');
     $q->addWhere("task_project = {$projectId}");
     $q->addWhere("task_id <> task_parent");
     $taskList = $q->loadHashList();
     foreach ($taskList as $id => $nothing) {
         $dynamicTasks .= $id . ',';
     }
     $dynamicTasks .= '0';
     $q->clear();
     $q->addUpdate('task_dynamic', 1);
     $q->addWhere("task_project = {$projectId}");
     $q->addWhere("task_id IN ({$dynamicTasks})");
     $q->addTable('tasks');
     $q->exec();
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:23,代码来源:importers.class.php

示例5: sendNewPass

function sendNewPass()
{
    global $AppUI;
    $_live_site = dPgetConfig('base_url');
    $_sitename = dPgetConfig('company_name');
    // ensure no malicous sql gets past
    $checkusername = trim(dPgetParam($_POST, 'checkusername', ''));
    $checkusername = db_escape($checkusername);
    $confirmEmail = trim(dPgetParam($_POST, 'checkemail', ''));
    $confirmEmail = mb_strtolower(db_escape($confirmEmail));
    $q = new DBQuery();
    $q->addTable('users', 'u');
    $q->addQuery('u.user_id');
    $q->addWhere('user_username=\'' . $checkusername . '\' AND LOWER(contact_email)=\'' . $confirmEmail . '\'');
    $q->leftJoin('contacts', 'c', 'u.user_contact = c.contact_id');
    if (!($user_id = $q->loadResult()) || !$checkusername || !$confirmEmail) {
        $AppUI->setMsg('Invalid username or email.', UI_MSG_ERROR);
        $AppUI->redirect();
    }
    $newpass = makePass();
    $message = $AppUI->_('sendpass0', UI_OUTPUT_RAW) . ' ' . $checkusername . ' ' . $AppUI->_('sendpass1', UI_OUTPUT_RAW) . ' ' . $_live_site . ' ' . $AppUI->_('sendpass2', UI_OUTPUT_RAW) . ' ' . $newpass . ' ' . $AppUI->_('sendpass3', UI_OUTPUT_RAW);
    $subject = "{$_sitename} :: " . $AppUI->_('sendpass4', UI_OUTPUT_RAW) . " - {$checkusername}";
    $m = new Mail();
    // create the mail
    $m->From("dotProject@" . dPgetConfig('site_domain'));
    $m->To($confirmEmail);
    $m->Subject($subject);
    $m->Body($message, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : "");
    // set the body
    $m->Send();
    // send the mail
    $newpass = md5($newpass);
    $q->clear();
    $q->addTable('users');
    $q->addUpdate('user_password', $newpass, true);
    $q->addWhere('user_id=\'' . $user_id . '\'');
    $cur = $q->exec();
    if (!$cur) {
        die('SQL error' . $database->stderr(true));
    } else {
        $AppUI->setMsg('New User Password created and emailed to you');
        $AppUI->redirect();
    }
}
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:44,代码来源:sendpass.php

示例6: dPsessionWrite

function dPsessionWrite($id, $data)
{
    $q = new DBQuery();
    $q->addQuery('count(*) as row_count');
    $q->addTable('sessions');
    $q->addWhere("session_id = '{$id}'");
    if (($qid =& $q->exec()) && (@$qid->fields['row_count'] > 0 || @$qid->fields[0] > 0)) {
        dprint(__FILE__, __LINE__, 11, "Updating session {$id}");
        $q->query = null;
        $q->addUpdate('session_data', $data);
    } else {
        dprint(__FILE__, __LINE__, 11, "Creating new session {$id}");
        $q->query = null;
        $q->where = null;
        $q->addInsert('session_id', $id);
        $q->addInsert('session_data', $data);
        $q->addInsert('session_created', date('Y-m-d H:i:s'));
    }
    $q->exec();
    $q->clear();
    return true;
}
开发者ID:Esleelkartea,项目名称:gestion-de-primeras-muestras,代码行数:22,代码来源:session.php

示例7: updateLastAction

 /**
 *@Function for update table user_acces_log in field date_time_lost_action
 */
 function updateLastAction($last_insert_id)
 {
     $q = new DBQuery();
     $q->addTable('user_access_log');
     $q->addUpdate('date_time_last_action', date('Y-m-d H:i:s'));
     $q->addWhere("user_access_log_id = {$last_insert_id}");
     if ($last_insert_id > 0) {
         $q->exec();
         $q->clear();
     }
 }
开发者ID:klr2003,项目名称:sourceread,代码行数:14,代码来源:ui.class.php

示例8: dPgetParam

 $history_description = dPgetParam($_POST, 'history_description', '');
 $history_project = dPgetParam($_POST, 'history_project', '');
 $userid = $AppUI->user_id;
 if ($action == 'add') {
     $q->addTable('history');
     $q->addInsert('history_table', "history");
     $q->addInsert('history_action', "add");
     $q->addInsert('history_date', str_replace("'", '', $db->DBTimeStamp(time())));
     $q->addInsert('history_description', $history_description);
     $q->addInsert('history_user', $userid);
     $q->addInsert('history_project', $history_project);
     $okMsg = 'History added';
 } else {
     if ($action == 'update') {
         $q->addTable('history');
         $q->addUpdate('history_description', $history_description);
         $q->addUpdate('history_project', $history_project);
         $q->addWhere('history_id =' . $history_id);
         $okMsg = 'History updated';
     } else {
         if ($action == 'del') {
             $q->setDelete('history');
             $q->addWhere('history_id =' . $history_id);
             $okMsg = 'History deleted';
         }
     }
 }
 if (!$q->exec()) {
     $AppUI->setMsg(db_error());
 } else {
     $AppUI->setMsg($okMsg);
开发者ID:n2i,项目名称:xvnkb,代码行数:31,代码来源:addedit.php

示例9: DBQuery

 function commit_updates()
 {
     $q = new DBQuery();
     if (count($this->delete_list)) {
         $q->setDelete($this->table);
         $q->addWhere("queue_id in (" . implode(',', $this->delete_list) . ")");
         $q->exec();
         $q->clear();
     }
     $this->delete_list = array();
     foreach ($this->update_list as $fields) {
         $q->addTable($this->table);
         $q->addUpdate('queue_repeat_count', $fields['queue_repeat_count']);
         $q->addUpdate('queue_start', $fields['queue_start']);
         $q->addWhere('queue_id = ' . $fields['queue_id']);
         $q->exec();
         $q->clear();
     }
     $this->update_list = array();
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:20,代码来源:event_queue.class.php

示例10: DBQuery

            $q = new DBQuery();
            $q->addTable('tasks');
            $q->addUpdate('task_percent_complete', '100');
            $q->addWhere('task_id=' . (int) $val);
        } else {
            if ($task_priority == 'd') {
                // delete task
                $q = new DBQuery();
                $q->setDelete('tasks');
                $q->addWhere('task_id=' . (int) $val);
            } else {
                if ($task_priority > -2 && $task_priority < 2) {
                    // set priority
                    $q = new DBQuery();
                    $q->addTable('tasks');
                    $q->addUpdate('task_priority', $task_priority);
                    $q->addWhere('task_id=' . (int) $val);
                }
            }
        }
        $q->exec();
        echo db_error();
        $q->clear();
    }
}
$AppUI->savePlace();
$proj = new CProject();
$tobj = new CTask();
$allowedProjects = $proj->getAllowedSQL($AppUI->user_id, 'pr.project_id');
$allowedTasks = $tobj->getAllowedSQL($AppUI->user_id, 'ta.task_id');
// query my sub-tasks (ignoring task parents)
开发者ID:joly,项目名称:web2project,代码行数:31,代码来源:todo.php

示例11: htmlentities

     $ed = $ed->format(FMT_DATETIME_MYSQL);
 }
 $task_name = htmlentities(stripslashes($_POST['task_name']), ENT_QUOTES);
 $task_dynamic = isset($_POST['task_dynamic']) ? 1 : 0;
 $task_milestone = isset($_POST['task_milestone']) ? 1 : 0;
 $task_status = isset($_POST['task_status']) ? 0 : -1;
 $task_creator = isset($_POST['task_creator']) ? $_POST['task_creator'] : $AppUI->user_id;
 $q = new DBQuery();
 $q->addTable('tasks');
 $values = array($task_name, $_POST['task_parent'], $_POST['task_project'], $task_creator, $sd, $_POST['task_duration'], 1, $ed, htmlentities(stripslashes($_POST['task_description']), ENT_QUOTES), $_POST['task_priority'], $task_creator, 0, 0, $task_dynamic, 0, 0, 0, $task_milestone, $task_status);
 $fields = 'task_name,task_parent,task_project,task_owner,' . 'task_start_date,task_duration,task_duration_type,task_end_date,task_description,' . 'task_priority,task_creator,task_order,task_client_publish,' . 'task_dynamic,task_access,task_notify,task_type,task_milestone,task_status';
 if ($task_id <= 0) {
     $q->addInsert($fields, $values, true);
     $AppUI->setMsg('Task <br/>[' . $task_name . ']<br/>has been added', UI_MSG_OK);
 } else {
     $q->addUpdate($fields, $values, true);
     $q->addWhere('task_id = ' . $task_id);
     $AppUI->setMsg('Task <br/>[' . $task_name . ']<br/>has been updated', UI_MSG_OK);
 }
 $q->exec();
 if ($task_id <= 0) {
     $q->clear();
     $q->addTable('tasks');
     $q->addQuery('task_id');
     $q->addWhere('task_name = "' . $task_name . '"');
     $q->addWhere('task_project = ' . $_POST['task_project']);
     $q->addWhere('task_creator = ' . $AppUI->user_id);
     $task_id = $q->loadResult();
 }
 db_exec('DELETE FROM user_tasks WHERE task_id = ' . $task_id);
 if (is_array($_POST['task_members'])) {
开发者ID:n2i,项目名称:xvnkb,代码行数:31,代码来源:simpleaddedit.php

示例12: store

 function store()
 {
     $q = new DBQuery();
     $q->addQuery('billingcode_id');
     $q->addTable('billingcode');
     $q->addWhere("billingcode_name = '" . $this->billingcode_name . "'");
     $q->addWhere('company_id = ' . $this->company_id);
     $found_id = $q->loadResult();
     if ($found_id && $found_id != $this->_billingcode_id) {
         return 'Billing Code::code already exists';
     } else {
         if ($this->_billingcode_id) {
             $q->addTable('billingcode');
             $q->addUpdate('billingcode_desc', $this->billingcode_desc);
             $q->addUpdate('billingcode_name', $this->billingcode_name);
             $q->addUpdate('billingcode_value', $this->billingcode_value);
             $q->addUpdate('billingcode_status', $this->billingcode_status);
             $q->addUpdate('company_id', $this->company_id);
             $q->addWhere('billingcode_id = ' . $this->_billingcode_id);
             $q->exec();
             $q->clear();
         } else {
             if (!($ret = db_insertObject('billingcode', $this, 'billingcode_id'))) {
                 return 'Billing Code::store failed <br />' . db_error();
             } else {
                 return NULL;
             }
         }
     }
 }
开发者ID:illuminate3,项目名称:dotproject,代码行数:30,代码来源:system.class.php

示例13: 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;
 }
开发者ID:joly,项目名称:web2project,代码行数:33,代码来源:forums.class.php

示例14: updateLastAction

 /**
  *@Function for update table user_acces_log in field date_time_lost_action
  */
 public function updateLastAction($last_insert_id)
 {
     $q = new DBQuery();
     $q->addTable('user_access_log');
     $q->addUpdate('date_time_last_action', $q->dbfnNow(), false, true);
     $q->addWhere('user_access_log_id = ' . $last_insert_id);
     if ($last_insert_id > 0) {
         $q->exec();
         $q->clear();
     }
 }
开发者ID:joly,项目名称:web2project,代码行数:14,代码来源:ui.class.php

示例15: DBQuery

if (!$file_id) {
    $obj->file_owner = $AppUI->user_id;
    if (!$obj->file_version_id) {
        $q = new DBQuery();
        $q->addTable('files');
        $q->addQuery('file_version_id');
        $q->addOrder('file_version_id DESC');
        $q->setLimit(1);
        $sql = $q->prepare();
        $q->clear();
        $latest_file_version = db_loadResult($sql);
        $obj->file_version_id = $latest_file_version + 1;
    } else {
        $q = new DBQuery();
        $q->addTable('files');
        $q->addUpdate('file_checkout', '');
        $q->addWhere("file_version_id = {$obj->file_version_id}");
        $q->exec();
        $q->clear();
    }
}
if ($msg = $obj->store()) {
    $AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
    $obj->load($obj->file_id);
    if ($not == '1') {
        $obj->notify();
    }
    $AppUI->setMsg($file_id ? 'updated' : 'added', UI_MSG_OK, true);
    /* Workaround for indexing large files:
     ** Based on the value defined in config data,
开发者ID:Esleelkartea,项目名称:gestion-de-primeras-muestras,代码行数:31,代码来源:do_file_aed.php


注:本文中的DBQuery::addUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。