<?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.RepositoryCoreElementPropertyValue.php 81 2008-01-17 23:08:21Z yannromefort $
*/
//-----------------------------------------------------------------------------
// namespace
if (!defined("DefRepositoryCoreElementPropertyValue")) {
//-------------------------------------------------------------------------
// Define
define("DefRepositoryCoreElementPropertyValue", "1");
//-------------------------------------------------------------------------
// Include
@require_once (FRAMEWORK_DIR . DATAROWOBJECT);
//-------------------------------------------------------------------------
// Class
class RepositoryCoreElementPropertyValue extends DataRow {
//---------------------------------------------------------------------
// Constructor
/**
*
* @param integer RepositoryCoreElementPropertyValue REPCEPVPKID primary key
*/
function RepositoryCoreElementPropertyValue($REPCEPVPKID = 0) {
//
$this->m_tableSet[PRIMARYKEY] = "tbl_repository_core_element_property_value";
//
$this->m_indexSet[PRIMARYKEY] = "REPCEPVPKID";
$this->m_indexSet[FOREIGNKEY] = "REPCELEPKID";
//
$this->m_fieldSet["REPCEPVPKID"] = $REPCEPVPKID;
}
//-------------------------------------------------------------------------
// 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 ( ";
// REPCEPRPKID : Repository core element property
$value = $this->m_fieldSet["REPCEPRPKID"];
if (!empty($value)) {
$insertSQL.= " REPCEPRPKID";
$valuesSQL.= " $value";
} else {
$this->m_errorSet["REPCEPRPKID"] = true;
return ("");
}
// REPCELEPKID : Repository core element
$value = $this->m_fieldSet["REPCELEPKID"];
if (!empty($value)) {
$insertSQL.= " ,REPCELEPKID";
$valuesSQL.= " ,$value";
} else {
$this->m_errorSet["REPCELEPKID"] = true;
return ("");
}
// DICPVALPKID : Dictionary property value
$value = $this->m_fieldSet["DICPVALPKID"];
if (!empty($value)) {
$insertSQL.= " ,DICPVALPKID";
$valuesSQL.= " ,$value";
}
// REPCEPVDATA
$value = $this->m_fieldSet["REPCEPVDATA"];
if (!empty($value)) {
$insertSQL.= " ,REPCEPVDATA";
$valuesSQL.= " ,\"$value\"";
}
//
$value = Date("Y-m-d H:i:s");
$insertSQL.= " , REPCEPVDATE";
$valuesSQL.= " ,\"$value\"";
//
$value = 1;
$insertSQL.= " , REPCEPVSTAT";
$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 REPCEPVSTAT=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 = REPCEPVPKID
$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
//-----------------------------------------------------------------------------
?>