9>>problem-record-mysql

Source: Internet
Author: User

#!/bin/bash
#
# update_problem-updates problem record in database
###############################################################
# Determine SQL location & Set Variable
#
Mysql= ' which MySQL ' "Problem_task-u testuser"
#
################################################################
#
If [$#-eq 0] #Check If ID number was passed.
Then
#
#Check if any unfinished records exist.
#
records_exist= ' $MYSQL-bse ' select Id_number from Problem_logger where
Fixed_date= "0000-00-00" or prob_solutions= "" "
#
#
If ["$RECORDS _exist"! = ""]
Then
Echo
echo "The following records need updating ..."
$MYSQL <<eof
Select Id_number,report_date,prob_symptoms
From Problem_logger
where fixed_date= "0000-00-00" or
Prob_solutions= "" \g
Eof
Fi
Echo
echo "What's the ID number for the"
Echo-e "problem you want to update?:\ C
Read ANSWER
Id_number= $ANSWER
Else
Id_number=$1
Fi
#
################################################################
# Obtain solution (aka Fixed) Date
#
Echo
Echo-e "was problem solved today? [y/n] \c "
Read ANSWER
#
Case ANSWER in
y| y|yes| yes|yes|yes| yes|yes| yes| YES)
Fixed_date= ' DATE +%y-%m-%d '
;;
*)
#if answer is anything and yes,ask for date
Echo
Echo-e "What is the date of resolution? [Yyyy-mm-dd]\c]
Read ANSWER
#
Fixed_date= $ANSWER
;;
Esac
#
###############################################################
# Acquire Problem Solution
#
Echo
Echo-e "Briefly describe the problem solution: \c"
#
Read ANSWER
prob_solutions= $ANSWER
#
##############################################################
# Update Problem Record
#
#
Echo
echo "problem record updated as follows:"
Echo
$MYSQL <<eof
UPDATE Problem_logger SET
prob_solutions= "$PROB _solutions"
fixed_date= $FIXED _date
WHERE id_number= $ID _number
#
SELECT * from Problem_logger where id_number= $ID _number\g
Eof
#
#END

9>>problem-record-mysql

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.