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


PHP driver_interface::sql_nextid方法代码示例

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


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

示例1: run

 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->db->sql_return_on_error(true);
     $languages = $this->language_helper->get_available_languages();
     $installed_languages = array();
     foreach ($languages as $lang_info) {
         $lang_pack = array('lang_iso' => $lang_info['iso'], 'lang_dir' => $lang_info['iso'], 'lang_english_name' => htmlspecialchars($lang_info['name']), 'lang_local_name' => htmlspecialchars($lang_info['local_name'], ENT_COMPAT, 'UTF-8'), 'lang_author' => htmlspecialchars($lang_info['author'], ENT_COMPAT, 'UTF-8'));
         $this->db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $this->db->sql_build_array('INSERT', $lang_pack));
         $installed_languages[] = (int) $this->db->sql_nextid();
         if ($this->db->get_sql_error_triggered()) {
             $error = $this->db->sql_error($this->db->get_sql_error_sql());
             $this->iohandler->add_error_message($error['message']);
         }
     }
     $sql = 'SELECT * FROM ' . PROFILE_FIELDS_TABLE;
     $result = $this->db->sql_query($sql);
     $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, PROFILE_LANG_TABLE);
     while ($row = $this->db->sql_fetchrow($result)) {
         foreach ($installed_languages as $lang_id) {
             $insert_buffer->insert(array('field_id' => $row['field_id'], 'lang_id' => $lang_id, 'lang_name' => strtoupper(substr($row['field_name'], 6)), 'lang_explain' => '', 'lang_default_value' => ''));
         }
     }
     $this->db->sql_freeresult($result);
     $insert_buffer->flush();
 }
开发者ID:MrAdder,项目名称:phpbb,代码行数:28,代码来源:add_languages.php

