Ignore:
Timestamp:
2009/03/06 20:35:20 (15 years ago)
Author:
Seasoft
Message:

・不適切な文字列比較を修正。(PEAR::DB のカスタマイズに依存させる。)

 http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=1808&forum=9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/SC_Query.php

    r17641 r17878  
    253253            } else { 
    254254                $strval .= '?,'; 
    255                 if($val != ""){ 
    256                     $arrval[] = $val; 
    257                 } else { 
    258                     $arrval[] = NULL; 
    259                 } 
     255                $arrval[] = $val; 
    260256            } 
    261257            $find = true; 
     
    271267        // INSERT文の実行 
    272268        $ret = $this->conn->query($sqlin, $arrval); 
    273  
    274         return $ret; 
    275     } 
    276  
    277     // INSERT文の生成・実行 
    278     // $table   :テーブル名 
    279     // $sqlval  :列名 => 値の格納されたハッシュ配列 
    280     function fast_insert($table, $sqlval) { 
    281         $strcol = ''; 
    282         $strval = ''; 
    283         $find = false; 
    284  
    285         foreach ($sqlval as $key => $val) { 
    286                 $strcol .= $key . ','; 
    287                 if($val != ""){ 
    288                     $eval = pg_escape_string($val); 
    289                     $strval .= "'$eval',"; 
    290                 } else { 
    291                     $strval .= "NULL,"; 
    292                 } 
    293                 $find = true; 
    294         } 
    295         if(!$find) { 
    296             return false; 
    297         } 
    298         // 文末の","を削除 
    299         $strcol = ereg_replace(",$","",$strcol); 
    300         // 文末の","を削除 
    301         $strval = ereg_replace(",$","",$strval); 
    302         $sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")"; 
    303  
    304         // INSERT文の実行 
    305         $ret = $this->conn->query($sqlin); 
    306269 
    307270        return $ret; 
     
    327290            } else { 
    328291                $strcol .= $key . '= ?,'; 
    329                 if($val != ""){ 
    330                     $arrval[] = $val; 
    331                 } else { 
    332                     $arrval[] = NULL; 
    333                 } 
     292                $arrval[] = $val; 
    334293            } 
    335294            $find = true; 
     
    363322        } 
    364323 
    365         // INSERT文の実行 
     324        // UPDATE文の実行 
    366325        $ret = $this->conn->query($sqlup, $arrval); 
    367326        return $ret; 
Note: See TracChangeset for help on using the changeset viewer.