#!/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. ADB常用命令(Android Debug Bridge)

    首先要配置环境变量. adb devices 列出所有的设备 adb start-server 开启adb服务 adb kill-server    关闭adb服务 adb logcat    查看L ...

  2. VTK初学一,e_Triangle三角形的绘制

    #ifndef INITIAL_OPENGL #define INITIAL_OPENGL #include <vtkAutoInit.h> VTK_MODULE_INIT(vtkRend ...

  3. 清北暑假模拟day2 将

    /* 爆搜,正解弃坑 */ #include<iostream> #include<cstdio> #include<string> #include<cst ...

  4. 1455.Solitaire(bfs状态混摇)

    Solitaire Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total ...

  5. 【C语言入门教程】7.4 共用体

    7.4 共用体 共用体又称为联合体,是由不同的数据类型组成的一个整体.与结构体不同的是,共用体每次只能使用其中一个成员.结构体的总长度是结构体所有成员长度之和,共用体的总长度是其中最长一个数据类型的长 ...

  6. JS写的多级联select,如何取值

    var $ = function (id) {    return "string" == typeof id ? document.getElementById(id) : id ...

  7. jQuery中添加自定义或函数方法

    <script type="text/javascript"> (function () { $.fn.parHy = function (val) { alert(v ...

  8. 更新引用google的cdn外部jQuery核心库JS文件

    jquery-2.0.3   注!不再支持IE 6/7/8 直接引用地址: <script src="http://ajax.googleapis.com/ajax/libs/jque ...

  9. iOS开发——常见错误——使用MJRefresh返回上一个界面蹦掉的情况

    最近在使用MJRefresh框架时发现了一个bug 下面是我的源代码 前一个界面 -(void)tableView:(UITableView *)tableView didSelectRowAtInd ...

  10. $.extend()了解心得

    2.1 extend(result,item1,item2-..) 这里这个方法主要用来合并,将所有的参数项都合并result中,并返回result,但是这 样就会破坏result的结构. 2.2 e ...