示例2: create_report

 /**
  * Creates a report entity in the database
  *
  * @param	array	$report_data
  * @return	int	the ID of the created entity
  */
 protected function create_report(array $report_data)
 {
     $sql_ary = array('reason_id' => (int) $report_data['reason_id'], 'post_id' => $report_data['post_id'], 'pm_id' => $report_data['pm_id'], 'user_id' => (int) $this->user->data['user_id'], 'user_notify' => (int) $report_data['user_notify'], 'report_closed' => 0, 'report_time' => (int) time(), 'report_text' => (string) $report_data['report_text'], 'reported_post_text' => $report_data['reported_post_text'], 'reported_post_uid' => $report_data['reported_post_uid'], 'reported_post_bitfield' => $report_data['reported_post_bitfield'], 'reported_post_enable_bbcode' => $report_data['reported_post_enable_bbcode'], 'reported_post_enable_smilies' => $report_data['reported_post_enable_smilies'], 'reported_post_enable_magic_url' => $report_data['reported_post_enable_magic_url']);
     $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
     $this->db->sql_query($sql);
     return $this->db->sql_nextid();
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:13,代码来源:report_handler.php

示例3: get_notification_type_id

    /**
     * Get the notification type id from the name
     *
     * @param string $notification_type_name The name
     * @return int the notification_type_id
     * @throws \phpbb\notification\exception
     */
    public function get_notification_type_id($notification_type_name)
    {
        $notification_type_ids = $this->cache->get('notification_type_ids');
        $this->db->sql_transaction('begin');
        if ($notification_type_ids === false) {
            $notification_type_ids = array();
            $sql = 'SELECT notification_type_id, notification_type_name
				FROM ' . $this->notification_types_table;
            $result = $this->db->sql_query($sql);
            while ($row = $this->db->sql_fetchrow($result)) {
                $notification_type_ids[$row['notification_type_name']] = (int) $row['notification_type_id'];
            }
            $this->db->sql_freeresult($result);
            $this->cache->put('notification_type_ids', $notification_type_ids);
        }
        if (!isset($notification_type_ids[$notification_type_name])) {
            if (!isset($this->notification_types[$notification_type_name]) && !isset($this->notification_types['notification.type.' . $notification_type_name])) {
                throw new \phpbb\notification\exception('NOTIFICATION_TYPE_NOT_EXIST', array($notification_type_name));
            }
            $sql = 'INSERT INTO ' . $this->notification_types_table . ' ' . $this->db->sql_build_array('INSERT', array('notification_type_name' => $notification_type_name, 'notification_type_enabled' => 1));
            $this->db->sql_query($sql);
            $notification_type_ids[$notification_type_name] = (int) $this->db->sql_nextid();
            $this->cache->put('notification_type_ids', $notification_type_ids);
        }
        $this->db->sql_transaction('commit');
        return $notification_type_ids[$notification_type_name];
    }
开发者ID:ErnadoO,项目名称:phpbb,代码行数:34,代码来源:manager.php

示例4: post

 /**
  * Post a new message to the shoutbox.
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 public function post()
 {
     // We always disallow guests to post in the shoutbox.
     if (!$this->auth->acl_get('u_shoutbox_post') || $this->user->data['user_id'] == ANONYMOUS) {
         return $this->error('AJAX_SHOUTBOX_ERROR', 'AJAX_SHOUTBOX_NO_PERMISSION', 403);
     }
     if ($this->request->is_ajax()) {
         $message = $msg = trim(utf8_normalize_nfc($this->request->variable('text_shoutbox', '', true)));
         if (empty($message)) {
             return $this->error('AJAX_SHOUTBOX_ERROR', 'AJAX_SHOUTBOX_MESSAGE_EMPTY', 500);
         }
         $uid = $bitfield = $options = '';
         $allow_bbcode = $this->auth->acl_get('u_shoutbox_bbcode');
         $allow_urls = $allow_smilies = true;
         if (!function_exists('generate_text_for_storage')) {
             include $this->root_path . 'includes/functions_content.' . $this->php_ext;
         }
         generate_text_for_storage($message, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
         $insert = array('post_message' => $message, 'post_time' => time(), 'user_id' => $this->user->data['user_id'], 'bbcode_options' => $options, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid);
         $sql = 'INSERT INTO ' . $this->table . ' ' . $this->db->sql_build_array('INSERT', $insert);
         $this->db->sql_query($sql);
         if ($this->push->canPush()) {
             // User configured us to submit the shoutbox post to the iOS/Android app
             $this->push->post($msg, $insert['post_time'], $this->user->data['username'], $this->db->sql_nextid());
         }
         return new JsonResponse(array('OK'));
     } else {
         return $this->error('AJAX_SHOUTBOX_ERROR', 'AJAX_SHOUTBOX_ONLY_AJAX', 500);
     }
 }
开发者ID:alhitary,项目名称:ajax-shoutbox-ext,代码行数:35,代码来源:main_controller.php

示例5: submit_autogroup_rule

    /**
     * Submit auto group rule form data
     *
     * @param int $autogroups_id An auto group identifier
     *                           A value of 0 is new, otherwise we're updating
     * @return null
     * @access protected
     */
    protected function submit_autogroup_rule($autogroups_id = 0)
    {
        $data = array('autogroups_type_id' => $this->request->variable('autogroups_type_id', 0), 'autogroups_min_value' => $this->request->variable('autogroups_min_value', 0), 'autogroups_max_value' => $this->request->variable('autogroups_max_value', 0), 'autogroups_group_id' => $this->request->variable('autogroups_group_id', 0), 'autogroups_default' => $this->request->variable('autogroups_default', false), 'autogroups_notify' => $this->request->variable('autogroups_notify', false));
        // Prevent form submit when no user groups are available or selected
        if (!$data['autogroups_group_id']) {
            trigger_error($this->user->lang('ACP_AUTOGROUPS_INVALID_GROUPS') . adm_back_link($this->u_action), E_USER_WARNING);
        }
        // Prevent form submit when min and max values are identical
        if ($data['autogroups_min_value'] == $data['autogroups_max_value']) {
            trigger_error($this->user->lang('ACP_AUTOGROUPS_INVALID_RANGE') . adm_back_link($this->u_action), E_USER_WARNING);
        }
        if ($autogroups_id != 0) {
            $sql = 'UPDATE ' . $this->autogroups_rules_table . '
				SET ' . $this->db->sql_build_array('UPDATE', $data) . '
				WHERE autogroups_id = ' . (int) $autogroups_id;
            $this->db->sql_query($sql);
        } else {
            $sql = 'INSERT INTO ' . $this->autogroups_rules_table . ' ' . $this->db->sql_build_array('INSERT', $data);
            $this->db->sql_query($sql);
            $autogroups_id = $this->db->sql_nextid();
        }
        // Apply the auto group to all users
        $this->manager->sync_autogroups($autogroups_id);
        // Log the action
        $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'ACP_AUTOGROUPS_SAVED_LOG', time());
        // Output message to user after submitting the form
        trigger_error($this->user->lang('ACP_AUTOGROUPS_SUBMIT_SUCCESS') . adm_back_link($this->u_action));
    }
