Ignore:
Timestamp:
2007/03/10 21:35:02 (20 years ago)
Author:
nanasess
Message:

UTF-8 へ変換

File:
1 edited

Legend:

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

    r15 r11729  
    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.