我想创建数据库中所有表的按钮(使用Shoes)。
我是初学者,这是我的第一个GUI项目'Stock Management',我在Ruby中使用鞋库,并希望用Ruby存储和管理MySql2中的数据。我键入了一些代码,但它不起作用
路径/ main.rb的
require 'mysql2'
require 'green_shoes'
client = Mysql2::Client.new (host: "localhost",username: "root", password: "xyz", database: "Ruby")
Shoes.app do
components = client.query("SHOW TABLES")
components.each do |item|
button item
end
end`
什么都不给。
你可以从information_schema
查询它们:
components = client.query("SELECT table_name FROM information_schema.tables")