- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/mysql/usertype.php
- Класс: CUserTypeEntity
- Вызов: CUserTypeEntity::CreatePropertyTables
function CreatePropertyTables($entity_id)
{
global $DB, $APPLICATION;
if(!$DB->TableExists("b_utm_".strtolower($entity_id)))
{
if(defined("MYSQL_TABLE_TYPE"))
$DB->Query("SET storage_engine = '".MYSQL_TABLE_TYPE."'", true);
$rs = $DB->Query("
create table IF NOT EXISTS b_utm_".strtolower($entity_id)." (
ID int(11) not null auto_increment,
VALUE_ID int(11) not null,
FIELD_ID int(11) not null,
VALUE text,
VALUE_INT int,
VALUE_DOUBLE float,
VALUE_DATE datetime,
INDEX ix_utm_".$entity_id."_2(VALUE_ID),
INDEX ix_utm_".$entity_id."_4(FIELD_ID, VALUE_ID, VALUE_INT),
PRIMARY KEY (ID)
)
", false, "FILE: ".__FILE__."
LINE: ".__LINE__);
if(!$rs)
{
$APPLICATION->ThrowException(GetMessage("USER_TYPE_TABLE_CREATION_ERROR",array(
"#ENTITY_ID#"=>htmlspecialcharsbx($entity_id),
)));
return false;
}
}
if(!$DB->TableExists("b_uts_".strtolower($entity_id)))
{
if(defined("MYSQL_TABLE_TYPE"))
$DB->Query("SET storage_engine = '".MYSQL_TABLE_TYPE."'", true);
$rs = $DB->Query("
create table IF NOT EXISTS b_uts_".strtolower($entity_id)." (
VALUE_ID int(11) not null,
PRIMARY KEY (VALUE_ID)
)
", false, "FILE: ".__FILE__."
LINE: ".__LINE__);
if(!$rs)
{
$APPLICATION->ThrowException(GetMessage("USER_TYPE_TABLE_CREATION_ERROR",array(
"#ENTITY_ID#"=>htmlspecialcharsbx($entity_id),
)));
return false;
}
}
return true;
}