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


PHP w2p_Database_Query::addInsert方法代码示例

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


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

示例1: store

 public function store()
 {
     $this->w2PTrimAll();
     $msg = $this->check();
     if ($msg) {
         return get_class($this) . '::store-check failed - ' . $msg;
     }
     $values = parseFormatSysval($this->sysval_value, $this->sysval_key_id);
     //lets delete the old values
     $q = new w2p_Database_Query();
     if ($this->sysval_key_id && $this->sysval_title) {
         $q->setDelete('sysvals');
         $q->addWhere('sysval_key_id = ' . (int) $this->sysval_key_id);
         $q->addWhere('sysval_title = \'' . $this->sysval_title . '\'');
         if (!$q->exec()) {
             $q->clear();
             return get_class($this) . '::store failed: ' . db_error();
         }
     }
     foreach ($values as $key => $value) {
         $q->addTable('sysvals');
         $q->addInsert('sysval_key_id', $this->sysval_key_id);
         $q->addInsert('sysval_title', $this->sysval_title);
         $q->addInsert('sysval_value_id', $key);
         $q->addInsert('sysval_value', $value);
         if (!$q->exec()) {
             $q->clear();
             return get_class($this) . '::store failed: ' . db_error();
         }
         $q->clear();
     }
     return null;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:33,代码来源:syskeys.class.php

示例2: write

 public function write($id, $data)
 {
     global $AppUI;
     $q = new w2p_Database_Query();
     $q->addQuery('count(session_id) as row_count');
     $q->addTable('sessions');
     $q->addWhere('session_id = \'' . $id . '\'');
     $row_count = (int) $q->loadResult();
     $q->clear();
     if ($row_count) {
         $q->addTable('sessions');
         $q->addWhere('session_id = \'' . $id . '\'');
         $q->addUpdate('session_data', $data);
         if (isset($AppUI)) {
             $q->addUpdate('session_user', (int) $AppUI->last_insert_id);
         }
     } else {
         $q->addTable('sessions');
         $q->addInsert('session_id', $id);
         $q->addInsert('session_data', $data);
         $q->addInsert('session_created', $q->dbfnNowWithTZ());
     }
     $q->exec();
     $q->clear();
     return true;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:26,代码来源:Session.class.php

示例3: store

 public function store($object_id)
 {
     global $db;
     $object_id = (int) $object_id;
     if ($object_id) {
         $this->value_intvalue = (int) $this->value_intvalue;
         $ins_charvalue = $this->value_charvalue == null ? '' : stripslashes($this->value_charvalue);
         $q = new w2p_Database_Query();
         $q->addTable('custom_fields_values');
         if ($this->value_id) {
             $q->addUpdate('value_charvalue', $ins_charvalue);
             $q->addUpdate('value_intvalue', $this->value_intvalue);
             $q->addWhere('value_id = ' . $this->value_id);
         } else {
             $q->addInsert('value_module', '');
             $q->addInsert('value_field_id', $this->field_id);
             $q->addInsert('value_object_id', $object_id);
             $q->addInsert('value_charvalue', $ins_charvalue);
             $q->addInsert('value_intvalue', $this->value_intvalue);
         }
         $rs = $q->exec();
         $q->clear();
         if (!$rs) {
             return $db->ErrorMsg() . ' | SQL: ';
         }
     } else {
         return 'Error: Cannot store field (' . $this->field_name . '), associated id not supplied.';
     }
 }
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:29,代码来源:CustomField.class.php

示例4: install

 public function install()
 {
     global $AppUI;
     // Create holiday table
     $q = new w2p_Database_Query();
     $q->createTable('holiday');
     $q->createDefinition('(
         `holiday_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
         `holiday_user` int(10) NOT NULL DEFAULT \'0\',
         `holiday_type` int(10) NOT NULL DEFAULT \'0\',
         `holiday_annual` int(10) NOT NULL DEFAULT \'0\',
         `holiday_start_date` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\',
         `holiday_end_date` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\',
         `holiday_description` text,
         PRIMARY KEY (`holiday_id`),
         KEY `holiday_start_end_date` (`holiday_start_date`,`holiday_end_date`),
         KEY `holiday_type` (`holiday_type`),
         KEY `holiday_user` (`holiday_user`)
         ) ENGINE=MyISAM CHARACTER SET=utf8 COLLATE=utf8_general_ci
     ');
     $q->exec();
     $q->clear();
     // Create settings table
     $q->createTable('holiday_settings');
     $q->createDefinition('(
         `holiday_manual` int(10) NOT NULL default \'0\',
         `holiday_auto` int(10) NOT NULL default \'0\',
         `holiday_driver` int(10) NOT NULL default \'-1\',
         `holiday_filter` int(10) NOT NULL default \'-1\',
         UNIQUE KEY `holiday_manual` (holiday_manual),
         UNIQUE KEY `holiday_auto` (holiday_auto),
         UNIQUE KEY `holiday_driver` (holiday_driver),
         UNIQUE KEY `holiday_filter` (holiday_filter)
         ) ENGINE=MyISAM CHARACTER SET=utf8 COLLATE=utf8_general_ci
     ');
     $q->exec();
     $q->clear();
     // Set default settings
     $q->addTable('holiday_settings');
     $q->addInsert('holiday_manual', 0);
     $q->addInsert('holiday_auto', 0);
     $q->addInsert('holiday_driver', -1);
     $q->addInsert('holiday_filter', -1);
     $q->exec();
     $i = 0;
     $user_holiday_types = array('holidays', 'sick stoppage', 'formation', 'seminar', 'mission', 'strike', 'other holiday');
     foreach ($user_holiday_types as $user_holiday_type) {
         $q->clear();
         $q->addTable('sysvals');
         $q->addInsert('sysval_key_id', 1);
         // select list
         $q->addInsert('sysval_title', 'UserHolidayType');
         $q->addInsert('sysval_value', $user_holiday_type);
         $q->addInsert('sysval_value_id', $i++);
         $q->exec();
     }
     $perms = $AppUI->acl();
     return $perms->registerModule('Holiday', 'holiday');
 }
开发者ID:Raithlin,项目名称:web2project-holiday,代码行数:59,代码来源:setup.php

示例5: install

    public function install()
    {
        $ok = true;
        $q = new w2p_Database_Query();
        $sql = '(
			resource_id integer not null auto_increment,
			resource_name varchar(255) not null default "",
			resource_key varchar(64) not null default "",
			resource_type integer not null default 0,
			resource_note text not null default "",
			resource_max_allocation integer not null default 100,
			primary key (resource_id),
			key (resource_name),
			key (resource_type)
		)';
        $q->createTable('resources', $sql);
        $ok = $ok && $q->exec();
        $q->clear();
        $sql = '(
			resource_type_id integer not null auto_increment,
			resource_type_name varchar(255) not null default "",
			resource_type_note text,
			primary key (resource_type_id)
		)';
        $q->createTable('resource_types', $sql);
        $ok = $ok && $q->exec();
        $q->clear();
        $sql = '(
			resource_id integer not null default 0,
			task_id integer not null default 0,
			percent_allocated integer not null default 100,
			key (resource_id),
			key (task_id, resource_id)
		)';
        $q->createTable('resource_tasks', $sql);
        $ok = $ok && $q->exec();
        $q->clear();
        $q->addTable('resource_types');
        $q->addInsert('resource_type_name', 'Equipment');
        $q->exec();
        $q->addInsert('resource_type_name', 'Tool');
        $q->exec();
        $q->addInsert('resource_type_name', 'Venue');
        $ok = $ok && $q->exec();
        if (!$ok) {
            return false;
        }
        return null;
    }
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:49,代码来源:setup.php

示例6: store

 public function store()
 {
     if (!is_array($this->options)) {
         $this->options = array();
     }
     $newoptions = $this->options;
     //insert the new option
     foreach ($newoptions as $opt) {
         $q = new w2p_Database_Query();
         $q->addTable('custom_fields_lists');
         $q->addQuery('MAX(list_option_id)');
         $max_id = $q->loadResult();
         $optid = $max_id ? $max_id + 1 : 1;
         $q = new w2p_Database_Query();
         $q->addTable('custom_fields_lists');
         $q->addInsert('field_id', $this->field_id);
         $q->addInsert('list_option_id', $optid);
         $q->addInsert('list_value', $opt);
         $q->exec();
     }
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:21,代码来源:CustomOptionList.class.php

示例7: w2PsessionWrite

function w2PsessionWrite($id, $data)
{
    global $AppUI;
    $q = new w2p_Database_Query();
    $q->addQuery('count(session_id) as row_count');
    $q->addTable('sessions');
    $q->addWhere('session_id = \'' . $id . '\'');
    if (($qid =& $q->exec()) && ($qid->fields['row_count'] > 0 || $qid->fields[0] > 0)) {
        $q->query = null;
        $q->addUpdate('session_data', $data);
        if (isset($AppUI)) {
            $q->addUpdate('session_user', (int) $AppUI->last_insert_id);
        }
    } else {
        $q->query = null;
        $q->where = null;
        $q->addInsert('session_id', $id);
        $q->addInsert('session_data', $data);
        $q->addInsert('session_created', date('Y-m-d H:i:s'));
    }
    $q->exec();
    $q->clear();
    return true;
}
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:24,代码来源:session.php

示例8: registerLogin

 public function registerLogin()
 {
     $q = new w2p_Database_Query();
     $q->addTable('user_access_log');
     $q->addInsert('user_id', '' . $this->user_id);
     $q->addInsert('date_time_in', "'" . $q->dbfnNowWithTZ() . "'", false, true);
     $q->addInsert('user_ip', $_SERVER['REMOTE_ADDR']);
     $q->exec();
     $this->last_insert_id = db_insert_id();
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:10,代码来源:CAppUI.class.php

示例9:

&message_parent=<?php 
    echo $message_id;
    ?>
&post_message=1';" />
			<input type="button" class="button" value="<?php 
    echo $AppUI->_('New Topic');
    ?>
" onclick="javascript:window.location='./index.php?m=forums&a=viewer&forum_id=<?php 
    echo $forum_id;
    ?>
&message_id=0&post_message=1';" />
		<?php 
}
?>
		</td>
	</tr>
	</table>
</td></tr>
</table>
<?php 
// Now we need to update the forum visits with the new messages so they don't show again.
foreach ($new_messages as $msg_id) {
    $q = new w2p_Database_Query();
    $q->addTable('forum_visits');
    $q->addInsert('visit_user', $AppUI->user_id);
    $q->addInsert('visit_forum', $forum_id);
    $q->addInsert('visit_message', $msg_id);
    $q->addInsert('visit_date', $date->getDate());
    $q->exec();
    $q->clear();
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例10: saveSettings

 public static function saveSettings($moduleName, $configName, $displayColumns, $displayOrder, $configValue, $configText)
 {
     if ('' == $moduleName || '' == $configName) {
         return false;
     }
     $q = new w2p_Database_Query();
     $q->setDelete('module_config');
     $q->addWhere("module_name = '{$moduleName}'");
     $q->addWhere("module_config_name = '{$configName}'");
     $q->exec();
     $q->clear();
     $i = 0;
     foreach ($configValue as $index => $field) {
         if (isset($displayColumns[$field])) {
             $q->addTable('module_config');
             $q->addInsert('module_name', $moduleName);
             $q->addInsert('module_config_name', $configName);
             $q->addInsert('module_config_value', $field);
             $q->addInsert('module_config_text', $configText[$index]);
             $q->addInsert('module_config_order', (int) $displayOrder[$field]);
             $q->exec();
             $q->clear();
             $i++;
         }
     }
 }
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:26,代码来源:Module.class.php

示例11: foreach

## Change forum watches
##
$watch = w2PgetParam($_POST, 'watch', '');
if ($watch) {
    // clear existing watches
    $q = new w2p_Database_Query();
    $q->setDelete('forum_watch');
    $q->addWhere('watch_user = ' . (int) $AppUI->user_id);
    $q->addWhere('watch_' . $watch . ' IS NOT NULL');
    if (!$q->exec()) {
        $AppUI->setMsg(db_error(), UI_MSG_ERROR);
        $q->clear();
    } else {
        $q->clear();
        foreach ($_POST as $k => $v) {
            if (strpos($k, 'forum_') !== false) {
                $q->addTable('forum_watch');
                $q->addInsert('watch_user', $AppUI->user_id);
                $q->addInsert('watch_' . $watch, substr($k, 6));
                if (!$q->exec()) {
                    $AppUI->setMsg(db_error(), UI_MSG_ERROR);
                } else {
                    $AppUI->setMsg('Watch updated', UI_MSG_OK);
                }
                $q->clear();
            }
        }
    }
} else {
    $AppUI->setMsg('Incorrect watch type passed to sql handler.', UI_MSG_ERROR);
}
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:31,代码来源:do_watch_forum.php

示例12: registerModule

 public function registerModule($module_name, $module_value, $section_value = 'app')
 {
     $q = new w2p_Database_Query();
     $q->addTable('gacl_axo');
     $q->addInsert('name', $module_name);
     $q->addInsert('value', $module_value);
     $q->addInsert('section_value', $section_value);
     $q->exec();
     return true;
 }
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:10,代码来源:Permissions.class.php

示例13: install

 public function install()
 {
     global $AppUI;
     $q = new w2p_Database_Query();
     $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 )
         ) ENGINE = MYISAM DEFAULT CHARSET=utf8 ');
     $q->exec($sql);
     $i = 0;
     $linkTypes = array('Unknown', 'Document', 'Application');
     foreach ($linkTypes as $linkType) {
         $q->clear();
         $q->addTable('sysvals');
         $q->addInsert('sysval_key_id', 1);
         $q->addInsert('sysval_title', 'LinkType');
         $q->addInsert('sysval_value', $linkType);
         $q->addInsert('sysval_value_id', $i);
         $q->exec();
         $i++;
     }
     $perms = $AppUI->acl();
     return $perms->registerModule('Links', 'links');
 }
开发者ID:,项目名称:,代码行数:38,代码来源:

示例14: die

/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// deny all but system admins
$canEdit = canEdit('system');
if (!$canEdit) {
    $AppUI->redirect('m=public&a=access_denied');
}
$AppUI->savePlace();
$q = new w2p_Database_Query();
if (isset($_POST['forcewatch']) && isset($_POST['forcesubmit'])) {
    // insert row into forum_watch for forcing Watch
    $q->addTable('forum_watch');
    $q->addInsert('watch_user', '0');
    $q->addInsert('watch_forum', '0');
    $q->addInsert('watch_topic', '0');
    if (!$q->exec()) {
        $AppUI->setMsg(db_error(), UI_MSG_ERROR);
    } else {
        $AppUI->setMsg('Watch Forced', UI_MSG_OK);
    }
    $q->clear();
    $AppUI->redirect('m=forums&a=configure');
} elseif (isset($_POST['forcesubmit']) && !isset($_POST['forcewatch'])) {
    // delete row from forum_watch for unorcing Watch
    $q->setDelete('forum_watch');
    $q->addWhere('watch_user = 0');
    $q->addWhere('watch_forum = 0');
    $q->addWhere('watch_topic = 0');
开发者ID:eureka2,项目名称:web2project,代码行数:30,代码来源:configure.php

示例15: setContactMethods

 public function setContactMethods(array $methods)
 {
     $q = new w2p_Database_Query();
     $q->setDelete('contacts_methods');
     $q->addWhere('contact_id=' . (int) $this->contact_id);
     $q->exec();
     $q->clear();
     if (!empty($methods)) {
         $q = new w2p_Database_Query();
         $q->addTable('contacts_methods');
         $q->addInsert('contact_id', (int) $this->contact_id);
         foreach ($methods as $name => $value) {
             if (!empty($value)) {
                 $q->addInsert('method_name', $name);
                 $q->addInsert('method_value', $value);
                 $q->exec();
             }
         }
         $q->clear();
     }
 }
开发者ID:eureka2,项目名称:web2project,代码行数:21,代码来源:contacts.class.php


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