private function GetWhereSQL($criteria)
	{
		$ands = $criteria->GetAnds();
		$ors = $criteria->GetOrs();
		
		// TODO: this all needs to move to the criteria object so it will recurse properly  ....
		$where = $this->RemoveWherePrefix($criteria->GetWhere());
		
		if (count($ands))
		{
			$wdelim = ($where) ? " and " : "";
			foreach($ands as $c)
			{
				$tmp = $c->GetWhere();
				$buff = $this->RemoveWherePrefix($tmp);
				if ($buff)
				{
					$where .= $wdelim . $buff;
					$wdelim = " and ";
				}
			}
		}
		
		if (count($ors))
		{
			$where = trim($where) ? "(" . $where . ")" : ""; // no primary criteria.  kinda strange
			$wdelim = $where ? " or " : "";
				
			foreach($ors as $c)
			{
				$tmp = $c->GetWhere();
				$buff = $this->RemoveWherePrefix($tmp);
				if ($buff)
				{
					$where .= $wdelim . "(" . $buff . ")";
					$wdelim = " or ";
				}
			}
		}
		
		// .. end of stuff that should be in criteria	

		// prepend the "where" onto the statement
		if ($where) $where = " where (" . trim($where) . ") ";
		
		return $where;
	}