Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.220.194.29
Current Path : /var/www/html/gcg/src/ |
| Current File : /var/www/html/gcg/src/system_utility.php |
<?php
function ChangeTablesToInnoDB($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$get_all_create_table="show TABLES";
$lobj_get_all_create_table = $aobj_context->mobj_db->GetAll($get_all_create_table);
foreach($lobj_get_all_create_table as $key=>$value)
{
foreach($value as $k=>$v)
{
$table_name=$v;
$alter_table="alter table {$table_name} ENGINE=INNODB";
$lobj_alter_table = $aobj_context->mobj_db->Execute($alter_table);
}
}
}
function TruncateEntryTables($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$get_all_create_table="select concat('user_schema_',ref_s_user_schema_code,'_entry_',internal_code) as entry_table
from s_user_schema_group where multiple=1";
$lobj_get_all_create_table = $aobj_context->mobj_db->GetAll($get_all_create_table);
foreach($lobj_get_all_create_table as $key=>$value)
{
$table_name=$value['entry_table'];
$truncate_table="truncate {$table_name}";
$lobj_alter_table = $aobj_context->mobj_db->Execute($truncate_table);
}
$get_gandhi_grid_tables="select concat('module_',internal_code,'_') as tablename
from s_user_schema where
grid_type='Ggrid'";
$lobj_get_gandhi_grid_tables = $aobj_context->mobj_db->GetAll($get_gandhi_grid_tables);
foreach($lobj_get_gandhi_grid_tables as $gk=>$gv)
{
$drop_table_name=$gv[tablename];
$get_show_tables="show tables like '%{$drop_table_name}%'";
$lobj_get_show_tables = $aobj_context->mobj_db->GetAll($get_show_tables);
foreach($lobj_get_show_tables as $sk=>$sv)
{
foreach($sv as $svk=>$svv)
{
$lobj_alter_table = $aobj_context->mobj_db->Execute(" drop table {$svv}");
}
}
}
$data="Done";
echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
return;
}
?>
|