本文整理匯總了PHP中CIBlockProperty::DropColumnSQL方法的典型用法代碼示例。如果您正苦於以下問題:PHP CIBlockProperty::DropColumnSQL方法的具體用法?PHP CIBlockProperty::DropColumnSQL怎麽用?PHP CIBlockProperty::DropColumnSQL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CIBlockProperty
的用法示例。
在下文中一共展示了CIBlockProperty::DropColumnSQL方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Delete
/**
* <p>Метод удаляет свойство и все его значения. Метод статический.</p>
*
*
* @param int $ID Код свойства.
*
* @return bool <p>В случае успешного удаления возвращается true, иначе - false. </p> <br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockproperty/delete.php
* @author Bitrix
*/
public static function Delete($ID)
{
/** @var CMain $APPLICATION */
global $DB, $APPLICATION;
$ID = IntVal($ID);
$APPLICATION->ResetException();
foreach (GetModuleEvents("iblock", "OnBeforeIBlockPropertyDelete", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
$err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME'];
if ($ex = $APPLICATION->GetException()) {
$err .= ': ' . $ex->GetString();
}
$APPLICATION->throwException($err);
return false;
}
}
foreach (GetModuleEvents("iblock", "OnIBlockPropertyDelete", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID));
}
if (!CIBlockPropertyEnum::DeleteByPropertyID($ID, true)) {
return false;
}
CIBlockSectionPropertyLink::DeleteByProperty($ID);
$rsProperty = CIBlockProperty::GetByID($ID);
$arProperty = $rsProperty->Fetch();
if ($arProperty["VERSION"] == 2) {
if ($arProperty["PROPERTY_TYPE"] == "F") {
if ($arProperty["MULTIPLE"] == "Y") {
$strSql = "\n\t\t\t\t\t\tSELECT\tVALUE\n\t\t\t\t\t\tFROM\tb_iblock_element_prop_m" . $arProperty["IBLOCK_ID"] . "\n\t\t\t\t\t\tWHERE\tIBLOCK_PROPERTY_ID=" . $ID . "\n\t\t\t\t\t";
} else {
$strSql = "\n\t\t\t\t\t\tSELECT\tPROPERTY_" . $ID . " VALUE\n\t\t\t\t\t\tFROM\tb_iblock_element_prop_s" . $arProperty["IBLOCK_ID"] . "\n\t\t\t\t\t\tWHERE\tPROPERTY_" . $ID . " is not null\n\t\t\t\t\t";
}
$res = $DB->Query($strSql);
while ($arr = $res->Fetch()) {
CFile::Delete($arr["VALUE"]);
}
}
if (!$DB->Query("DELETE FROM b_iblock_section_element WHERE ADDITIONAL_PROPERTY_ID=" . $ID, true)) {
return false;
}
$strSql = "\n\t\t\t\tDELETE\n\t\t\t\tFROM b_iblock_element_prop_m" . $arProperty["IBLOCK_ID"] . "\n\t\t\t\tWHERE IBLOCK_PROPERTY_ID=" . $ID . "\n\t\t\t";
if (!$DB->Query($strSql)) {
return false;
}
$arSql = CIBlockProperty::DropColumnSQL("b_iblock_element_prop_s" . $arProperty["IBLOCK_ID"], array("PROPERTY_" . $ID, "DESCRIPTION_" . $ID));
foreach ($arSql as $strSql) {
if (!$DB->DDL($strSql)) {
return false;
}
}
} else {
$res = $DB->Query("SELECT EP.VALUE FROM b_iblock_property P, b_iblock_element_property EP WHERE P.ID=" . $ID . " AND P.ID=EP.IBLOCK_PROPERTY_ID AND P.PROPERTY_TYPE='F'");
while ($arr = $res->Fetch()) {
CFile::Delete($arr["VALUE"]);
}
if (!$DB->Query("DELETE FROM b_iblock_section_element WHERE ADDITIONAL_PROPERTY_ID=" . $ID, true)) {
return false;
}
if (!$DB->Query("DELETE FROM b_iblock_element_property WHERE IBLOCK_PROPERTY_ID=" . $ID, true)) {
return false;
}
}
$seq = new CIBlockSequence($arProperty["IBLOCK_ID"], $ID);
$seq->Drop();
return $DB->Query("DELETE FROM b_iblock_property WHERE ID=" . $ID, true);
}