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


PHP DBQuery::clear方法代码示例

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


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

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

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

示例3: upgrade

 function upgrade($old_version)
 {
     $q = new DBQuery();
     switch ($old_version) {
         case '0.1':
             $q->alterTable('history');
             $q->addField('history_table', 'varchar(15) NOT NULL default \'\'');
             $q->addField('history_action', 'varchar(10) NOT NULL default \'modify\'');
             $q->dropField('history_module');
             $q->exec();
             $q->clear();
         case '0.2':
             $q->alterTable('history');
             $q->addField('history_item', 'int(10) NOT NULL');
             $q->exec();
             $q->clear();
         case '0.3':
             $q->alterTable('history');
             $q->addIndex('index_history_item', '(history_item)');
             $q->exec();
             $q->clear();
             $q->alterTable('history');
             $q->addIndex('index_history_module', '(history_table, history_item)');
             $q->exec();
             $q->clear();
         case '0.31':
             break;
     }
     return db_error();
 }
开发者ID:magsilva,项目名称:dotproject,代码行数:30,代码来源:setup.php

示例4: remove

 function remove()
 {
     $q = new DBQuery();
     $q->dropTable('resources');
     $q->exec();
     $q->clear();
     $q->dropTable('resource_tasks');
     $q->exec();
     $q->clear();
     $q->dropTable('resource_types');
     $q->exec();
     return null;
 }
开发者ID:illuminate3,项目名称:dotproject,代码行数:13,代码来源:setup.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: 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

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

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

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

示例10: upgrade

 public function upgrade($old_version)
 {
     $q = new DBQuery();
     switch ($old_version) {
         case '0.3':
             $q->alterTable('history');
             $q->addIndex('index_history_item', '(history_item)');
             $q->exec();
             $q->clear();
             $q->alterTable('history');
             $q->addIndex('index_history_module', '(history_table, history_item)');
             $q->exec();
             $q->clear();
         case '0.31':
             $q->alterTable('history');
             $q->alterField('history_table', 'varchar(20) NOT NULL default ""');
             $q->alterField('history_action', 'varchar(20) NOT NULL default "modify"');
             $q->exec();
             $q->clear();
         case '0.32':
             break;
     }
     return db_error() ? false : true;
 }
开发者ID:joly,项目名称:web2project,代码行数:24,代码来源:setup.php

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

示例12: DBQuery

 function _buildQuery()
 {
     $q = new DBQuery();
     $q->addTable($this->table);
     $q->addQuery('company_id');
     $q->addQuery('company_name');
     $sql = array();
     foreach ($this->search_fields as $field) {
         $sql[] = "{$field} LIKE '%{$this->keyword}%'";
     }
     if (count($sql)) {
         $q->addWhere(implode(' OR ', $sql));
     }
     $result = $q->prepare();
     $q->clear();
     return $result;
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:17,代码来源:companies.inc.php

示例13: install

    public function install()
    {
        $q = new DBQuery();
        $q->createTable('links');
        $q->createDefinition('(
link_id int( 11 ) NOT NULL AUTO_INCREMENT ,
link_url varchar( 255 ) NOT NULL default "",
link_project int( 11 ) NOT NULL default "0",
link_task int( 11 ) NOT NULL default "0",
link_name varchar( 255 ) NOT NULL default "",
link_parent int( 11 ) default "0",
link_description text,
link_owner int( 11 ) default "0",
link_date datetime default NULL ,
link_icon varchar( 20 ) default "obj/",
link_category int( 11 ) NOT NULL default "0",
PRIMARY KEY ( link_id ) ,
KEY idx_link_task ( link_task ) ,
KEY idx_link_project ( link_project ) ,
KEY idx_link_parent ( link_parent ) 
) TYPE = MYISAM ');
        $q->exec($sql);
        $q->clear();
        $q->addTable('sysvals');
        $q->addInsert('sysval_key_id', 1);
        $q->addInsert('sysval_title', 'LinkType');
        $q->addInsert('sysval_value', 'Unknown');
        $q->addInsert('sysval_value_id', '0');
        $q->exec();
        $q->clear();
        $q->addTable('sysvals');
        $q->addInsert('sysval_key_id', 1);
        $q->addInsert('sysval_title', 'LinkType');
        $q->addInsert('sysval_value', 'Document');
        $q->addInsert('sysval_value_id', '1');
        $q->exec();
        $q->clear();
        $q->addTable('sysvals');
        $q->addInsert('sysval_key_id', 1);
        $q->addInsert('sysval_title', 'LinkType');
        $q->addInsert('sysval_value', 'Application');
        $q->addInsert('sysval_value_id', '2');
        $q->exec();
        return null;
    }
开发者ID:joly,项目名称:web2project,代码行数:45,代码来源:setup.php

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

示例15: getAllUsersGroupByDept

function getAllUsersGroupByDept()
{
    $q = new DBQuery();
    $q->addTable('users');
    $q->addQuery('user_id, contact_department, concat_ws(", ", contact_last_name, contact_first_name) as contact_name');
    $q->addJoin('contacts', 'con', 'contact_id = user_contact');
    $q->addOrder('contact_last_name');
    $res = $q->exec();
    $userlist = array();
    while ($row = $q->fetchRow()) {
        if ($row['contact_department'] == null) {
            $row['contact_department'] = 0;
        }
        if (!isset($userlist[$row['contact_department']])) {
            $userlist[$row['contact_department']] = array();
        }
        $userlist[$row['contact_department']][$row['user_id']] = $row['contact_name'];
    }
    $q->clear();
    return $userlist;
}
开发者ID:kilivan,项目名称:dotproject,代码行数:21,代码来源:ae_resource.php


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