#!/bin/bash
 #
 # Update_Problem - updates problem record in database
 ###############################################################
 # Determine sql location & set variable
 #
 MYSQL=`which mysql`" Problem_Task -u testuser"
 #
 ################################################################
 #
  ]    #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 is the ID number for the"
 echo -e "problem you want to update?:\c"
 read ANSWER
 ID_NUMBER=$ANSWER
 else
 ID_NUMBER=$
 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 but yes,ask for date
 echo
 echo -e "What was 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

problem-record-mysql的更多相关文章

  1. data structure assignment problem record

    Question1: Similar to pause command in linux read -n 1 Question2 read : Illegal option -n 原因为ubuntu ...

  2. 学习笔记:The Best of MySQL Forum

    http://mysql.rjweb.org/bestof.html I have tagged many of the better forum threads. 'Better' is based ...

  3. Centos 7 mysql Buffered warning: Changed limits: max_connections: 214 解决方法

    Everytime I restart MySQL I have this warning: [Warning] Buffered warning: Changed limits: max_conne ...

  4. Snippet: Fetching results after calling stored procedures using MySQL Connector/Python

    https://geert.vanderkelen.org/2014/results-after-procedure-call/ Problem Using MySQL Connector/Pytho ...

  5. mysql 区间锁 对于没有索引 非唯一索引 唯一索引 各种情况

    The locks are normally next-key locks that also block inserts into the "gap" immediately b ...

  6. 如何将MongoDB数据库的数据迁移到MySQL数据库中

    FAQ v2.0终于上线了,断断续续忙了有2个多月.这个项目是我实践的第一个全栈的项目,从需求(后期有产品经理介入)到架构,再到设计(有征询设计师的意见).构建(前端.后台.数据库.服务器部署),也是 ...

  7. MySQL的my-innodb-heavy-4G.ini配置文件的翻译

    我根据MySQL配置文件的英文文档说明,在根据自己所学的知识,使用有道词典对不懂的单词进行了查询,一个一个翻译出来的.有的专业术语翻译的不好,我使用了英文进行标注,例如主机(master)和副机(sl ...

  8. 【MYSQL】MYSQLの環境構築

    ダウンロード:https://dev.mysql.com/downloads/mysql/ 手順① 手順② mysql.iniの設定について [mysql]default-character-set= ...

  9. MySQL系统变量auto_increment_increment与auto_increment_offset学习总结

    在MySQL中,系统变量auto_increment_increment与auto_increment_offset是与自增列相关的两个参数变量.在官方文档中,将其划分为Replication Mas ...

  10. MySQL高级配置

    参考文章:http://www.jb51.net/article/47419.htm https://blog.csdn.net/waneto2008/article/details/52502208 ...

随机推荐

  1. php函数mt_rand和rand 速度测试

    今天在写代码时,看到以前的同时写了一个取随机数,用到了mt_rand(2,19) 就顺手搜了一下,mt_rand和rand的区别. 先看官方的解释 mt_rand 和 rand mt_rand — 生 ...

  2. oracle 中的trunc()函数及加一个月,一天,一小时,一分钟,一秒钟方法

    返回处理后的数据,不同于round()(对数值进行四舍五入处理),该函数不对指定小数前或后的数值部分进行舍入处理. 语法:trunc(number[,decimals]) 其中,number为待做处理 ...

  3. nyoj 236心急的C小加 动态规划( java)

    sort函数用法: #include<algorithm> using namespace std; sort(a,a+len;cmp)    //a-->数组名,    len-- ...

  4. 如何解决Mac里面解压后文件名乱码问题

    如果你把Mac当成你的主要工作机器,而你的同事用的都是Windows,有时候交换文档就是一件很痛苦的事,比如今天要说到的问题:当同事传给你一个zip文件,结果你拿过来解压后发现里面有些文件的文件名如果 ...

  5. MySQL也有潜规则 – Select 语句不加 Order By 如何排序?

    今天遇到一个问题,有一个 Select 语句没有加 "Order By",返回的数据是不确定的. 这种问题碰到不止几次了.追根寻底, Select 语句如果不加 "Ord ...

  6. Windows下MySQL 5.6安装及配置详细图解

    一.安装前的准备 1.下载安装程序包,可到MySQL官方网站http://www.mysql.com/下载,如图1-1: 图1-1 下载后的安装文件如图1-2所示: 图1-2 二.安装 1.双击下载的 ...

  7. 关于CSS的优先级,CSS优先级计算

    原则一: 继承不如指定原则二: #id > .class > 标签选择符原则三:越具体越强大原则四:标签#id >#id ; 标签.class > .class CSS优先级权 ...

  8. 移动端全屏滑动的小插件,简单,轻便,好用,只有3k swiper,myswiper,page,stage

    https://github.com/donglegend/mySwiper mySwiper 移动端全屏滑动的小插件,简单,轻便,好用,只有3k 下载 直接下载 bower install mySw ...

  9. CentOS6系升级Python2.7版本

    安装前准备 本实例以CentOS6.7为例 [root@E tools]# uname -r 2.6.32-431.23.3.el6.x86_64 [root@E tools]# uname -m x ...

  10. js ajax简单使用

    文章部分资源来源:(http://blog.csdn.net/lzkkevin/article/details/6777474)以及(http://www.cnblogs.com/hwx0807/ar ...