Optimized the setup (not only), shortened to 37s (used to be 120s)

- DBObject::DBInsert(Tracked)NoReload() must be used when it is not required to use the object
- MetaModel::GetObject() has a cache, the operation is 5 times faster
- Changes tracking do not store the initial value, but only value changes
Reworked the CSV import to have it rely on the bulk change API
Bulk change to check the external keys (DB integrity)
Replaced trigger_error (Core only!) by the use of Exceptions (still, some new Exception classes should be defined)
Unit tests do display the call stack in a user friendly format

SVN:code[52]
This commit is contained in:
Romain Quetiez
2009-04-27 07:27:54 +00:00
parent acbb54104e
commit a4663ebed1
23 changed files with 464 additions and 533 deletions

View File

@@ -46,7 +46,7 @@ class SQLQuery
{
if (!CMDBSource::IsTable($sTable))
{
trigger_error("Unknown table '$sTable'", E_USER_ERROR);
throw new CoreException("Unknown table '$sTable'");
}
// $aFields must be an array of "alias"=>"expr"
// $oConditionExpr must be a condition tree
@@ -137,7 +137,7 @@ class SQLQuery
assert((get_class($oSQLQuery) == __CLASS__) || is_subclass_of($oSQLQuery, __CLASS__));
if (!CMDBSource::IsField($this->m_sTable, $sLeftField))
{
trigger_error("Unknown field '$sLeftField' in table '".$this->m_sTable, E_USER_ERROR);
throw new CoreException("Unknown field '$sLeftField' in table '".$this->m_sTable);
}
if (empty($sRightTableAlias))
{
@@ -147,7 +147,7 @@ class SQLQuery
//
// if (!CMDBSource::IsField($sRightTable, $sRightField))
// {
// trigger_error("Unknown field '$sRightField' in table '".$sRightTable."'", E_USER_ERROR);
// throw new CoreException("Unknown field '$sRightField' in table '".$sRightTable."'");
// }
$this->m_aJoinSelects[] = array(
@@ -187,7 +187,7 @@ class SQLQuery
if ($this->m_oConditionExpr->IsAny())
-- if (count($aConditions) == 0) --
{
trigger_error("Building a request wich will delete every object of a given table -looks suspicious- please use truncate instead...", E_USER_ERROR);
throw new CoreException("Building a request wich will delete every object of a given table -looks suspicious- please use truncate instead...");
}
*/
$sWhere = self::ClauseWhere($oCondition);
@@ -277,7 +277,7 @@ class SQLQuery
$sFrom .= ") ON ".$aJoinInfo["joincondition"];
break;
default:
trigger_error("Unknown jointype: '".$aJoinInfo["jointype"]."'");
throw new CoreException("Unknown jointype: '".$aJoinInfo["jointype"]."'");
}
}
return $sFrom;