##############################################################
# Copyright (C), 2013-2014.
# File name: connect-mysql
# Author: cy
# Version: 1.0.0
# Date: 20140120
# Description: connect mysql
###############################################################
#!/usr/bin/env ruby
require ‘mysql2‘
mysql_host = "drhel35.com"
mysql_username = "root"
mysql_passwd = "xxxxxx.1"
mysql_db = "sysadmin"
delete_user_s1 = ‘delete from user_preference where user_id = "#{user_id}"‘
delete_user_s2 = ‘delete from party_user_mapping where user_id = "#{user_id}"‘
delete_user_s3 = ‘delete from register_user where username= "#{username}"‘
select_user = ‘select * from register_user where username = "#{username}"‘
connect = Mysql2::Client.new(:host=>"#{mysql_host}", :username=>"#{mysql_username}",:password=>"#{mysql_passwd}",:database=>"#{mysql_db}")
connect.query(delete_user_s1)
connect.query(delete_user_s2)
connect.query(delete_user_s3)
connect.query(select_user)