Location: PHPKode > projects > Entier Studio > entierstudio/studio/classes/datas/data.RepositoryModelResourcePropertyValue.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.studio
 * @copyright  Copyright (c) 2006 Entier Studio team. All rights reserved.
 * @version	   $Id: data.RepositoryModelResourcePropertyValue.php 81 2008-01-17 23:08:21Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefRepositoryModelResourcePropertyValue")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefRepositoryModelResourcePropertyValue", "1");
    //-------------------------------------------------------------------------
    //	Include
    @require_once (FRAMEWORK_DIR . DATAROWOBJECT);
    //-------------------------------------------------------------------------
    //	Class
    class RepositoryModelResourcePropertyValue extends DataRow {
        //---------------------------------------------------------------------
        //	Constructor
        
        /**
         *
         * @param	integer	 REPMRPVPKID Repository model element property value
         */
        function RepositoryModelResourcePropertyValue($REPMRPVPKID = 0) {
            //
            $this->m_tableSet[PRIMARYKEY] = "tbl_repository_model_resource_property_value";
            //
            $this->m_indexSet[PRIMARYKEY] = "REPMRPVPKID";
            $this->m_indexSet[FOREIGNKEY] = "REPMRESPKID";
            //
            $this->m_fieldSet["REPMRPVPKID"] = $REPMRPVPKID;
        }
        //-------------------------------------------------------------------------
        //	Methods
        
        /**
         *
         * @param	integer	 index type
         * @param	integer	 order type
         * @param	integer	 order mode
         * @return	string
         */
        function getInsertQuery($indexType = FOREIGNKEY) {
            //
            $table = $this->m_tableSet[PRIMARYKEY];
            //
            $insertSQL = "INSERT INTO $table ( ";
            $valuesSQL = "VALUES ( ";
            //	REPMEPRPKID : Repository model element property
            $value = $this->m_fieldSet["REPMEPRPKID"];
            if (!empty($value)) {
                $insertSQL.= "  REPMEPRPKID";
                $valuesSQL.= "  $value";
            } else {
                $this->m_errorSet["REPMEPRPKID"] = true;
                return ("");
            }
            //	REPMRESPKID : Repository model resource
            $value = $this->m_fieldSet["REPMRESPKID"];
            if (!empty($value)) {
                $insertSQL.= " ,REPMRESPKID";
                $valuesSQL.= " ,$value";
            } else {
                $this->m_errorSet["REPMRESPKID"] = true;
                return ("");
            }
            //	DICPVALPKID : Dictionary property value
            $value = $this->m_fieldSet["DICPVALPKID"];
            if (!empty($value)) {
                $insertSQL.= " ,DICPVALPKID";
                $valuesSQL.= " ,$value";
            }
            //	REPMRPVDATA
            $value = $this->m_fieldSet["REPMRPVDATA"];
            if (!empty($value)) {
                $insertSQL.= " ,REPMRPVDATA";
                $valuesSQL.= " ,\"$value\"";
            }
            //
            $value = Date("Y-m-d H:i:s");
            $insertSQL.= " , REPMRPVDATE";
            $valuesSQL.= " ,\"$value\"";
            //
            $value = 1;
            $insertSQL.= " , REPMRPVSTAT";
            $valuesSQL.= " ,$value";
            //
            return ($insertSQL . ") " . $valuesSQL . ")");
        }
        /**
         *
         * @param	integer	 index type
         * @return	string
         */
        function getUpdateQuery($indexType = PRIMARYKEY) {
            //
            $table = $this->m_tableSet[PRIMARYKEY];
            //
            switch ($indexType) {
                case PRIMARYKEY:
                    # index = Pkid
                    $field = $this->m_indexSet[PRIMARYKEY];
                    $index = $this->m_fieldSet["$field"];
                    if ($index != 0) return ("UPDATE $table SET  REPMRPVSTAT=0 WHERE $field=$index");
                    break;
                }
                //
                return ("");
        }
        /**
         *
         * @param	integer	 index type
         * @return	string
         */
        function getSelectQuery($indexType = PRIMARYKEY) {
            //
            $table = $this->m_tableSet[PRIMARYKEY];
            //
            switch ($indexType) {
                case PRIMARYKEY:
                    # index = REPMRPVPKID
                    $field = $this->m_indexSet["$indexType"];
                    $index = $this->m_fieldSet["$field"];
                    if ($index != 0) return ("SELECT t1.*FROM $table as t1WHERE t1.$field=$index");
                    break;
                }
                //
                return ("");
        }
    };
    //	Class
    //-------------------------------------------------------------------------
    
}
//	namespace
//-----------------------------------------------------------------------------
?>
Return current item: Entier Studio