Read-only mode - draft

SVN:trunk[961]
This commit is contained in:
Romain Quetiez
2010-11-22 14:13:49 +00:00
parent b30d6c4888
commit d0f168adbb
5 changed files with 79 additions and 7 deletions

View File

@@ -849,7 +849,14 @@ abstract class DBObject
$sInsertSQL = "INSERT INTO `$sTable` (".join(",", $aFieldsToWrite).") VALUES (".join(", ", $aValuesToWrite).")";
$iNewKey = CMDBSource::InsertInto($sInsertSQL);
if (MetaModel::DBIsReadOnly())
{
$iNewKey = -1;
}
else
{
$iNewKey = CMDBSource::InsertInto($sInsertSQL);
}
// Note that it is possible to have a key defined here, and the autoincrement expected, this is acceptable in a non root class
if (empty($this->m_iKey))
{
@@ -1009,7 +1016,10 @@ abstract class DBObject
$oFilter->AddCondition('id', $this->m_iKey, '=');
$sSQL = MetaModel::MakeUpdateQuery($oFilter, $aChanges);
CMDBSource::Query($sSQL);
if (!MetaModel::DBIsReadOnly())
{
CMDBSource::Query($sSQL);
}
}
$this->DBWriteLinks();
@@ -1053,7 +1063,10 @@ abstract class DBObject
$this->OnDelete();
$sSQL = MetaModel::MakeDeleteQuery($oFilter);
CMDBSource::Query($sSQL);
if (!MetaModel::DBIsReadOnly())
{
CMDBSource::Query($sSQL);
}
$this->AfterDelete();