• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DBQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了DBQuery类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: executeQuery

 public function executeQuery(DBQuery $query)
 {
     $this->last_query = $query;
     if (!$this->connected) {
         $this->last_error = "Keine Verbindung zur Datenbank.";
         return NULL;
     }
     $result = mysql_query($query->getString());
     if (!$result) {
         $this->last_error = mysql_error();
         return NULL;
     }
     return new ResultSet($result, $this->connection_link);
 }
开发者ID:BackupTheBerlios,项目名称:campusmap,代码行数:14,代码来源:Connection.php


示例17: _fetchPreviousData

 function _fetchPreviousData()
 {
     $q = new DBQuery();
     $q->addTable($this->table_name);
     $q->addQuery($this->field_name);
     $q->addWhere("{$this->id_field_name} = {$this->row_id}");
     $previous_data = $q->loadResult();
     if ($previous_data != "") {
         $previous_data = unserialize($previous_data);
         $previous_data = !is_array($previous_data) ? array() : $previous_data;
     } else {
         $previous_data = array();
     }
     $this->previous_data = $previous_data;
 }
开发者ID:Esleelkartea,项目名称:gestion-de-primeras-muestras,代码行数:15,代码来源:customfieldsparser.class.php


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


示例19: breakUpAndGetIDs

 function breakUpAndGetIDs($field, $dbfieldid, $dbfieldname, $dbtable)
 {
     $sval = explode(",", $field);
     $where = array();
     foreach ($sval as $val) {
         $where[] = "lower( " . $dbfieldname . " ) LIKE lower( '" . trim($val) . "' )";
     }
     $ssql = "SELECT " . $dbfieldid . " FROM " . $dbtable . " WHERE " . implode(" OR ", $where);
     $qry = new DBQuery();
     $qry->execute($ssql);
     $sid = array();
     while ($srow = $qry->getRow()) {
         $sid[] = $srow[$dbfieldid];
     }
     return $sid;
 }
开发者ID:Salvoxia,项目名称:advanced_search,代码行数:16,代码来源:class.advkilllist.php


示例20: canDelete

 function canDelete(&$msg, $oid = null, $joins = null)
 {
     global $AppUI;
     if ($oid) {
         //Check to see if there is a user
         $q = new DBQuery();
         $q->addTable('users');
         $q->addQuery('count(*) as user_count');
         $q->addWhere('user_contact = ' . (int) $oid);
         $user_count = $q->loadResult();
         if ($user_count > 0) {
             $msg = $AppUI->_('contactsDeleteUserError');
             return false;
         }
     }
     return parent::canDelete($msg, $oid, $joins);
 }
开发者ID:222elm,项目名称:dotprojectFrame,代码行数:17,代码来源:contacts.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DBServer类代码示例发布时间:2022-05-23
下一篇:
PHP DBObjectSet类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap