Index: /branches/eam_branches/ipp-20230313/tools/eam/xcstack.20231124/get.schema.sh
===================================================================
--- /branches/eam_branches/ipp-20230313/tools/eam/xcstack.20231124/get.schema.sh	(revision 42614)
+++ /branches/eam_branches/ipp-20230313/tools/eam/xcstack.20231124/get.schema.sh	(revision 42614)
@@ -0,0 +1,52 @@
+#!/bin/csh
+
+if ($#argv != 1) then
+   echo "USAGE: get.schema.sh (database)"
+   exit 2
+endif
+
+which mariadb >& /dev/null
+@ has_mariadb = ($status == 0)
+
+which mysql >& /dev/null
+@ has_mysql = ($status == 0)
+
+set MYSQL = none
+if ($has_mariadb) then
+  set MYSQL = mariadb
+endif
+if (($has_mariadb == 0) && ($has_mysql)) then
+  set MYSQL = mysql
+endif
+
+echo "mysql is $MYSQL"
+
+set dbserver = ippdb05
+set dbuser = ippuser
+set dbpass = ippuser
+set dbname = $argv[1]
+
+# generate skycell entry (needed for xcsky and xccal queries)
+$MYSQL -h $dbserver -u $dbuser -p$dbpass $dbname <<EOF > tables.$dbname.txt
+  show tables
+EOF
+if ($status) then
+ echo "ERROR: failed in mysql load for $dbname"
+ exit 2
+ endif
+ 
+rm -f tables.$dbname.sql
+foreach f (`cat tables.$dbname.txt | awk '(NR > 1){print $1}'`)
+  echo "SHOW CREATE TABLE $f;" >> tables.$dbname.sql
+  echo -n "$f, "
+end
+echo ""
+
+# generate skycell entry (needed for xcsky and xccal queries)
+$MYSQL -N -h $dbserver -u $dbuser -p$dbpass $dbname < tables.$dbname.sql > create.$dbname.txt
+if ($status) then
+ echo "ERROR: failed in mysql load for $dbname"
+ exit 2
+ endif
+ 
+ 
