<?php
/**
* SQL条件クラス
*
* PHP version 5
*
* @package    components.db
* @author     stk2k <stk2k@sazysoft.com>
* @copyright  2008 stk2k, sazysoft
*/
class SQLCriteria
{
	var $_where;
	var $_params;
	var $_order_by;
	var $_limit;
	var $_offset;

	/*
	 *    コンストラクタ
	 */
	public function __construct( $where = NULL, $params = NULL, $order_by = NULL, $limit = NULL, $offset = NULL )
	{
		$this->_where     = $where;
		$this->_params    = $params;
		$this->_order_by  = $order_by;
		$this->_limit     = $limit;
		$this->_offset    = $offset;
	}

	/*
	 * WHERE句を取得
	 */
	public function getWhereClause()
	{
		return $this->_where;
	}

	/*
	 * WHERE句を設定
	 */
	public function setWhereClause( $where )
	{
		$this->_where = $where;
	}

	/*
	 * パラメータを取得
	 */
	public function getParams()
	{
		return $this->_params;
	}

	/*
	 * パラメータを設定
	 */
	public function setParams( $params )
	{
		$this->_params = $params;
	}

	/*
	 * ORDER BY句を取得
	 */
	public function getOrderBy()
	{
		return $this->_order_by;
	}

	/*
	 * ORDER BY句を設定
	 */
	public function setOrderBy( $order_by )
	{
		$this->_order_by = $order_by;
	}

	/*
	 * LIMIT句を取得
	 */
	public function getLimit()
	{
		return $this->_limit;
	}

	/*
	 * LIMIT句を設定
	 */
	public function setLimit( $limit )
	{
		$this->_limit = $limit;
	}

	/*
	 * OFFSET句を取得
	 */
	public function getOffset()
	{
		return $this->_offset;
	}

	/*
	 * OFFSET句を設定
	 */
	public function setOffset( $offset )
	{
		$this->_offset = $offset;
	}

	/*
	 * 文字列化
	 */
	public function __toString()
	{
		$str  = "[SQLCondition: ";
		$str .= "where=" . $this->_where;
		$str .= "params=" . $this->_params;
		$str .= "order_by=" . $this->_order_by;
		$str .= "limit=" . $this->_limit;
		$str .= "offset=" . $this->_offset;
		$str .= "]";

		return $str;
	}
}
