Location: PHPKode > projects > Entier Studio > entierstudio/studio/classes/datas/data.RepositoryModelElementPropertyValue.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.RepositoryModelElementPropertyValue.php 81 2008-01-17 23:08:21Z yannromefort $
 */
//-----------------------------------------------------------------------------
//	namespace
if (!defined("DefRepositoryModelElementPropertyValue")) {
    //-------------------------------------------------------------------------
    //	Define
    define("DefRepositoryModelElementPropertyValue", "1");
    //-------------------------------------------------------------------------
    //	Include
    @require_once (FRAMEWORK_DIR . DATAROWOBJECT);
    //-------------------------------------------------------------------------
    //	Class
    class RepositoryModelElementPropertyValue extends DataRow {
        //---------------------------------------------------------------------
        //	Constructor
        
        /**
         *
         * @param	integer	 REPMEPVPKID Repository model element property value
         */
        function RepositoryModelElementPropertyValue($REPMEPVPKID = 0) {
            //
            $this->m_tableSet[PRIMARYKEY] = "tbl_repository_model_element_property_value";
            //
            $this->m_indexSet[PRIMARYKEY] = "REPMEPVPKID";
            $this->m_indexSet[FOREIGNKEY] = "REPMELEPKID";
            //
            $this->m_fieldSet["REPMEPVPKID"] = $REPMEPVPKID;
        }
        //-------------------------------------------------------------------------
        //	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 ("");
            }
            //	REPMELEPKID : Repository model element
            $value = $this->m_fieldSet["REPMELEPKID"];
            if (!empty($value)) {
                $insertSQL.= " ,REPMELEPKID";
                $valuesSQL.= " ,$value";
            } else {
                $this->m_errorSet["REPMELEPKID"] = true;
                return ("");
            }
            //	DICPVALPKID : Dictionary property value
            $value = $this->m_fieldSet["DICPVALPKID"];
            if (!empty($value)) {
                $insertSQL.= " ,DICPVALPKID";
                $valuesSQL.= " ,$value";
            }
            //	REPMEPVDATA
            $value = $this->m_fieldSet["REPMEPVDATA"];
            if (!empty($value)) {
                $insertSQL.= " ,REPMEPVDATA";
                $valuesSQL.= " ,\"$value\"";
            }
            //
            $value = Date("Y-m-d H:i:s");
            $insertSQL.= " , REPMEPVDATE";
            $valuesSQL.= " ,\"$value\"";
            //
            $value = 1;
            $insertSQL.= " , REPMEPVSTAT";
            $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  REPMEPVSTAT=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 = REPMEPVPKID
                    $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