Ignore:
Timestamp:
2007/03/11 06:27:25 (20 years ago)
Author:
nanasess
Message:

r11729 の変更を取消

File:
1 edited

Legend:

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

    r11729 r11730  
    1111    var $conn; 
    1212     
    13     // コンストラクタ 
     13    // ¥³¥ó¥¹¥È¥é¥¯¥¿ 
    1414    /* 
    15         $err_disp:エラー表示を行うか 
    16         $new:新規に接続を行うか 
     15        $err_disp:¥¨¥é¡¼É½¼¨¤ò¹Ô¤¦¤« 
     16        $new¡§¿·µ¬¤ËÀܳ¤ò¹Ô¤¦¤« 
    1717     */ 
    1818    function SC_Query($dsn = "", $err_disp = true, $new = false) { 
    … …  
    2222    } 
    2323     
    24     // エラー判定 
     24    // ¥¨¥é¡¼È½Äê 
    2525    function isError() { 
    2626        if(PEAR::isError($this->conn->conn)) { 
    … …  
    3030    } 
    3131     
    32     // COUNT文の実行 
     32    // COUNTʸ¤Î¼Â¹Ô 
    3333    function count($table, $where = "", $arrval = array()) { 
    3434        if(strlen($where) <= 0) { 
    … …  
    3737            $sqlse = "SELECT COUNT(*) FROM $table WHERE $where"; 
    3838        } 
    39         // カウント文の実行 
     39        // ¥«¥¦¥ó¥Èʸ¤Î¼Â¹Ô 
    4040        $ret = $this->conn->getOne($sqlse, $arrval); 
    4141        return $ret; 
    … …  
    105105    function getsql($col, $table, $where) { 
    106106        if($where != "") { 
    107             // 引数の$whereを優先して実行する。 
     107            // °ú¿ô¤Î$where¤òÍ¥À褷¤Æ¼Â¹Ô¤¹¤ë¡£ 
    108108            $sqlse = "SELECT $col FROM $table WHERE $where " . $this->groupby . " " . $this->order . " " . $this->option; 
    109109        } else { 
    … …  
    177177     
    178178     
    179     // INSERT文の生成・実行 
    180     // $table   :テーブル名 
    181     // $sqlval  :列名 => 値の格納されたハッシュ配列 
     179    // INSERTʸ¤ÎÀ¸À®¡¦¼Â¹Ô 
     180    // $table   :¥Æ¡¼¥Ö¥ë̾ 
     181    // $sqlval  :Îó̾ => ÃͤγÊǼ¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó 
    182182    function insert($table, $sqlval) { 
    183183        $strcol = ''; 
    … …  
    204204            return false; 
    205205        } 
    206         // 文末の","を削除 
     206        // ʸËö¤Î","¤òºï½ü 
    207207        $strcol = ereg_replace(",$","",$strcol); 
    208         // 文末の","を削除 
     208        // ʸËö¤Î","¤òºï½ü 
    209209        $strval = ereg_replace(",$","",$strval); 
    210210        $sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")"; 
    211211         
    212         // INSERT文の実行 
     212        // INSERTʸ¤Î¼Â¹Ô 
    213213        $ret = $this->conn->query($sqlin, $arrval); 
    214214         
    … …  
    216216    } 
    217217     
    218         // INSERT文の生成・実行 
    219     // $table   :テーブル名 
    220     // $sqlval  :列名 => 値の格納されたハッシュ配列 
     218        // INSERTʸ¤ÎÀ¸À®¡¦¼Â¹Ô 
     219    // $table   :¥Æ¡¼¥Ö¥ë̾ 
     220    // $sqlval  :Îó̾ => ÃͤγÊǼ¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó 
    221221    function fast_insert($table, $sqlval) { 
    222222        $strcol = ''; 
    … …  
    237237            return false; 
    238238        } 
    239         // 文末の","を削除 
     239        // ʸËö¤Î","¤òºï½ü 
    240240        $strcol = ereg_replace(",$","",$strcol); 
    241         // 文末の","を削除 
     241        // ʸËö¤Î","¤òºï½ü 
    242242        $strval = ereg_replace(",$","",$strval); 
    243243        $sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")"; 
    244244         
    245         // INSERT文の実行 
     245        // INSERTʸ¤Î¼Â¹Ô 
    246246        $ret = $this->conn->query($sqlin); 
    247247         
    … …  
    250250     
    251251     
    252     // UPDATE文の生成・実行 
    253     // $table   :テーブル名 
    254     // $sqlval  :列名 => 値の格納されたハッシュ配列 
    255     // $where   :WHERE文字列 
     252    // UPDATEʸ¤ÎÀ¸À®¡¦¼Â¹Ô 
     253    // $table   :¥Æ¡¼¥Ö¥ë̾ 
     254    // $sqlval  :Îó̾ => ÃͤγÊǼ¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó 
     255    // $where   :WHEREʸ»úÎó 
    256256    function update($table, $sqlval, $where = "", $arradd = "", $addcol = "") { 
    257257        $strcol = ''; 
    … …  
    281281        } 
    282282                 
    283         // 文末の","を削除 
     283        // ʸËö¤Î","¤òºï½ü 
    284284        $strcol = ereg_replace(",$","",$strcol); 
    285         // 文末の","を削除 
     285        // ʸËö¤Î","¤òºï½ü 
    286286        $strval = ereg_replace(",$","",$strval); 
    287287         
    … …  
    293293         
    294294        if(is_array($arradd)) { 
    295             // プレースホルダー用に配列を追加 
     295            // ¥×¥ì¡¼¥¹¥Û¥ë¥À¡¼ÍѤËÇÛÎó¤òÄɲà
    296296            foreach($arradd as $val) { 
    297297                $arrval[] = $val; 
    … …  
    299299        } 
    300300         
    301         // INSERT文の実行 
     301        // INSERTʸ¤Î¼Â¹Ô 
    302302        $ret = $this->conn->query($sqlup, $arrval); 
    303303        return $ret;         
    304304    } 
    305305 
    306     // MAX文の実行 
     306    // MAXʸ¤Î¼Â¹Ô 
    307307    function max($table, $col, $where = "", $arrval = array()) { 
    308308        if(strlen($where) <= 0) { 
    … …  
    311311            $sqlse = "SELECT MAX($col) FROM $table WHERE $where"; 
    312312        } 
    313         // MAX文の実行 
     313        // MAXʸ¤Î¼Â¹Ô 
    314314        $ret = $this->conn->getOne($sqlse, $arrval); 
    315315        return $ret; 
    316316    } 
    317317     
    318     // MIN文の実行 
     318    // MINʸ¤Î¼Â¹Ô 
    319319    function min($table, $col, $where = "", $arrval = array()) { 
    320320        if(strlen($where) <= 0) { 
    … …  
    323323            $sqlse = "SELECT MIN($col) FROM $table WHERE $where"; 
    324324        } 
    325         // MIN文の実行 
     325        // MINʸ¤Î¼Â¹Ô 
    326326        $ret = $this->conn->getOne($sqlse, $arrval); 
    327327        return $ret; 
    328328    } 
    329329     
    330     // 特定のカラムの値を取得 
     330    // ÆÃÄê¤Î¥«¥é¥à¤ÎÃͤò¼èÆÀ 
    331331    function get($table, $col, $where = "", $arrval = array()) { 
    332332        if(strlen($where) <= 0) { 
    … …  
    335335            $sqlse = "SELECT $col FROM $table WHERE $where"; 
    336336        } 
    337         // SQL文の実行 
     337        // SQLʸ¤Î¼Â¹Ô 
    338338        $ret = $this->conn->getOne($sqlse, $arrval); 
    339339        return $ret; 
    … …  
    341341     
    342342    function getone($sql, $arrval = array()) { 
    343         // SQL文の実行 
     343        // SQLʸ¤Î¼Â¹Ô 
    344344        $ret = $this->conn->getOne($sql, $arrval); 
    345345        return $ret; 
    … …  
    347347    } 
    348348         
    349     // 一行を取得 
     349    // °ì¹Ô¤ò¼èÆÀ 
    350350    function getrow($table, $col, $where = "", $arrval = array()) { 
    351351        if(strlen($where) <= 0) { 
    … …  
    354354            $sqlse = "SELECT $col FROM $table WHERE $where"; 
    355355        } 
    356         // SQL文の実行 
     356        // SQLʸ¤Î¼Â¹Ô 
    357357        $ret = $this->conn->getRow($sqlse, $arrval); 
    358358         
    … …  
    360360    } 
    361361         
    362     // レコードの削除 
     362    // ¥ì¥³¡¼¥É¤Îºï½ü 
    363363    function delete($table, $where = "", $arrval = array()) { 
    364364        if(strlen($where) <= 0) { 
    … …  
    373373    function nextval($table, $colname) { 
    374374        $sql = ""; 
    375         // postgresqlとmysqlとで処理を分ける 
     375        // postgresql¤Èmysql¤È¤Ç½èÍý¤òʬ¤±¤ë 
    376376        if (DB_TYPE == "pgsql") { 
    377377            $seqtable = $table . "_" . $colname . "_seq"; 
    … …  
    417417    } 
    418418     
    419     // auto_incrementを取得する 
     419    // auto_increment¤ò¼èÆÀ¤¹¤ë 
    420420    function get_auto_increment($table_name){ 
    421         // ロックする 
     421        // ¥í¥Ã¥¯¤¹¤ë 
    422422        $this->BEGIN(); 
    423423         
    424         // 次のIncrementを取得 
     424        // ¼¡¤ÎIncrement¤ò¼èÆÀ 
    425425        $arrRet = $this->getAll("SHOW TABLE STATUS LIKE ?", array($table_name)); 
    426426        $auto_inc_no = $arrRet[0]["Auto_increment"]; 
    427427         
    428         // 値をカウントアップしておく 
     428        // Ãͤò¥«¥¦¥ó¥È¥¢¥Ã¥×¤·¤Æ¤ª¤¯ 
    429429        $this->conn->query("ALTER TABLE $table_name AUTO_INCREMENT=?" , $auto_inc_no + 1); 
    430430         
    431         // 解除する 
     431        // ²ò½ü¤¹¤ë 
    432432        $this->COMMIT(); 
    433433         
Note: See TracChangeset for help on using the changeset viewer.