Changeset 22675


Ignore:
Timestamp:
2013/03/10 02:20:12 (11 years ago)
Author:
h_yoshimoto
Message:

#2181 カラム追加、削除、INSERT、UPDATEを追加

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/camp/camp-2_13-plugin/data/class/plugin/SC_Plugin_Installer.php

    r22673 r22675  
    5959        } 
    6060         
     61        $arrInsertQuery = $this->arrInstallData['insert']; 
     62        foreach ($arrInsertQuery as $insertQuery) { 
     63            $objQuery->insert( 
     64                    $insertQuery['table'], 
     65                    $insertQuery['arrVal'], 
     66                    $insertQuery['arrSql'], 
     67                    $insertQuery['arrSqlVal'], 
     68                    $insertQuery['form'], 
     69                    $insertQuery['arrFromVal'] 
     70                    ); 
     71        } 
     72         
     73             
     74        $arrInsertQuery = $this->arrInstallData['update']; 
     75        foreach ($arrInsertQuery as $insertQuery) { 
     76            $objQuery->update( 
     77                    $insertQuery['table'], 
     78                    $insertQuery['arrVal'], 
     79                    $insertQuery['where'], 
     80                    $insertQuery['arrWhereVal'], 
     81                    $insertQuery['arrRawSql'], 
     82                    $insertQuery['arrRawSqlVal'] 
     83                    ); 
     84        } 
     85                             
    6186        // プラグインのディレクトリコピー 
    6287        $arrCopyDirectories = $this->arrInstallData['copy_directory']; 
     
    163188        GC_Utils::gfPrintLog($msg, PLUGIN_LOG_REALFILE); 
    164189    } 
     190     
     191    /** 
     192     * カラム追加クエリの追加 
     193     *  
     194     * @param type $table 
     195     * @param type $col 
     196     * @param type $type  
     197     */ 
     198    function sqlAterTableAdd($table_name, $col_name, $col_type) { 
     199        $sql = ("ALTER TABLE $table_name ADD $col_name $col_type "); 
     200        $this->sql($sql); 
     201    } 
     202     
     203    /** 
     204     * カラム削除クエリの追加 
     205     *  
     206     * @param type $table 
     207     * @param type $col 
     208     * @param type $type  
     209     */ 
     210    function sqlAterTableDrop($table_name, $col_name) { 
     211        $sql = ("ALTER TABLE $table_name DROP $col_name"); 
     212        $this->sql($sql); 
     213    } 
     214     
     215     
     216    function sqlInsert($table, $arrVal, $arrSql = array(), $arrSqlVal = array(), $from = '', $arrFromVal = array()) { 
     217        $this->arrInstallData['insert'] = array( 
     218            'params'   => array( 
     219                'table' => $table, 
     220                'arrVal' => $arrVal,  
     221                'arrSql' => $arrSql,  
     222                'arrSqlVal' => $arrSqlVal,  
     223                'form' =>$from, 
     224                'arrFromVal' => $arrFromVal) 
     225        ); 
     226    } 
     227     
     228    function sqlUpdate($table, $arrVal, $where = '', $arrWhereVal = array(), $arrRawSql = array(), $arrRawSqlVal = array()) { 
     229        $this->arrInstallData['update'] = array( 
     230            'params'   => array( 
     231                'table' => $table, 
     232                'arrVal' => $arrVal,  
     233                'where' => $where,  
     234                'arrWhereVal' => $arrWhereVal,  
     235                'arrRawSql' =>$arrRawSql, 
     236                'arrRawSqlVal' => $arrRawSqlVal) 
     237        ); 
     238    }     
    165239} 
Note: See TracChangeset for help on using the changeset viewer.