<?php
/*
 * $RCSfile: DatabaseSqlFragment.class,v $
 *
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2005 Bharat Mediratta
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
 */
/**
 * @version $Revision: 1.4 $ $Date: 2005/08/23 03:49:04 $
 * @package GalleryCore
 * @author Alan Harder <alan.harder@sun.com>
 */

/**
 * Container to store an sql fragment that can be passed to the db abstraction layer.
 *
 * @package GalleryCore
 * @subpackage Storage
 */
class DatabaseSqlFragment {

    /**
     * Internal sql fragment
     *
     * @var string $_fragment
     * @access private
     */
    var $_fragment;

    /**
     * Internal sql values
     *
     * @var array $_values
     * @access private
     */
    var $_values;

    /**
     * Constructor
     *
     * @param string sql fragment
     * @param string values.. variable number of parameters must match
     *                        number of ? markers in sql fragment
     */
    function DatabaseSqlFragment($fragment, $values) {
	$this->_values = func_get_args();
	$this->_fragment = array_shift($this->_values);
    }

    /**
     * The sql fragment
     *
     * @return string the sql fragment
     */
    function getFragment() {
	return $this->_fragment;
    }

    /**
     * Return the values that map into the sql fragment's ? markers
     *
     * @return array the values to go with the sql fragment
     */
    function getValues() {
	return $this->_values;
    }
}
?>