开发者ID:Nicofuma,项目名称:autogroups,代码行数:36,代码来源:admin_controller.php

示例6: insert

 /**
  * {@inheritdoc}
  */
 public function insert(array $additional_data)
 {
     $item_data = $this->reset_nestedset_values($additional_data);
     $sql = 'INSERT INTO ' . $this->table_name . ' ' . $this->db->sql_build_array('INSERT', $item_data);
     $this->db->sql_query($sql);
     $item_data[$this->column_item_id] = (int) $this->db->sql_nextid();
     return array_merge($item_data, $this->add_item_to_nestedset($item_data[$this->column_item_id]));
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:11,代码来源:nestedset.php

示例7: add_autogroups_type

 /**
  * Add new condition type
  *
  * @param string $autogroups_type_name The name of the auto group type
  *
  * @return int The identifier of the new condition type
  * @access public
  */
 public function add_autogroups_type($autogroups_type_name)
 {
     // Insert the type name into the database
     $sql = 'INSERT INTO ' . $this->autogroups_types_table . ' ' . $this->db->sql_build_array('INSERT', array('autogroups_type_name' => (string) $autogroups_type_name));
     $this->db->sql_query($sql);
     // Return the id of the newly inserted condition type
     return (int) $this->db->sql_nextid();
 }
开发者ID:ErnadoO,项目名称:autogroups,代码行数:16,代码来源:manager.php

示例8: _insert

 /**
  * Insert a new row in the table corresponding to the specified entity
  */
 protected function _insert($entity)
 {
     if ($entity instanceof $this->_entity_class) {
         $this->db->sql_query('INSERT INTO ' . $this->_entity_table . ' ' . $this->db->sql_build_array('INSERT', $entity->to_db()));
         $mutator = 'set_' . $this->_entity_pkey;
         $entity->{$mutator}((int) $this->db->sql_nextid());
         return $entity;
     }
     throw new \blitze\sitemaker\exception\unexpected_value('INVALID_ENTITY');
 }
开发者ID:BogusCurry,项目名称:phpBB-ext-sitemaker,代码行数:13,代码来源:base_mapper.php

示例9: update_module_data

    /**
     * Update/Add module
     *
     * @param array	&$module_data	The module data
     *
     * @throws \phpbb\module\exception\module_not_found_exception	When parent module or the category is not exist
     */
    public function update_module_data(&$module_data)
    {
        if (!isset($module_data['module_id'])) {
            // no module_id means we're creating a new category/module
            if ($module_data['parent_id']) {
                $sql = 'SELECT left_id, right_id
					FROM ' . $this->modules_table . "\n\t\t\t\t\tWHERE module_class = '" . $this->db->sql_escape($module_data['module_class']) . "'\n\t\t\t\t\t\tAND module_id = " . (int) $module_data['parent_id'];
                $result = $this->db->sql_query($sql);
                $row = $this->db->sql_fetchrow($result);
                $this->db->sql_freeresult($result);
                if (!$row) {
                    throw new module_not_found_exception('PARENT_NOT_EXIST');
                }
                // Workaround
                $row['left_id'] = (int) $row['left_id'];
                $row['right_id'] = (int) $row['right_id'];
                $sql = 'UPDATE ' . $this->modules_table . "\n\t\t\t\t\tSET left_id = left_id + 2, right_id = right_id + 2\n\t\t\t\t\tWHERE module_class = '" . $this->db->sql_escape($module_data['module_class']) . "'\n\t\t\t\t\t\tAND left_id > {$row['right_id']}";
                $this->db->sql_query($sql);
                $sql = 'UPDATE ' . $this->modules_table . "\n\t\t\t\t\tSET right_id = right_id + 2\n\t\t\t\t\tWHERE module_class = '" . $this->db->sql_escape($module_data['module_class']) . "'\n\t\t\t\t\t\tAND {$row['left_id']} BETWEEN left_id AND right_id";
                $this->db->sql_query($sql);
                $module_data['left_id'] = (int) $row['right_id'];
                $module_data['right_id'] = (int) $row['right_id'] + 1;
            } else {
                $sql = 'SELECT MAX(right_id) AS right_id
					FROM ' . $this->modules_table . "\n\t\t\t\t\tWHERE module_class = '" . $this->db->sql_escape($module_data['module_class']) . "'";
                $result = $this->db->sql_query($sql);
                $row = $this->db->sql_fetchrow($result);
                $this->db->sql_freeresult($result);
                $module_data['left_id'] = (int) $row['right_id'] + 1;
                $module_data['right_id'] = (int) $row['right_id'] + 2;
            }
            $sql = 'INSERT INTO ' . $this->modules_table . ' ' . $this->db->sql_build_array('INSERT', $module_data);
            $this->db->sql_query($sql);
            $module_data['module_id'] = $this->db->sql_nextid();
        } else {
            $row = $this->get_module_row($module_data['module_id'], $module_data['module_class']);
            if ($module_data['module_basename'] && !$row['module_basename']) {
                // we're turning a category into a module
                $branch = $this->get_module_branch($module_data['module_id'], $module_data['module_class'], 'children', false);
                if (sizeof($branch)) {
                    throw new module_not_found_exception('NO_CATEGORY_TO_MODULE');
                }
            }
            if ($row['parent_id'] != $module_data['parent_id']) {
                $this->move_module($module_data['module_id'], $module_data['parent_id'], $module_data['module_class']);
            }
            $update_ary = $module_data;
            unset($update_ary['module_id']);
            $sql = 'UPDATE ' . $this->modules_table . '
				SET ' . $this->db->sql_build_array('UPDATE', $update_ary) . "\n\t\t\t\tWHERE module_class = '" . $this->db->sql_escape($module_data['module_class']) . "'\n\t\t\t\t\tAND module_id = " . (int) $module_data['module_id'];
            $this->db->sql_query($sql);
        }
    }
开发者ID:ZerGabriel,项目名称:phpbb,代码行数:60,代码来源:module_manager.php

示例10: add_thing

    public function add_thing()
    {
        if (!$this->auth->acl_get('u_usermap_add_thing')) {
            trigger_error('NOT_AUTHORISED');
        }
        include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
        include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
        $bbcode_status = $this->config['tas2580_usermap_allow_bbcode'];
        $url_status = $this->config['tas2580_usermap_allow_urls'];
        $img_status = $this->config['tas2580_usermap_allow_img'];
        $flash_status = $this->config['tas2580_usermap_allow_flash'];
        $smilies_status = $this->config['tas2580_usermap_allow_smilies'];
        $marker = '';
        $this->user->add_lang('posting');
        $submit = $this->request->is_set_post('submit');
        if ($submit) {
            $title = $this->request->variable('title', '', true);
            $message = $this->request->variable('message', '', true);
            $marker = $this->request->variable('marker', '', true);
            $data = array('lon' => (double) substr($this->request->variable('lon', ''), 0, 10), 'lat' => (double) substr($this->request->variable('lat', ''), 0, 10));
            $validate_array = array('lon' => array('match', false, self::REGEX_LON), 'lat' => array('match', false, self::REGEX_LAT));
            if (!function_exists('validate_data')) {
                include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
            }
            $error = validate_data($data, $validate_array);
            if (utf8_clean_string($title) === '') {
                $error[] = $this->user->lang['EMPTY_SUBJECT'];
            }
            if (utf8_clean_string($message) === '') {
                $error[] = $this->user->lang['TOO_FEW_CHARS'];
            }
            if (empty($marker)) {
                $error[] = $this->user->lang['NEED_MARKER'];
            }
            if (sizeof($error)) {
                $this->template->assign_vars(array('ERROR' => implode('<br />', $error), 'TITLE' => $title, 'MESSAGE' => $message));
            } else {
                generate_text_for_storage($message, $uid, $bitfield, $options, $bbcode_status, $url_status, $smilies_status);
                $sql_data = array('thing_title' => $title, 'thing_text' => $message, 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'thing_lat' => $data['lat'], 'thing_lon' => $data['lon'], 'thing_marker' => $marker, 'thing_user_id' => $this->user->data['user_id']);
                $sql = 'INSERT INTO ' . $this->things_table . '
					' . $this->db->sql_build_array('INSERT', $sql_data);
                $this->db->sql_query($sql);
                $thing_id = $this->db->sql_nextid();
                trigger_error($this->user->lang['THING_ADDED'] . '<br /><br />' . '<a href="' . $this->helper->route('tas2580_usermap_thing', array('id' => $thing_id)) . '">' . $this->user->lang['BACK_TO_THING'] . '</a><br /><br />' . '<a href="' . $this->helper->route('tas2580_usermap_index', array()) . '">' . $this->user->lang['BACK_TO_USERMAP'] . '</a>');
            }
        }
        $path = $this->path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('tas2580/usermap', true) . 'marker/things');
        generate_smilies('inline', 0);
        display_custom_bbcodes();
        $s_hidden_fields = build_hidden_fields(array('lon' => $this->request->variable('lon', ''), 'lat' => $this->request->variable('lat', '')));
        $this->template->assign_vars(array('TITLE' => $this->request->variable('title', '', true), 'MESSAGE' => $this->request->variable('message', '', true), 'MARKER_OPTIONS' => $this->marker_image_select($marker, 'marker/things/'), 'USERMAP_MARKER_PATH' => $path, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => 1, 'BBCODE_STATUS' => $bbcode_status ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $bbcode_status && $url_status ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'FORM_TITLE' => $this->user->lang('ADD_THING', $this->user->lang($this->config['tas2580_usermap_thing_name']))));
        return $this->helper->render('usermap_thing_form.html', $this->user->lang('ADD_THING', $this->user->lang($this->config['tas2580_usermap_thing_name'])));
    }
