當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBQuery類代碼示例

本文整理匯總了PHP中DBQuery的典型用法代碼示例。如果您正苦於以下問題:PHP DBQuery類的具體用法?PHP DBQuery怎麽用?PHP DBQuery使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DBQuery類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

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

示例2: createTables

 /**
  * This creates all the tables as defined in self::$required_tables
  */
 public function createTables()
 {
     foreach (self::$required_tables as $statement) {
         $query = new DBQuery($statement);
         $query->execute();
     }
 }
開發者ID:aber-cs22120-group-15,項目名稱:TaskerMAN,代碼行數:10,代碼來源:Install.class.php

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

示例4: 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:srinivasulurao,項目名稱:jonel,代碼行數:33,代碼來源:departments.class.php

示例5: remove

 function remove()
 {
     $q = new DBQuery();
     $q->dropTable('projects_statistics');
     $q->exec();
     $q->clear();
     return null;
 }
開發者ID:slawekmikula,項目名稱:dotproject,代碼行數:8,代碼來源:setup.php

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

示例7: insertCompany

function insertCompany($company_name)
{
    $q = new DBQuery();
    $q->addTable("companies");
    $q->addInsert('company_name', $company_name);
    db_exec($q->prepareInsert());
    return db_insert_id();
}
開發者ID:hoodoogurus,項目名稱:dotprojecteap,代碼行數:8,代碼來源:upgrade_contacts_company.php

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

示例9: bind

 public function bind($hash)
 {
     if (!is_array($hash)) {
         return get_class($this) . "::bind failed";
     } else {
         $q = new DBQuery();
         $q->bindHashToObject($hash, $this);
         $q->clear();
         return null;
     }
 }
開發者ID:joly,項目名稱:web2project,代碼行數:11,代碼來源:roles.class.php

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

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

示例12: _buildQuery

 function _buildQuery()
 {
     $q = new DBQuery();
     $q->addTable($this->table);
     $q->addQuery('*');
     $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,代碼行數:13,代碼來源:files.inc.php

示例13: getFolderSelectList

function getFolderSelectList()
{
    global $AppUI;
    $folders = array(0 => '');
    $q = new DBQuery();
    $q->addTable('file_folders');
    $q->addQuery('file_folder_id, file_folder_name, file_folder_parent');
    $q->addOrder('file_folder_name');
    $sql = $q->prepare();
    //	$sql = "SELECT file_folder_id, file_folder_name, file_folder_parent FROM file_folders";
    $vfolders = arrayMerge(array('0' => array(0, $AppUI->_('Root'), -1)), db_loadHashList($sql, 'file_folder_id'));
    $folders = array_filter($vfolders, "check_perm");
    return $folders;
}
開發者ID:magsilva,項目名稱:dotproject,代碼行數:14,代碼來源:functions.php

示例14: remove

 function remove()
 {
     $q = new DBQuery();
     $q->dropTable('activity');
     $q->exec();
     $q->clear();
     $q->dropTable('timesheet');
     $q->exec();
     $q->clear();
     $q->dropTable('task_timesheet');
     $q->exec();
     $q->clear();
     return db_error();
 }
開發者ID:kilivan,項目名稱:dotproject,代碼行數:14,代碼來源:setup.php

示例15: install

 function install()
 {
     $q = new DBQuery();
     $q->createTable('links');
     $q->createDefinition("(\n`link_id` int(11) NOT NULL AUTO_INCREMENT ,\n`link_url` varchar(255) NOT NULL default '',\n`link_project` int(11) NOT NULL default '0',\n`link_task` int(11) NOT NULL default '0',\n`link_name` varchar(255) NOT NULL default '',\n`link_parent` int(11) default '0',\n`link_description` text,\n`link_owner` int(11) default '0',\n`link_date` datetime default NULL ,\n`link_icon` varchar(20) default 'obj/',\n`link_category` int(11) NOT NULL default '0',\nPRIMARY KEY (`link_id`) ,\nKEY `idx_link_task` (`link_task`) ,\nKEY `idx_link_project` (`link_project`) ,\nKEY `idx_link_parent` (`link_parent`) \n) DEFAULT CHARSET utf8");
     $q->exec($sql);
     $q->clear();
     $q->addTable('sysvals');
     $q->addInsert('sysval_key_id', 1);
     $q->addInsert('sysval_title', 'LinkType');
     $q->addInsert('sysval_value', "0|Unknown\n1|Document\n2|Application");
     $q->exec();
     return NULL;
 }
開發者ID:222elm,項目名稱:dotprojectFrame,代碼行數:14,代碼來源:setup.php


注:本文中的DBQuery類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。