copy table excl ELAB RAW
This commit is contained in:
@@ -199,6 +199,45 @@ sub checkCompanyDBTables() {
|
||||
$sth_db->execute()
|
||||
or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr";
|
||||
$sth_db->finish;
|
||||
|
||||
my $sth_tb = $dbh->prepare( "SHOW TABLES FROM " . $db_adm . ";" )
|
||||
or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr";
|
||||
$sth_tb->execute()
|
||||
or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr";
|
||||
|
||||
my $tables_list = $sth_tb->fetchall_arrayref( {} );
|
||||
foreach my $table ( @{$tables_list} ) {
|
||||
my $sth_deft =
|
||||
$dbh->prepare( "CREATE TSBLE IF NOT EXISTS "
|
||||
. $company_db_name . "."
|
||||
. $table
|
||||
. " LIKE "
|
||||
. $db_adm . "."
|
||||
. $table
|
||||
. ";" )
|
||||
or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr";
|
||||
$sth_deft->execute()
|
||||
or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr";
|
||||
$sth_deft->finish;
|
||||
if ( $table ne 'ELABDATADISP' and $table ne 'RAWDATACOR' ) {
|
||||
my $sth_cpyt =
|
||||
$dbh->prepare( "INSERT "
|
||||
. $company_db_name . "."
|
||||
. $table
|
||||
. " SELECT * FROM "
|
||||
. $db_adm . "."
|
||||
. $table
|
||||
. ";" )
|
||||
or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr";
|
||||
$sth_cpyt->execute()
|
||||
or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr";
|
||||
$sth_cpyt->finish;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$sth_tb->finish;
|
||||
|
||||
}
|
||||
|
||||
sub setCompanyOSSet {
|
||||
@@ -223,12 +262,17 @@ sub setCompanyOSSet {
|
||||
$sth->execute() or die getTimeStamp("log") . " - pid $$ >> $DBI::errstr";
|
||||
$sth->finish;
|
||||
|
||||
user(
|
||||
if (
|
||||
!user(
|
||||
$company_os_user, encpass($company_os_pwd),
|
||||
maxuid() + 1, $company_os_grp,
|
||||
$company_name . " user", "/home/" . $company_os_user,
|
||||
"/bin/bash"
|
||||
) or die getTimeStamp("log") . " - pid $$ >> " . error() . ". \n";
|
||||
)
|
||||
)
|
||||
{
|
||||
die getTimeStamp("log") . " - pid $$ >> Error in user definition\n";
|
||||
}
|
||||
|
||||
if ( !-d "/home/" . $company_os_user ) {
|
||||
make_path "/home/" . $company_os_user,
|
||||
@@ -255,8 +299,7 @@ if ( !checkCompanyDBGrant() ) {
|
||||
print getTimeStamp("log") . " - pid $$ >> Set Company user DB grant.\n";
|
||||
setCompanyDBGrant();
|
||||
print getTimeStamp("log") . " - pid $$ >> Set Company user DB tables.\n";
|
||||
|
||||
#setCompanyDBTables();
|
||||
setCompanyDBTables();
|
||||
}
|
||||
|
||||
if ( !defined $company_os_user or !exists_user($company_os_user) ) {
|
||||
|
||||
Reference in New Issue
Block a user