开发者ID:tas2580,项目名称:usermap,代码行数:53,代码来源:thing.php

示例11: add_entry

 /**
  * Add entry
  * The user with $user_id must exist
  *
  * @param int $entry_id
  * @param array $answers
  */
 public function add_entry($user_id, $answers)
 {
     $entry = array('s_id' => $this->settings['s_id'], 'user_id' => $user_id);
     $sql = "INSERT INTO {$this->tables['entries']} " . $this->db->sql_build_array('INSERT', $entry);
     $this->db->sql_query($sql);
     $entry_id = $this->db->sql_nextid();
     $entry['entry_id'] = $entry_id;
     $entry['entry_username'] = '';
     $this->entries[$entry_id] = $entry;
     foreach ($answers as $question_id => $answer) {
         $this->add_answer($question_id, $entry_id, $answer);
     }
 }
开发者ID:kilianr,项目名称:phpbb-ext-survey,代码行数:20,代码来源:survey.php

示例12: acp_insert_question

 /**
  * Insert a question
  * @param mixed $data An array as created from acp_get_question_input or acp_get_question_data
  */
 public function acp_insert_question($data)
 {
     $langs = $this->get_languages();
     $question_ary = $data;
     $question_ary['lang_id'] = $langs[$data['lang_iso']]['id'];
     unset($question_ary['options_left']);
     unset($question_ary['options_right']);
     $sql = 'INSERT INTO ' . $this->table_sortables_questions . $this->db->sql_build_array('INSERT', $question_ary);
     $this->db->sql_query($sql);
     $question_id = $this->db->sql_nextid();
     $this->acp_insert_answers($data, $question_id);
     $this->cache->destroy('sql', $this->table_sortables_questions);
 }
