require 'rubygems'
require 'mysql'
connection = Mysql.new('localhost','root','system$$','rubyclass')
create_table_definition = [["create table employee(id integer auto_increment primary key,name varchar(255), address varchar(255), pan_number varchar(15));"],["create table department(id integer auto_increment primary key, dept_name varchar(255));"]]
#code to create tables
create_table_definition.each do |statement|
response = connection.query(statement.first.to_s)
puts response
end
connection.close
No comments:
Post a Comment