Index: /branches/dev/data/class/SC_Query.php
===================================================================
--- /branches/dev/data/class/SC_Query.php	(revision 337)
+++ /branches/dev/data/class/SC_Query.php	(revision 13291)
@@ -1,4 +1,4 @@
 <?php
-/*
+/**
  * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
  *
@@ -6,55 +6,126 @@
  */
 
+/**
+ *  SC_Query¥¯¥é¥¹
+ *
+ *  @author     LOCKON CO.,LTD.
+ *  @access     public
+ */
 class SC_Query {
-	var $option;
-	var $where;
-	var $conn;
-	var $groupby;
-	var $order;
-	
-	// ¥³¥ó¥¹¥È¥é¥¯¥¿
-	/*
-		$err_disp:¥¨¥é¡¼É½¼¨¤ò¹Ô¤¦¤«
-		$new¡§¿·µ¬¤ËÀÜÂ³¤ò¹Ô¤¦¤«
-	 */
-	function SC_Query($dsn = "", $err_disp = true, $new = false) {
-		$this->conn = new SC_DBconn($dsn, $err_disp, $new);
-		$this->where = "";
-		return $this->conn;
-	}
-	
-	// ¥¨¥é¡¼È½Äê
-	function isError() {
-		if(PEAR::isError($this->conn->conn)) {
-			return true;
-		}
-		return false;
-	}
-	
-	// COUNTÊ¸¤Î¼Â¹Ô
-	function count($table, $where = "", $arrval = array()) {
-		if(strlen($where) <= 0) {
-			$sqlse = "SELECT COUNT(*) FROM $table";
-		} else {
-			$sqlse = "SELECT COUNT(*) FROM $table WHERE $where";
-		}
-		// ¥«¥¦¥ó¥ÈÊ¸¤Î¼Â¹Ô
-		$ret = $this->conn->getOne($sqlse, $arrval);
-		return $ret;
-	}
-	
-	function select($col, $table, $where = "", $arrval = array()){
-		$sqlse = $this->getsql($col, $table, $where);
-		$ret = $this->conn->getAll($sqlse, $arrval);
-		return $ret;
-	}
-
-	function getLastQuery($disp = true) {
-		$sql = $this->conn->conn->last_query;
-		if($disp) { 
-			print($sql.";<br />\n");
-		}
-		return $sql;
-	}
+   /**#@+
+    * @access private
+    */
+    
+   /**
+    * SC_DBConn¥ª¥Ö¥¸¥§¥¯¥È
+    * @var object SC_DBConn
+    */
+    var $conn;
+    
+   /**
+    * LIMIT,OFFSET ¶ç
+    * @var string
+    */
+    var $option;
+    
+   /**
+    * WHERE ¶ç
+    * @var string
+    */
+    var $where;
+    
+   /**
+    * GROUP BY ¶ç
+    * @var string
+    */
+    var $groupby;
+    
+   /**
+    * ORDER BY ¶ç
+    * @var string
+    */
+    var $order;
+    
+    /**#@-*/
+    
+    /**
+     *  SC_Query¥¯¥é¥¹¤Î¥³¥ó¥¹¥È¥é¥¯¥¿
+     *
+     *  @access public
+     *  @param  string  $dsn      DSN¾ðÊó
+     *  @param  boolean $err_disp ¥¨¥é¡¼É½¼¨¤ò¹Ô¤¦¤«¤É¤¦¤«
+     *  @param  boolean $new      ¿·µ¬¤ËDBÀÜÂ³¤ò¹Ô¤¦¤«¤É¤¦¤«
+     */
+    function SC_Query($dsn = "", $err_disp = true, $new = false) {
+        $this->conn = new SC_DBconn($dsn, $err_disp, $new);
+        $this->where   = "";
+        $this->option  = "";
+        $this->groupby = "";
+        return $this->conn; //?
+    }
+    
+    /**
+     *  DB¥¨¥é¡¼¤ÎÈ½Äê
+     *
+     *  @access public
+     *  @return boolean À®¸ù»þ¡§true ¼ºÇÔ»þ¡§false
+     */
+    function isError() {
+        if(PEAR::isError($this->conn->conn)) {
+            return true;
+        }
+        return false;
+    }
+    
+    /**
+     *  COUNTÊ¸¤Î¼Â¹Ô
+     *
+     *  @access public
+     *  @param  string  $table  ¥Æ¡¼¥Ö¥ëÌ¾
+     *  @param  string  $where  WHERE¶ç
+     *  @param  array   $arrval ¥×¥ì¡¼¥¹¥Û¥ë¥À¤ÎÇÛÎó
+     *  @return string  ¥ì¥³¡¼¥É·ï¿ô
+     */
+    function count($table, $where = "", $arrval = array()) {
+        if(strlen($where) <= 0) {
+            $sqlse = "SELECT COUNT(*) FROM $table";
+        } else {
+            $sqlse = "SELECT COUNT(*) FROM $table WHERE $where";
+        }
+        // ¥«¥¦¥ó¥ÈÊ¸¤Î¼Â¹Ô
+        $ret = $this->conn->getOne($sqlse, $arrval);
+        return $ret;
+    }
+    
+    /**
+     *  SELECTÊ¸¤Î¼Â¹Ô
+     *
+     *  @access public
+     *  @param  string  $col    ¥«¥é¥àÌ¾
+     *  @param  string  $table  ¥Æ¡¼¥Ö¥ëÌ¾
+     *  @param  string  $where  WHERE¶ç
+     *  @param  array   $arrval ¥×¥ì¡¼¥¹¥Û¥ë¥À¤ÎÇÛÎó
+     *  @return array   SELECTÊ¸¤Î¼Â¹Ô·ë²Ì
+     */
+    function select($col, $table, $where = "", $arrval = array()){
+        $sqlse = $this->getsql($col, $table, $where);
+        $ret = $this->conn->getAll($sqlse, $arrval);
+        return $ret;
+    }
+    
+    /**
+     *  ºÇ¸å¤Ë¼Â¹Ô¤·¤¿SQLÊ¸¤ò¼èÆÀ¤¹¤ë
+     *
+     *  @access public
+     *  @param  boolean $disp SQLÊ¸¤òprint¤¹¤ë¤«¤É¤¦¤«
+     *  @return string  $disp==false¤Î¾ì¹ç¡§ºÇ¸å¤Ë¼Â¹Ô¤·¤¿SQLÊ¸ $disp==true¤Î¾ì¹ç¡§¤Ê¤·
+     */
+    function getLastQuery($disp = true) {
+        $sql = $this->conn->conn->last_query;
+        if($disp) { 
+            print($sql.";<br />\n");
+        }
+        return $sql;
+    }
 
 	function commit() {
@@ -105,35 +176,59 @@
 	}
 
-	function getsql($col, $table, $where) {
-		if($where != "") {
-			// °ú¿ô¤Î$where¤òÍ¥Àè¤·¤Æ¼Â¹Ô¤¹¤ë¡£
-			$sqlse = "SELECT $col FROM $table WHERE $where " . $this->groupby . " " . $this->order . " " . $this->option;
-		} else {
-			if($this->where != "") {
-					$sqlse = "SELECT $col FROM $table WHERE $this->where " . $this->groupby . " " . $this->order . " " . $this->option;
-				} else {
-					$sqlse = "SELECT $col FROM $table " . $this->groupby . " " . $this->order . " " . $this->option;
-			}
-		}
-		return $sqlse;
-	}
-			
-	function setoption($str) {
-		$this->option = $str;
-	}
-	
-	function setlimitoffset($limit, $offset = 0, $return = false) {
-		if (is_numeric($limit) && is_numeric($offset)){
-			
-			$option.= " LIMIT " . $limit;
-			$option.= " OFFSET " . $offset;
-			
-			if($return){
-				return $option;
-			}else{
-				$this->option.= $option;
-			}
-		}
-	}
+    /**
+     *  SELECTÊ¸¤ò¹½ÃÛ¤¹¤ë
+     *
+     *  @access public
+     *  @param  string  $col    ¥«¥é¥àÌ¾
+     *  @param  string  $table  ¥Æ¡¼¥Ö¥ëÌ¾
+     *  @param  string  $where  WHERE¶ç
+     *  @return string  SQLÊ¸
+     */
+    function getsql($col, $table, $where="") {
+        if($where != "") {
+            // °ú¿ô¤Î$where¤òÍ¥Àè¤·¤Æ¼Â¹Ô¤¹¤ë¡£
+            $sqlse = "SELECT $col FROM $table WHERE $where " . $this->groupby . " " . $this->order . " " . $this->option;
+        } else {
+            if($this->where != "") {
+                    $sqlse = "SELECT $col FROM $table WHERE $this->where " . $this->groupby . " " . $this->order . " " . $this->option;
+                } else {
+                    $sqlse = "SELECT $col FROM $table " . $this->groupby . " " . $this->order . " " . $this->option;
+            }
+        }
+        return $sqlse;
+    }
+    
+    /**
+     *  WHERE,GROUPBY,ORDERBY°Ê³°¤Î¥ª¥×¥·¥ç¥Ê¥ë¤Ê¶ç¤ò¥»¥Ã¥È¤¹¤ë
+     *
+     *  @access public
+     *  @param  string  $str ¥ª¥×¥·¥ç¥ó¤Ë»ÈÍÑ¤¹¤ëÊ¸»úÎó
+     */
+    function setoption($str) {
+        $this->option = $str;
+    }
+    
+    /**
+     *  LIMIT¶ç¡¢OFFSET¶ç¤ò¥»¥Ã¥È¤¹¤ë
+     *
+     *  @access public
+     *  @param  string  $limit  LIMIT¤Î·ï¿ô
+     *  @param  integer $offset OFFSET¤Î·ï¿ô
+     *  @param  string  $return À¸À®¤·¤¿LIMIT,OFFSET¶ç¤òreturn¤¹¤ë¤«¤É¤¦¤«
+     *  @return string  À¸À®¤·¤¿LIMIT,OFFSET¶ç
+     */
+    function setlimitoffset($limit, $offset = 0, $return = false) {
+        if (is_numeric($limit) && is_numeric($offset)){
+            
+            $option.= " LIMIT " . $limit;
+            $option.= " OFFSET " . $offset;
+            
+            if($return){
+                return $option;
+            }else{
+                $this->option.= $option;
+            }
+        }
+    }
 	
 	function setgroupby($str) {
