Location: PHPKode > projects > Entier Studio > entierstudio/framework/dataobject.php
<?php
/**
 * Entier Studio
 *
 * LICENSE
 *
 *	Copyright 2006 Entier Studio team.
 *
 *	Licensed under the Apache License, Version 2.0 (the "License");
 *	you may not use this file except in compliance with the License.
 *	You may obtain a copy of the License at
 *
 *		http://www.apache.org/licenses/LICENSE-2.0
 *
 *	Unless required by applicable law or agreed to in writing, software
 *	distributed under the License is distributed on an "AS IS" BASIS,
 *	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *	See the License for the specific language governing permissions and
 *	limitations under the License.
 *
 * @package    entier.framework
 * @version	   $Id: dataobject.php 81 2008-01-17 23:08:21Z yannromefort $
 * @copyright  Copyright (c) 2006 Entier Studio team. All rights reserved.
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefDataObject")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefDataObject", "1");
    //
    define("PRIMARYKEY", 1);
    define("FOREIGNKEY", 2);
    define("NATURALKEY", 3);
    define("REFLECTKEY", 4);
    define("DISPLAYKEY", 5);
    define("CATALOGKEY", 6);
    define("DEFAULTKEY", 100);
    define("ENCRYPTKEY", 200);
    //
    //-------------------------------------------------------------------------
    //	Class
    class DataObject {
        //---------------------------------------------------------------------
        //	Attributes
        
        /**
         * IDatasource
         * @var	object
         * @quirk not in use!
         */
        var $m_dataSource = null;
        /**
         * Resultset handler
         * @var	integer
         * @see
         */
        var $m_resultId = false;
        /**
         *
         * @var	boolean
         * @see
         */
        var $m_queryErr = false;
        /**
         *
         * @var	array
         * @see
         */
        var $m_errorSet = array();
        /**
         *
         * @var	array
         * @see
         */
        var $m_fieldSet = array();
        /**
         *
         * @var	array
         * @see
         */
        var $m_tableSet = array();
        /**
         *
         * @var	array
         * @see
         */
        var $m_querySet = array();
        /**
         *
         * @var	array
         * @see
         */
        var $m_indexSet = array();
        //---------------------------------------------------------------------
        //	Constructor
        /*
        *
        */
        function DataObject() {
        }
        //---------------------------------------------------------------------
        //	Properties
        //
        //	_FieldSet property
        //
        /*
        * @return	array
        */
        function fieldSet() {
            return ($this->m_fieldSet);
        }
        //	_FieldSet.field_count
        /*
        * @return	integer
        */
        function get_field_count() {
            if (is_array($this->m_fieldSet)) return (count($this->m_fieldSet));
            return (0);
        }
        //	_FieldSet.field_value
        /*
        * @param	string
        * @param	variant
        * @return	boolean
        */
        function set_field_value($field, $value) {
            $this->m_fieldSet["$field"] = $value;
            return (true);
        }
        /*
        * @param	string
        * @return	variant
        */
        function get_field_value($field) {
            if (isset($this->m_fieldSet["$field"])) return ($this->m_fieldSet["$field"]);
            return (false);
        }
        //
        //	_ErrorSet property
        //
        /*
        * @return	array
        */
        function errorSet() {
            return ($this->m_errorSet);
        }
        //	_ErrorSet.field_count
        /*
        * @return	integer
        */
        function get_error_count() {
            if (is_array($this->m_errorSet)) return (count($this->m_errorSet));
            return (0);
        }
        //	_ErrorSet.error_value
        /*
        * @param	string
        * @param	variant
        * @return	boolean
        */
        function set_error_value($field, $value) {
            $this->m_errorSet[$field] = $value;
            return (true);
        }
        /*
        * @param	string
        * @return	variant
        */
        function get_error_value($field) {
            if (isset($this->m_errorSet[$field])) return ($this->m_errorSet[$field]);
            return (false);
        }
        //
        //
        //	_QuerySet property
        //
        /*
        * @return	array
        */
        function querySet() {
            return ($this->m_querySet);
        }
        //	_QuerySet.query_count
        /*
        * @return	integer
        */
        function get_query_count() {
            if (is_array($this->m_querySet)) return (count($this->m_querySet));
            return (0);
        }
        //	_QuerySet.query_value
        /*
        * @param	string
        * @param	variant
        * @return	boolean
        */
        function set_query_value($field, $value) {
            $this->m_querySet[$field] = $value;
            return (true);
        }
        /*
        * @param	string
        * @return	variant
        */
        function get_query_value($field) {
            if (isset($this->m_querySet[$field])) return ($this->m_querySet[$field]);
            return (false);
        }
        //
        //	_IndexSet property
        //
        /*
        * @return	array
        */
        function indexSet() {
            return ($this->m_indexSet);
        }
        //	_IndexSet.index_count
        /*
        * @return	integer
        */
        function get_index_count() {
            if (is_array($this->m_indexSet)) return (count($this->m_indexSet));
            return (0);
        }
        //	_IndexSet.index_value
        /*
        * @param	string
        * @param	variant
        * @return	boolean
        */
        function set_index_field($index, $field) {
            $this->m_indexSet[$index] = $field;
            return (true);
        }
        /*
        * @param	string
        * @return	variant
        */
        function get_index_field($index) {
            if (isset($this->m_indexSet[$index])) return ($this->m_indexSet[$index]);
            return (false);
        }
        //	index_value
        /*
        * @param	string
        * @param	variant
        * @return	boolean
        */
        function set_index_value($index, $value) {
            if (isset($this->m_indexSet[$index])) {
                $field = $this->m_indexSet[$index];
                $this->m_fieldSet["$field"] = $value;
                return (true);
            }
            return (false);
        }
        /*
        * @param	string
        * @return	variant
        */
        function get_index_value($index) {
            if (isset($this->m_indexSet[$index])) {
                $field = $this->m_indexSet[$index];
                if (isset($this->m_fieldSet["$field"])) return ($this->m_fieldSet["$field"]);
            }
            return (false);
        }
        //	_IndexSet.index_table
        /*
        * @param	string
        * @param	variant
        * @return	boolean
        */
        function set_index_table($index, $table) {
            $this->m_tableSet[$index] = $table;
            return (true);
        }
        /*
        * @param	string
        * @return	variant
        */
        function get_index_table($index) {
            if (isset($this->m_tableSet[$index])) return ($this->m_tableSet[$index]);
            return (false);
        }
    };
    //	Class
    //-------------------------------------------------------------------------
    
}
//	namespace
//-----------------------------------------------------------------------------
?>
Return current item: Entier Studio