本文整理汇总了PHP中DBQuery::exec方法的典型用法代码示例。如果您正苦于以下问题:PHP DBQuery::exec方法的具体用法?PHP DBQuery::exec怎么用?PHP DBQuery::exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBQuery
的用法示例。
在下文中一共展示了DBQuery::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
}
}
示例2: 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();
}
示例3: 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;
}
示例4: 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';
}
示例5: 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;
}
示例6: remove
public function remove()
{
$q = new DBQuery();
$q->setDelete('modules');
$q->addWhere("mod_directory = 'importers'");
$q->exec();
return true;
}
示例7: remove
function remove()
{
$q = new DBQuery();
$q->dropTable('projects_statistics');
$q->exec();
$q->clear();
return null;
}
示例8: 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();
}
示例9: 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;
}
示例10: 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();
}
示例11: store
function store()
{
$q = new DBQuery();
$q->addTable('project_designer_options');
$q->addReplace('pd_option_user', $this->pd_option_user);
$q->addReplace('pd_option_view_project', $this->pd_option_view_project);
$q->addReplace('pd_option_view_gantt', $this->pd_option_view_gantt);
$q->addReplace('pd_option_view_tasks', $this->pd_option_view_tasks);
$q->addReplace('pd_option_view_actions', $this->pd_option_view_actions);
$q->addReplace('pd_option_view_addtasks', $this->pd_option_view_addtasks);
$q->addReplace('pd_option_view_files', $this->pd_option_view_files);
$q->addWhere('pd_option_user = ' . $this->pd_option_user);
$q->exec();
}
示例12: saveNote
function saveNote($riskId, $userId, $riskDescription)
{
$q = new DBQuery();
$q->addTable('risk_notes');
$q->addInsert('risk_note_risk', $riskId);
$q->addInsert('risk_note_creator', $userId);
$q->addInsert('risk_note_date', 'NOW()', false, true);
$q->addInsert('risk_note_description', $riskDescription);
if (!$q->exec()) {
return db_error();
} else {
return true;
}
}
示例13: _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();
}
示例14: store
public function store(CAppUI $AppUI = null)
{
global $AppUI;
$q = new DBQuery();
$q->addTable('project_designer_options');
$q->addReplace('pd_option_user', $this->pd_option_user);
$q->addReplace('pd_option_view_project', $this->pd_option_view_project);
$q->addReplace('pd_option_view_gantt', $this->pd_option_view_gantt);
$q->addReplace('pd_option_view_tasks', $this->pd_option_view_tasks);
$q->addReplace('pd_option_view_actions', $this->pd_option_view_actions);
$q->addReplace('pd_option_view_addtasks', $this->pd_option_view_addtasks);
$q->addReplace('pd_option_view_files', $this->pd_option_view_files);
$q->addWhere('pd_option_user = ' . (int) $this->pd_option_user);
$q->exec();
}
示例15: 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;
}