- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/classes/mysql/cml2.php
- Класс: is
- Вызов: is::Add
function Add($arFields)
{
global $DB;
$strSql1 = "PARENT_ID, LEFT_MARGIN, RIGHT_MARGIN, DEPTH_LEVEL, NAME";
$strSql2 = (int)$arFields["PARENT_ID"] .", "
. (int)$arFields["LEFT_MARGIN"] . ", "
. (int)($arFields["RIGHT_MARGIN"] ?? 0) . ", "
. (int)($arFields["DEPTH_LEVEL"] ?? 0) .", '"
. $DB->ForSQL($arFields["NAME"] ?? '', 255)
."'"
;
if (isset($arFields["ATTRIBUTES"]))
{
$strSql1 .= ", ATTRIBUTES";
$strSql2 .= ", '".$DB->ForSQL($arFields["ATTRIBUTES"])."'";
}
if (isset($arFields["VALUE"]))
{
$strSql1 .= ", VALUE";
$strSql2 .= ", '".$DB->ForSQL($arFields["VALUE"])."'";
}
if($this->_sessid)
{
$strSql1 .= ", SESS_ID";
$strSql2 .= ", '".$DB->ForSQL($this->_sessid)."'";
}
$strSql = "INSERT INTO ".$this->_table_name." (".$strSql1.") VALUES (".$strSql2.")";
$DB->Query($strSql);
return $DB->LastID();
}