ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 6727


Ignore:
Timestamp:
Apr 25, 2008, 10:18:52 PM (12 years ago)
Author:
ebihara
Message:

#2305:c_member_config_optionを使わず、c_member_configで完結するように修正

Location:
OpenPNE/trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/trunk/webapp/lib/db/member.php

    r6707 r6727  
    19771977function db_member_c_member_config4c_member_id($c_member_id)
    19781978{
    1979     $sql = 'SELECT c_member_config_option.name, c_member_config.value'
    1980          . ' FROM c_member_config'
    1981          . ' INNER JOIN c_member_config_option USING(c_member_config_option_id)'
    1982          . ' WHERE c_member_id = ?';
    1983     $params = array(intval($c_member_id));
     1979    $sql = 'SELECT name, value FROM c_member_config WHERE c_member_id = ?';
     1980    $params = array(
     1981        intval($c_member_id),
     1982    );
    19841983
    19851984    $member_config = db_get_assoc($sql, $params);
     
    19921991 *
    19931992 * @param int $c_member_id
    1994  * @param int $c_member_config_option_id
     1993 * @param string $name
    19951994 * @return bool
    19961995 */
    1997 function db_member_c_member_config4option_id($c_member_id, $c_member_config_option_id)
     1996function db_member_c_member_config4name($c_member_id, $name)
    19981997{
    19991998    $sql = 'SELECT COUNT(c_member_config_id) FROM c_member_config'
    2000          . ' WHERE c_member_id = ? AND c_member_config_option_id = ?';
     1999         . ' WHERE c_member_id = ? AND name = ?';
    20012000    $params = array(
    20022001        intval($c_member_id),
    2003         intval($c_member_config_option_id),
     2002        $name,
    20042003    );
    20052004    return (bool)db_get_one($sql, $params, 'main');
    2006 }
    2007 
    2008 /**
    2009  * c_member_config_option_id取得
    2010  *
    2011  * @param string $name
    2012  * @return int
    2013  */
    2014 function db_member_config_option_id4name($name)
    2015 {
    2016     $sql = 'SELECT c_member_config_option_id FROM c_member_config_option'
    2017          . ' WHERE name = ?';
    2018     $params = array(strval($name));
    2019     return db_get_one($sql, $params);
    20202005}
    20212006
     
    20292014function db_member_update_c_member_config($c_member_id, $name, $value)
    20302015{
    2031     $option_id = db_member_config_option_id4name($name);
    2032 
    2033     if (!db_member_c_member_config4option_id($c_member_id, $option_id)) {
     2016    if (!db_member_c_member_config4name($c_member_id, $name)) {
    20342017        $data = array(
    20352018            'c_member_id' => intval($c_member_id),
    2036             'c_member_config_option_id' => intval($option_id),
     2019            'name' => $name,
    20372020            'value' => $value,
    20382021        );
     
    20422025        $where = array(
    20432026            'c_member_id' => intval($c_member_id),
    2044             'c_member_config_option_id' => intval($option_id),
     2027            'name' => $name,
    20452028        );
    20462029        db_update('c_member_config', $data, $where);
Note: See TracChangeset for help on using the changeset viewer.