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


PHP DBQuery::addWhere方法代码示例

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


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

示例1: getProjectTaskLinksByCategory

 public function getProjectTaskLinksByCategory($AppUI, $project_id = 0, $task_id = 0, $category_id = 0, $search = '')
 {
     // load the following classes to retrieved denied records
     $project = new CProject();
     $task = new CTask();
     // SETUP FOR LINK LIST
     $q = new DBQuery();
     $q->addQuery('links.*');
     $q->addQuery('contact_first_name, contact_last_name');
     $q->addQuery('project_name, project_color_identifier, project_status');
     $q->addQuery('task_name, task_id');
     $q->addTable('links');
     $q->leftJoin('users', 'u', 'user_id = link_owner');
     $q->leftJoin('contacts', 'c', 'user_contact = contact_id');
     if ($search != '') {
         $q->addWhere('(link_name LIKE \'%' . $search . '%\' OR link_description LIKE \'%' . $search . '%\')');
     }
     if ($project_id > 0) {
         // Project
         $q->addWhere('link_project = ' . (int) $project_id);
     }
     if ($task_id > 0) {
         // Task
         $q->addWhere('link_task = ' . (int) $task_id);
     }
     if ($category_id >= 0) {
         // Category
         $q->addWhere('link_category = ' . $category_id);
     }
     // Permissions
     $project->setAllowedSQL($AppUI->user_id, $q, 'link_project');
     $task->setAllowedSQL($AppUI->user_id, $q, 'link_task and task_project = link_project');
     $q->addOrder('project_name, link_name');
     return $q->loadList();
 }
开发者ID:joly,项目名称:web2project,代码行数:35,代码来源:links.class.php

示例2: 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

示例3: DBQuery

 function _buildQuery()
 {
     $q = new DBQuery();
     $q->addTable($this->table);
     $q->addQuery('task_id');
     $q->addQuery('task_name');
     $q->addWhere('task_project != 0');
     $sql = '';
     foreach ($this->search_fields as $field) {
         $sql .= " {$field} LIKE '%{$this->keyword}%' or ";
     }
     $sql = substr($sql, 0, -4);
     $q->addWhere("({$sql})");
     return $q->prepare(true);
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:15,代码来源:tasks.inc.php

示例4: getCompanyDepartment

function getCompanyDepartment($company_id)
{
    global $AppUI;
    $q = new DBQuery();
    $q->addTable('companies');
    $q->addQuery('company_name');
    $q->addWhere('company_id = ' . $company_id);
    $company_name = $q->loadResult();
    if (!$company_name) {
        $AppUI->setMsg('Company not found', UI_MSG_ERROR);
        echo $AppUI->getMsg();
        return;
    }
    $q->addTable('departments');
    $q->addQuery('dept_id,dept_parent,dept_name');
    $q->addWhere('dept_company = ' . $company_id);
    $q->addOrder('dept_parent, dept_name');
    $depts = $q->loadHashList('dept_id');
    if (!$depts) {
        $AppUI->setMsg('Company [ ' . $company_name . ' ] has no department', UI_MSG_WARNING);
        echo $AppUI->getMsg();
        return;
    }
    include 'modules/public/resources.info.php';
}
开发者ID:n2i,项目名称:xvnkb,代码行数:25,代码来源:viewinfo.php

示例5: 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();
            }
        }
    }
}
开发者ID:klr2003,项目名称:sourceread,代码行数:36,代码来源:tasks_dosql.addedit.php

示例6: delete

 function delete()
 {
     $q = new DBQuery();
     $q->addTable('departments', 'dep');
     $q->addQuery('dep.*');
     $q->addWhere('dep.dept_parent = ' . $this->dept_id);
     $res = $q->exec();
     if (db_num_rows($res)) {
         $q->clear();
         return "deptWithSub";
     }
     $q->clear();
     $q->addTable('projects', 'p');
     $q->addQuery('p.*');
     $q->addWhere('p.project_department = ' . $this->dept_id);
     $res = $q->exec();
     if (db_num_rows($res)) {
         $q->clear();
         return "deptWithProject";
     }
     // $sql = "DELETE FROM departments WHERE dept_id = $this->dept_id";
     $q->clear();
     $q->addQuery('*');
     $q->setDelete('departments');
     $q->addWhere('dept_id = ' . $this->dept_id);
     if (!$q->exec()) {
         $result = db_error();
     } else {
         $result = NULL;
     }
     $q->clear();
     return $result;
 }
开发者ID:n2i,项目名称:xvnkb,代码行数:33,代码来源:departments.class.php

示例7: DBQuery

 function _buildQuery()
 {
     $q = new DBQuery();
     $q->addTable($this->table);
     $q->addTable('files');
     $q->addQuery('*');
     $q->addWhere("files.file_id = {$this->table}.file_id");
     $sql = '';
     foreach ($this->search_fields as $field) {
         $sql .= " {$field} LIKE '%{$this->keyword}%' or ";
     }
     $sql = substr($sql, 0, -4);
     $q->addWhere("({$sql})");
     $q->addGroup('files.file_id');
     return $q->prepare(true);
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:16,代码来源:files_content.inc.php

示例8: checkCompanyId

function checkCompanyId($company_id)
{
    $q = new DBQuery();
    $q->addTable('companies');
    $q->addQuery('count(*)');
    $q->addWhere("company_id = '{$company_id}'");
    return db_loadResult($q->prepare());
}
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:8,代码来源:upgrade_contacts_company.php

示例9: remove

 public function remove()
 {
     $q = new DBQuery();
     $q->setDelete('modules');
     $q->addWhere("mod_directory = 'importers'");
     $q->exec();
     return true;
 }
开发者ID:hoodoogurus,项目名称:dotprojecteap,代码行数:8,代码来源:setup.php

示例10: 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

示例11: remove

 function remove()
 {
     $q = new DBQuery();
     $q->dropTable('links');
     $q->exec();
     $q->clear();
     $q->setDelete('sysvals');
     $q->addWhere('sysval_title = \'LinkType\'');
     $q->exec();
 }
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:10,代码来源:setup.php

示例12: 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

示例13: listCompaniesByType

 function listCompaniesByType($type)
 {
     global $AppUI;
     $q = new DBQuery();
     $q->addQuery('company_id, company_name');
     $q->addTable('companies');
     foreach ($type as $t) {
         $q->addWhere('company_type =' . $t);
     }
     $this->setAllowedSQL($AppUI->user_id, $q);
     $q->addOrder('company_name');
     return $q->loadHashList();
 }
开发者ID:srinivasulurao,项目名称:jonel,代码行数:13,代码来源:companies.classOld.php

示例14: 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;
 }
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:13,代码来源:links.class.php

示例15: DBQuery

 function _buildQuery()
 {
     $q = new DBQuery();
     $q->addTable($this->table);
     $q->addQuery('ticket');
     $q->addQuery('subject');
     $sql = '';
     foreach ($this->search_fields as $field) {
         $sql .= " {$field} LIKE '%{$this->keyword}%' or ";
     }
     $sql = substr($sql, 0, -4);
     $q->addWhere($sql);
     return $q->prepare(true);
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:14,代码来源:tickets.inc.php


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