开发者ID:Galixte,项目名称:Sortables-CAPTCHA-Plugin,代码行数:17,代码来源:sortables.php

示例13: insert

 /**
  * Insert the page data for the first time
  *
  * Will throw an exception if the page was already inserted (call save() instead)
  *
  * @return page_interface $this object for chaining calls; load()->set()->save()
  * @access public
  * @throws \phpbb\pages\exception\out_of_bounds
  */
 public function insert()
 {
     if (!empty($this->data['page_id'])) {
         // The page already exists
         throw new \phpbb\pages\exception\out_of_bounds('page_id');
     }
     // Insert the page data to the database
     $sql = 'INSERT INTO ' . $this->pages_table . ' ' . $this->db->sql_build_array('INSERT', $this->data);
     $this->db->sql_query($sql);
     // Set the page_id using the id created by the SQL insert
     $this->data['page_id'] = (int) $this->db->sql_nextid();
     return $this;
 }
开发者ID:R3gi,项目名称:pages,代码行数:22,代码来源:page.php

示例14: mchat_action

 /**
  * Performs add|edit|del|clean|prune actions
  */
 public function mchat_action($action, $sql_ary = null, $message_id = 0, $log_username = '')
 {
     switch ($action) {
         // User adds a message
         case 'add':
             $sql = 'INSERT INTO ' . $this->mchat_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
             $this->mchat_add_user_session();
             break;
             // User edits a message
         // User edits a message
         case 'edit':
             $sql = 'UPDATE ' . $this->mchat_table . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE message_id = ' . (int) $message_id;
             $this->mchat_add_user_session();
             $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EDITED_MCHAT', false, array($log_username));
             break;
             // User deletes a message
         // User deletes a message
         case 'del':
             $sql = 'DELETE FROM ' . $this->mchat_table . ' WHERE message_id = ' . (int) $message_id;
             $this->mchat_add_user_session();
             $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_DELETED_MCHAT', false, array($log_username));
             $this->cache->destroy('sql', $this->mchat_table);
             break;
             // Founder purges all messages
         // Founder purges all messages
         case 'clean':
             $sql = 'TRUNCATE TABLE ' . $this->mchat_table;
             $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_TABLE_PRUNED');
             $this->cache->destroy('sql', $this->mchat_table);
             break;
             // User triggers messages to be pruned
         // User triggers messages to be pruned
         case 'prune':
             $sql = 'DELETE FROM ' . $this->mchat_table . ' WHERE message_id < ' . (int) $message_id;
             $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_MCHAT_TABLE_PRUNED');
             $this->cache->destroy('sql', $this->mchat_table);
             break;
         default:
             return;
     }
     $result = $this->db->sql_query($sql);
     if ($result !== false) {
         switch ($action) {
             case 'add':
                 if ($this->db->sql_nextid() == 1) {
                     $this->cache->destroy('sql', $this->mchat_table);
                 }
                 break;
         }
     }
 }
开发者ID:EntropyRy,项目名称:mChat-Extension,代码行数:54,代码来源:functions_mchat.php

示例15: insert

 /**
  * Inserts object data into $this->sql_table.
  * Sets the identifier property to the correct id.
  *
  * @return	bool		true on success, else false
  */
 public function insert()
 {
     $sql_array = array();
     foreach ($this->object_config as $name => $null) {
         $sql_array[$name] = $this->validate_property($this->{$name}, $this->object_config[$name]);
     }
     $sql = 'INSERT INTO ' . $this->sql_table . ' ' . $this->db->sql_build_array('INSERT', $sql_array);
     $this->db->sql_query($sql);
     if ($id = $this->db->sql_nextid()) {
         $this->{$this->sql_id_field} = $id;
         return true;
     }
     return false;
 }
开发者ID:Sajaki,项目名称:customisation-db,代码行数:20,代码来源:database_base.php


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