فهرست منبع

New DB function to check Indexes

AntonLV 10 سال پیش
والد
کامیت
c0fbc05a09
1فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 14 0
      inc/classes/BxDolDb.php

+ 14 - 0
inc/classes/BxDolDb.php

@@ -531,6 +531,20 @@ class BxDolDb extends BxDol implements iBxDolSingleton
         return in_array(strtoupper($sFieldName), $aFields['uppercase']);
     }
 
+	public function isIndexExists($sTable, $sIndexName)
+	{
+		$bIndex = false;
+
+        $aIndexes = $this->getAll("SHOW INDEXES FROM `" . $sTable . "`");
+        foreach($aIndexes as $aIndex)
+			if($aIndex['Key_name'] == $sIndexName) {
+				$bIndex = true;
+				break;
+			}
+
+		return $bIndex;
+	}
+
     public function error($aError)
     {
     	$sErrorType = self::$_aErrors[$aError['code']];