diff --git a/core/cmdbchangeop.class.inc.php b/core/cmdbchangeop.class.inc.php
index 6801573a3..de8306080 100644
--- a/core/cmdbchangeop.class.inc.php
+++ b/core/cmdbchangeop.class.inc.php
@@ -1,5 +1,5 @@
"priv_changeop",
"db_key_field" => "id",
"db_finalclass_field" => "optype",
+ 'indexes' => array(
+ array('objclass', 'objkey'),
+ )
);
MetaModel::Init_Params($aParams);
//MetaModel::Init_InheritAttributes();
diff --git a/core/cmdbsource.class.inc.php b/core/cmdbsource.class.inc.php
index e831c50ad..c25dfb6bc 100644
--- a/core/cmdbsource.class.inc.php
+++ b/core/cmdbsource.class.inc.php
@@ -1,5 +1,5 @@
0);
+ if (!array_key_exists($sIndexId, $aTableInfo['Indexes'])) return false;
+
+ if ($aFields == null)
+ {
+ // Just searching for the name
+ return true;
+ }
+
+ // Compare the columns
+ $sSearchedIndex = implode(',', $aFields);
+ $sExistingIndex = implode(',', $aTableInfo['Indexes'][$sIndexId]);
+
+ return ($sSearchedIndex == $sExistingIndex);
}
// Returns an array of (fieldname => array of field info)
@@ -537,6 +546,17 @@ class CMDBSource
// Table does not exist
self::$m_aTablesInfo[strtolower($sTableName)] = null;
}
+
+ if (!is_null(self::$m_aTablesInfo[strtolower($sTableName)]))
+ {
+ $aIndexes = self::QueryToArray("SHOW INDEXES FROM `$sTableName`");
+ $aMyIndexes = array();
+ foreach ($aIndexes as $aIndexColumn)
+ {
+ $aMyIndexes[$aIndexColumn['Key_name']][$aIndexColumn['Seq_in_index']-1] = $aIndexColumn['Column_name'];
+ }
+ self::$m_aTablesInfo[strtolower($sTableName)]["Indexes"] = $aMyIndexes;
+ }
}
//public static function EnumTables()
//{
diff --git a/core/event.class.inc.php b/core/event.class.inc.php
index 887d1c4dd..2c1e4ccf8 100644
--- a/core/event.class.inc.php
+++ b/core/event.class.inc.php
@@ -1,5 +1,5 @@
"id",
"db_finalclass_field" => "",
"display_template" => "",
- "order_by_default" => array('date' => false)
+ "order_by_default" => array('date' => false),
+ 'indexes' => array(
+ array('object_id'),
+ )
);
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
diff --git a/core/metamodel.class.php b/core/metamodel.class.php
index 3f2bf2418..fb4b2a29e 100644
--- a/core/metamodel.class.php
+++ b/core/metamodel.class.php
@@ -1,5 +1,5 @@
$aFieldData)
diff --git a/datamodels/1.x/itop-attachments/datamodel.itop-attachments.xml b/datamodels/1.x/itop-attachments/datamodel.itop-attachments.xml
index 1d9ce4740..afa70830e 100644
--- a/datamodels/1.x/itop-attachments/datamodel.itop-attachments.xml
+++ b/datamodels/1.x/itop-attachments/datamodel.itop-attachments.xml
@@ -35,6 +35,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml b/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml
index 1d9ce4740..afa70830e 100755
--- a/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml
+++ b/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml
@@ -35,6 +35,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php
index 3392ae190..52cee410e 100644
--- a/setup/compiler.class.inc.php
+++ b/setup/compiler.class.inc.php
@@ -1,5 +1,5 @@
GetOptionalElement('indexes'))
+ {
+ $aIndexes = array();
+ foreach($oIndexes->getElementsByTagName('index') as $oIndex)
+ {
+ $sIndexId = $oIndex->getAttribute('id');
+ $oAttributes = $oIndex->GetUniqueElement('attributes');
+ foreach($oAttributes->getElementsByTagName('attribute') as $oAttribute)
+ {
+ $aIndexes[$sIndexId][] = $oAttribute->getAttribute('id');
+ }
+ }
+ $aClassParams['indexes'] = var_export($aIndexes, true);
+ }
+
// Finalize class params declaration
//