备忘-ruby (mysql)
############################################################## # 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)
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。