src/utils/qa/dropUserTables.csh 1.2
1.2 2009/04/11 00:37:03 rhead
Sourced new qaConfig file at the top. Changed -h hgwbeta lines to look for sql host stored in a variable, specified in the new qaConfig file.
Index: src/utils/qa/dropUserTables.csh
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/qa/dropUserTables.csh,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 1000000 -r1.1 -r1.2
--- src/utils/qa/dropUserTables.csh 3 Feb 2005 01:41:32 -0000 1.1
+++ src/utils/qa/dropUserTables.csh 11 Apr 2009 00:37:03 -0000 1.2
@@ -1,61 +1,62 @@
#!/bin/tcsh
+source `which qaConfig.csh`
##########################################################
# remove unneeded trackDb_ and hgFindSpec_ tables #
# on hgwbeta for given assembly ($1) #
##########################################################
if ( "$HOST" != "hgwdev" ) then
echo "error: you must run this script on hgwdev!"
exit 1
endif
set host = "hgwbeta"
# check cmdline parm1 (db)
if ("$1" == "") then
echo "Usage Error: specify on commandline the database to use."
echo "e.g. dropUserTables.csh droMoj1"
exit 1
endif
set db = "$1"
set sql = "show tables like "'"'"trackDb_%"'"'
#echo "$sql"
set r = `hgsql -h $host $db -BN -e "$sql"`
if ( $status ) then
echo "Error executing sql: $sql."
exit 1
endif
#echo $r
set tables = ($r)
set sql = "show tables like "'"'"hgFindSpec_%"'"'
#echo "$sql"
set r = `hgsql -h $host $db -BN -e "$sql"`
if ( $status ) then
echo "Error executing sql: $sql."
exit 1
endif
#echo $r
set tables = ($tables $r)
if ("$2" != "real") then
echo "\nFound these tables: \n $tables\n"
echo "Must specify 'real' on commandline to actually do it."
exit 0
endif
foreach table ($tables)
set sql = "drop table $table"
echo "$sql"
hgsql -h $host $db -e "$sql"
if ( $status ) then
echo "Error running query: $sql."
exit 1
endif
end
exit 0