<?php

/* SQL Select Query Class */

class Query
{
	private $oMySql;
	
	private $asSelections;
	private $asSources;
	private $asConstraints;
	private $asOrders;
	private $asGroups;
	
	function __construct($oMySql)
	{
		$this->oMySql = $oMySql;
		$asSelections = $asSources = $asConstraints = $asOrders = $asGroups = array();
	}
	
	public function addSelect()
	{
		
	}

	/*
	function selectRows($asInfo)
	{
		$sAttributes = array('select'=>"SELECT", 'from'=>"FROM", 'constraint'=>"WHERE", 'groupBy'=>"GROUP BY", 'orderBy'=>"ORDER BY");
		$asRowSeparators = array('select'=>", ", 'from'=>"", 'constraint'=>" AND ", 'groupBy'=>", ", 'orderBy'=>", ");
		$asOperators = array('constraint'=>" = ", 'orderBy'=>" ");
		
		$sQuery = "";
		foreach($sAttributes as $sStatement => $sKeyWord)
		{
			$asSelection = array_key_exists($sStatement, $asInfo)?$asInfo[$sStatement]:array();
			if(!is_array($asSelection))
			{
				$asSelection = array($asSelection);
			}
			
			//if provided values
			if(count($asSelection)>0)
			{
				cleanSql($asSelection);
				$sQuery .= " ".$sKeyWord." ";
				
				//in case of double value input
				if(array_key_exists($sStatement, $asOperators))
				{
					$sQuery .= implodeAll($asSelection, $asOperators[$sStatement], $asRowSeparators[$sStatement]);
				}
				else
				{
					$sQuery .= implode($asRowSeparators[$sStatement], $asSelection);
				}
			}
			//default value for select
			elseif($sStatement=='select')
			{
				$sQuery .= " ".$sKeyWord." * ";
			}
		}
		
		return getArrayQuery($sQuery, true);
	}
	
	function implodeAll($asText, $sKeyValueSeparator='',  $sRowSeparator='', $sKeyPre='', $sValuePost=false)
	{
		if($sValuePost===false)
		{
			$sValuePost = $sKeyPre;
		}
		$asCombinedText = array();
		foreach($asText as $sKey=>$sValue)
		{
			$asCombinedText[] = $sKeyPre.$sKey.$sKeyValueSeparator.$sValue.$sValuePost;
		}
		return implode($sRowSeparator, $asCombinedText);
	}
	*/
}

?>