<?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.DictionaryPropertyValueSet.php 81 2008-01-17 23:08:21Z yannromefort $
*/
//-----------------------------------------------------------------------------
// namespace
if (!defined("DefDictionaryPropertyValueSet")) {
//-------------------------------------------------------------------------
// Define
define("DefDictionaryPropertyValueSet", "1");
//-------------------------------------------------------------------------
// Include
@require_once (FRAMEWORK_DIR . DATASETOBJECT);
//-------------------------------------------------------------------------
// Class
class DictionaryPropertyValueSet extends DataSet {
//---------------------------------------------------------------------
// Constructor
/*
*
* @param integer DictionaryProperty $DICPROPPKID foreign key
*
*/
function DictionaryPropertyValueSet($DICPROPPKID = 0) {
//
$this->m_tableSet[PRIMARYKEY] = "tbl_dictionary_property_value";
$this->m_indexSet[PRIMARYKEY] = "DICPVALPKID";
$this->m_indexSet[FOREIGNKEY] = "DICPROPPKID";
$this->m_indexSet[NATURALKEY] = "DICPVALNAME";
$this->m_indexSet[REFLECTKEY] = "DICPTYPPKID";
//
$this->m_querySet["DICPROPPKID"] = $DICPROPPKID;
}
//---------------------------------------------------------------------
// Methods
/**
*
* @access protected
*
* @param integer Index Type
* @return string SQL query
*
*/
function getDeleteQuery($indexType = FOREIGNKEY) {
//
$table = $this->m_tableSet[PRIMARYKEY];
//
switch ($indexType) {
case FOREIGNKEY:
/*
*
* DELETE
* tbl_dictionary_property_value
* -> tbl_repository_core_element_property_value
* -> tbl_repository_model_element_property_value
* -> tbl_repository_core_element_property_value
* -> tbl_repository_model_resource_property_value
* -> tbl_objectory_element_property_value
* ON
* DICPROPPKID
*
*/
//
$field = $this->m_indexSet[FOREIGNKEY];
$index = $this->m_querySet[$field];
if ($index != 0) return ("
DELETE
t1,
t2,
t3,
t4,
t5
FROM
tbl_dictionary_property_value as t1
LEFT JOIN
tbl_repository_core_element_property_value as t2
ON
t2.DICPVALPKID=t1.DICPVALPKID
LEFT JOIN
tbl_repository_model_element_property_value as t3
ON
t3.DICPVALPKID=t1.DICPVALPKID
LEFT JOIN
tbl_repository_model_resource_property_value as t4
ON
t4.DICPVALPKID=t1.DICPVALPKID
LEFT JOIN
tbl_objectory_element_property_value as t5
ON
t5.DICPVALPKID=t1.DICPVALPKID
WHERE
t1.DICPROPPKID=$index");
//
break;
}
//
return ("");
}
/*
*
* @access protected
*
* @param integer index type
* @param integer order type
* @param string order mode
*
*/
function getSelectQuery($indexType = FOREIGNKEY, $orderType = NATURALKEY, $orderMode = "") {
//
switch ($indexType) {
case FOREIGNKEY:
/*
*
* SELECT tbl_dictionary_property_value <-> tbl_dictionary_property
* ON DICPROPPKID
*
* @see class RepositoryCoreElementPropertySet
* @see class RepositoryModelElementPropertySet
*/
$index = $this->m_querySet["DICPROPPKID"];
if ($index != 0) {
//
$selectSQL = "SELECT
t1.DICPVALPKID,
t1.DICPVALNAME,
t1.DICPVALCODE,
t1.DICPVALTYPE,
t2.DICPROPPKID,
t2.DICPROPNAME
FROM
tbl_dictionary_property_value as t1,
tbl_dictionary_property as t2
WHERE
t1.DICPVALSTAT>0
AND
t1.DICPROPPKID=$index
AND
t1.DICPROPPKID=t2.DICPROPPKID";
//
switch ($orderType) {
case PRIMARYKEY:
return ($selectSQL . " ORDER BY t1.DICPVALPKID $orderMode");
case NATURALKEY:
return ($selectSQL . " ORDER BY t1.DICPVALNAME $orderMode");
default:
return ($selectSQL . " ORDER BY t1.DICPVALNAME");
}
}
//
break;
}
//
return ("");
}
};
// Class
//-------------------------------------------------------------------------
}
// namespace
//-----------------------------------------------------------------------------
?>