#!/bin/perl
############################################################################
# QA Script for version 2.0 publishing system.
# Authors: Guy Kane, Erez Ben simon
# Last update: 11/12/00
############################################################################
$USER = "reuven" ; #specifies the user,pass,host,and file as constans
$PASS = "reuven" ; #sending Interactive function
$HOST = "mgs"; #stdin=standard input
$FILE = "pub.sql";
system ("$CLEAN");
############################################################################
print ("\n\n\n\n\t\t *** DETA BASE MAP ***\n\t\t-------------------------");
print ("\n\n\n\nPress Enter to start ...\n");
$ZEVEL = <STDIN>;
Interactive ();
print ("\n\n\n\nEnter yore requested table \n");
print ("\n1-ACOUNTS\n");
print ("\n2-USERS\n");
print ("\n3-PK\n");
print ("\n4-PROFILE\n");
$choice = <STDIN>;
chop $choice;
############################################################################
if ($choice == 1 )
{
print ("\n\n\n\nEnter the key fild \n");
print ("\n1-ACOUNT_ID (primery key)\n");
print ("\n2-USER_ID\n");
print ("\n3-ACCOUNT_TYPE\n");
print ("\n4-NAME\n");
$choice = <STDIN>;
chop $choice;
if ( $choice == 1 )
{print ("\nPlease enter the ACOUNT_ID \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from ACCOUNTS where ACOUNT_ID like '$c';\nexit;");
run_sql();
}
if ( $choice == 2 )
{print ("\nPlease enter the USER_ID \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from ACCOUNTS where USER_ID like '$c';\nexit;");
run_sql();
}
if ( $choice == 3 )
{print ("\nPlease enter the ACCOUNT_TYPE \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from ACCOUNTS where ACCOUNT_TYPE like '$c';\nexit;");
run_sql();
}
if ( $choice == 4 )
{print ("\nPlease enter the NAME \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from ACCOUNTS where NAME like '$c';\nexit;");
run_sql();
}
}
if ($choice == 2 )
{
print ("\n\n\n\nEnter the key fild \n");
print ("\n1-ID (primery key)\n");
print ("\n2-USER_TYPE\n");
print ("\n3-NAME\n");
$choice = <STDIN>;
chop $choice;
if ( $choice == 1 )
{print ("\nPlease enter the ID \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from USERS where ID like '$c';\nexit;");
run_sql();
}
if ( $choice == 2 )
{print ("\nPlease enter the USER_TYPE \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from USERS where USER_TYPE like '$c';\nexit;");
run_sql();
}
if ( $choice == 3 )
{print ("\nPlease enter the NAME \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from USERS where NAME like '$c';\nexit;");
run_sql();
}
}
if ($choice == 3 )
{
print ("\n\n\n\nEnter the key fild \n");
print ("\n1-PK_ID (primery key)\n");
print ("\n2-ROOT_PK\n");
print ("\n3-NAME\n");
print ("\n4-CREATION_DATE\n");
print ("\n5-PUBLISHING_DATE\n");
print ("\n6-DISTRIBUTION_DATE\n");
print ("\n7-ACTIVATION_DATE\n");
print ("\n8-DESCRIPTION\n");
print ("\n9-XML_FILE_PATH\n");
print ("\n10-CONTENT_BASE_ID\n");
print ("\n11-ACCOUNT_ID\n");
print ("\n12-STATUS\n");
print ("\n13-USER_PATH\n");
print ("\n14-PRODUSER_ID\n");
$choice = <STDIN>;
chop $choice;
if ( $choice == 1 )
{print ("\nPlease enter the PK_ID \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where PK_ID like '$c';\nexit;");
run_sql();
}
if ( $choice == 2 )
{print ("\nPlease enter the ROOT_PK \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where ROOT_PK like '$c';\nexit;");
run_sql();
}
if ( $choice == 3 )
{print ("\nPlease enter the NAME \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where NAME like '$c';\nexit;");
run_sql();
}
if ( $choice == 4 )
{print ("\nPlease enter the CREATION_DATE \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where CREATION_DATE like '$c';\nexit;");
run_sql();
}
if ( $choice == 5 )
{print ("\nPlease enter PUBLISHING_DATE the \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where PUBLISHING_DATE like '$c';\nexit;");
run_sql();
}
if ( $choice == 6 )
{print ("\nPlease enter the DISTRIBUTION_DATE \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from PK where DISTRIBUTION_DATE like '$c';\nexit;");
run_sql();
}
if ( $choice == 7 )
{print ("\nPlease enter the ACTIVATION_DATE \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where ACTIVATION_DATE like '$c';\nexit;");
run_sql();
}
if ( $choice == 8 )
{print ("\nPlease enter the DESCRIPTION \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where DESCRIPTION like '$c';\nexit;");
run_sql();
}
if ( $choice == 9 )
{print ("\nPlease enter the XML_FILE_PATH \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where XML_FILE_PATH '$c';\nexit;");
run_sql();
}
if ( $choice == 10 )
{print ("\nPlease enter the CONTENT_BASE_ID \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where CONTENT_BASE_ID like '$c';\nexit;");
run_sql();
}
if ( $choice == 11 )
{print ("\nPlease enter the ACCOUNT_ID \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where ACCOUNT_ID like '$c';\nexit;");
run_sql();
}
if ( $choice == 12 )
{print ("\nPlease enter the STATUS \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where STATUS like '$c';\nexit;");
run_sql();
}
if ( $choice == 13 )
{print ("\nPlease enter the USER_PATH \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where USER_PATH like '$c';\nexit;");
run_sql();
}
if ( $choice == 14 )
{print ("\nPlease enter the PRODUSER_ID \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from pk where PRODUSER_ID like '$c';\nexit;");
run_sql();
}
}
if ($choice == 4 )
{
print ("\n\n\n\nEnter the key fild \n");
print ("\n1-PROFILE_ID (primery key)\n");
print ("\n2-NAME\n");
$choice = <STDIN>;
chop $choice;
if ( $choice == 1 )
{print ("\nPlease enter the PROFILE_ID \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from PROFILE where PROFILE_ID like '$c';\nexit;");
run_sql();
}
if ( $choice == 2 )
{print ("\nPlease enter the NAME \n");
$c = <STDIN>;
chop $c;
OpenFile();
print FILE (" select * from PROFILE where NAME like '$c';\nexit;");
run_sql();
}
}
###########################################################################
sub OpenFile #12/3/00 7:17PM
###########################################################################
{
open (FILE, ">$FILE");
} ##OpenFile
############################################################################
sub run_sql #03/12/2000 18:02
############################################################################
{
system ("sqlplus $USER/$PASS\@$HOST \@$FILE");
print ("\n--------------------------------------------------------\nPress Enter to continue");
$ZEVEL = <STDIN>;
} ##run_sql
############################################################################
sub Interactive #12/11/00 11:20AM
############################################################################
{
print ("Identify system: \n1 - Unix\n2 - NT\n\n");
$OS = <STDIN>;
chop $OS;
if ($OS == "1")
{ $REMOVE = "rm"; $CLEAN = "clear" }
else
{
$REMOVE = "del"; $CLEAN = "cls"
}
} ##Interactive