Ignore:
Timestamp:
2007/07/20 15:58:59 (17 years ago)
Author:
nanasess
Message:

r15064 から svn cp
とりあえず暫定コミット.

  • UTF-8 に変更
  • slib.php, glib.php のクラス化
  • LC_Page の抽象化(一部)
Location:
branches/feature-module-update
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update

    • Property svn:ignore set to
      .cache

      .settings

      .projectOptions
  • branches/feature-module-update/data/class/SC_Query.php

    r14921 r15078  
    1313    var $order; 
    1414     
    15     // ¥³¥ó¥¹¥È¥é¥¯¥¿ 
     15    // コンストラクタ 
    1616    /* 
    17         $err_disp:¥¨¥é¡¼É½¼¨¤ò¹Ô¤¦¤« 
    18         $new¡§¿·µ¬¤ËÀܳ¤ò¹Ô¤¦¤« 
     17        $err_disp:エラー表示を行うか 
     18        $new:新規に接続を行うか 
    1919     */ 
    2020    function SC_Query($dsn = "", $err_disp = true, $new = false) { 
     
    2424    } 
    2525     
    26     // ¥¨¥é¡¼È½Äê 
     26    // エラー判定 
    2727    function isError() { 
    2828        if(PEAR::isError($this->conn->conn)) { 
     
    3232    } 
    3333     
    34     // COUNTʸ¤Î¼Â¹Ô 
     34    // COUNT文の実行 
    3535    function count($table, $where = "", $arrval = array()) { 
    3636        if(strlen($where) <= 0) { 
     
    3939            $sqlse = "SELECT COUNT(*) FROM $table WHERE $where"; 
    4040        } 
    41         // ¥«¥¦¥ó¥Èʸ¤Î¼Â¹Ô 
     41        // カウント文の実行 
    4242        $ret = $this->conn->getOne($sqlse, $arrval); 
    4343        return $ret; 
     
    107107    function getsql($col, $table, $where) { 
    108108        if($where != "") { 
    109             // °ú¿ô¤Î$where¤òÍ¥À褷¤Æ¼Â¹Ô¤¹¤ë¡£ 
     109            // 引数の$whereを優先して実行する。 
    110110            $sqlse = "SELECT $col FROM $table WHERE $where " . $this->groupby . " " . $this->order . " " . $this->option; 
    111111        } else { 
     
    179179     
    180180     
    181     // INSERTʸ¤ÎÀ¸À®¡¦¼Â¹Ô 
    182     // $table   :¥Æ¡¼¥Ö¥ë̾ 
    183     // $sqlval  :Îó̾ => ÃͤγÊǼ¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó 
     181    // INSERT文の生成・実行 
     182    // $table   :テーブル名 
     183    // $sqlval  :列名 => 値の格納されたハッシュ配列 
    184184    function insert($table, $sqlval) { 
    185185        $strcol = ''; 
     
    206206            return false; 
    207207        } 
    208         // ʸËö¤Î","¤òºï½ü 
     208        // 文末の","を削除 
    209209        $strcol = ereg_replace(",$","",$strcol); 
    210         // ʸËö¤Î","¤òºï½ü 
     210        // 文末の","を削除 
    211211        $strval = ereg_replace(",$","",$strval); 
    212212        $sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")"; 
    213213         
    214         // INSERTʸ¤Î¼Â¹Ô 
     214        // INSERT文の実行 
    215215        $ret = $this->conn->query($sqlin, $arrval); 
    216216         
     
    218218    } 
    219219     
    220         // INSERTʸ¤ÎÀ¸À®¡¦¼Â¹Ô 
    221     // $table   :¥Æ¡¼¥Ö¥ë̾ 
    222     // $sqlval  :Îó̾ => ÃͤγÊǼ¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó 
     220        // INSERT文の生成・実行 
     221    // $table   :テーブル名 
     222    // $sqlval  :列名 => 値の格納されたハッシュ配列 
    223223    function fast_insert($table, $sqlval) { 
    224224        $strcol = ''; 
     
    239239            return false; 
    240240        } 
    241         // ʸËö¤Î","¤òºï½ü 
     241        // 文末の","を削除 
    242242        $strcol = ereg_replace(",$","",$strcol); 
    243         // ʸËö¤Î","¤òºï½ü 
     243        // 文末の","を削除 
    244244        $strval = ereg_replace(",$","",$strval); 
    245245        $sqlin = "INSERT INTO $table(" . $strcol. ") VALUES (" . $strval . ")"; 
    246246         
    247         // INSERTʸ¤Î¼Â¹Ô 
     247        // INSERT文の実行 
    248248        $ret = $this->conn->query($sqlin); 
    249249         
     
    252252     
    253253     
    254     // UPDATEʸ¤ÎÀ¸À®¡¦¼Â¹Ô 
    255     // $table   :¥Æ¡¼¥Ö¥ë̾ 
    256     // $sqlval  :Îó̾ => ÃͤγÊǼ¤µ¤ì¤¿¥Ï¥Ã¥·¥åÇÛÎó 
    257     // $where   :WHEREʸ»úÎó 
     254    // UPDATE文の生成・実行 
     255    // $table   :テーブル名 
     256    // $sqlval  :列名 => 値の格納されたハッシュ配列 
     257    // $where   :WHERE文字列 
    258258    function update($table, $sqlval, $where = "", $arradd = "", $addcol = "") { 
    259259        $strcol = ''; 
     
    283283        } 
    284284                 
    285         // ʸËö¤Î","¤òºï½ü 
     285        // 文末の","を削除 
    286286        $strcol = ereg_replace(",$","",$strcol); 
    287         // ʸËö¤Î","¤òºï½ü 
     287        // 文末の","を削除 
    288288        $strval = ereg_replace(",$","",$strval); 
    289289         
     
    295295         
    296296        if(is_array($arradd)) { 
    297             // ¥×¥ì¡¼¥¹¥Û¥ë¥À¡¼ÍѤËÇÛÎó¤òÄɲà
     297            // プレースホルダー用に配列を追加 
    298298            foreach($arradd as $val) { 
    299299                $arrval[] = $val; 
     
    301301        } 
    302302         
    303         // INSERTʸ¤Î¼Â¹Ô 
     303        // INSERT文の実行 
    304304        $ret = $this->conn->query($sqlup, $arrval); 
    305305        return $ret;         
    306306    } 
    307307 
    308     // MAXʸ¤Î¼Â¹Ô 
     308    // MAX文の実行 
    309309    function max($table, $col, $where = "", $arrval = array()) { 
    310310        if(strlen($where) <= 0) { 
     
    313313            $sqlse = "SELECT MAX($col) FROM $table WHERE $where"; 
    314314        } 
    315         // MAXʸ¤Î¼Â¹Ô 
     315        // MAX文の実行 
    316316        $ret = $this->conn->getOne($sqlse, $arrval); 
    317317        return $ret; 
    318318    } 
    319319     
    320     // MINʸ¤Î¼Â¹Ô 
     320    // MIN文の実行 
    321321    function min($table, $col, $where = "", $arrval = array()) { 
    322322        if(strlen($where) <= 0) { 
     
    325325            $sqlse = "SELECT MIN($col) FROM $table WHERE $where"; 
    326326        } 
    327         // MINʸ¤Î¼Â¹Ô 
     327        // MIN文の実行 
    328328        $ret = $this->conn->getOne($sqlse, $arrval); 
    329329        return $ret; 
    330330    } 
    331331     
    332     // ÆÃÄê¤Î¥«¥é¥à¤ÎÃͤò¼èÆÀ 
     332    // 特定のカラムの値を取得 
    333333    function get($table, $col, $where = "", $arrval = array()) { 
    334334        if(strlen($where) <= 0) { 
     
    337337            $sqlse = "SELECT $col FROM $table WHERE $where"; 
    338338        } 
    339         // SQLʸ¤Î¼Â¹Ô 
     339        // SQL文の実行 
    340340        $ret = $this->conn->getOne($sqlse, $arrval); 
    341341        return $ret; 
     
    343343     
    344344    function getone($sql, $arrval = array()) { 
    345         // SQLʸ¤Î¼Â¹Ô 
     345        // SQL文の実行 
    346346        $ret = $this->conn->getOne($sql, $arrval); 
    347347        return $ret; 
     
    349349    } 
    350350         
    351     // °ì¹Ô¤ò¼èÆÀ 
     351    // 一行を取得 
    352352    function getrow($table, $col, $where = "", $arrval = array()) { 
    353353        if(strlen($where) <= 0) { 
     
    356356            $sqlse = "SELECT $col FROM $table WHERE $where"; 
    357357        } 
    358         // SQLʸ¤Î¼Â¹Ô 
     358        // SQL文の実行 
    359359        $ret = $this->conn->getRow($sqlse, $arrval); 
    360360         
     
    362362    } 
    363363         
    364     // ¥ì¥³¡¼¥É¤Îºï½ü 
     364    // レコードの削除 
    365365    function delete($table, $where = "", $arrval = array()) { 
    366366        if(strlen($where) <= 0) { 
     
    375375    function nextval($table, $colname) { 
    376376        $sql = ""; 
    377         // postgresql¤Èmysql¤È¤Ç½èÍý¤òʬ¤±¤ë 
     377        // postgresqlとmysqlとで処理を分ける 
    378378        if (DB_TYPE == "pgsql") { 
    379379            $seqtable = $table . "_" . $colname . "_seq"; 
     
    419419    } 
    420420     
    421     // auto_increment¤ò¼èÆÀ¤¹¤ë 
     421    // auto_incrementを取得する 
    422422    function get_auto_increment($table_name){ 
    423         // ¥í¥Ã¥¯¤¹¤ë 
     423        // ロックする 
    424424        $this->query("LOCK TABLES $table_name WRITE"); 
    425425         
    426         // ¼¡¤ÎIncrement¤ò¼èÆÀ 
     426        // 次のIncrementを取得 
    427427        $arrRet = $this->getAll("SHOW TABLE STATUS LIKE ?", array($table_name)); 
    428428        $auto_inc_no = $arrRet[0]["Auto_increment"]; 
    429429         
    430         // Ãͤò¥«¥¦¥ó¥È¥¢¥Ã¥×¤·¤Æ¤ª¤¯ 
     430        // 値をカウントアップしておく 
    431431        $this->conn->query("ALTER TABLE $table_name AUTO_INCREMENT=?" , $auto_inc_no + 1); 
    432432         
    433         // ²ò½ü¤¹¤ë 
     433        // 解除する 
    434434        $this->query('UNLOCK TABLES'); 
    435435         
Note: See TracChangeset for help on using the changeset viewer.