From: ngw Date: 2006-02-20T01:28:29+09:00 Subject: Finding out if a Mysql database contains a certain table Hi *, I need to find out if a MySQL db contains a certain table, if not I have to create it. I'm using the SHOW TABLES instruction that returns a Mysql::Result object, but after that I'm stuck, I don't know how to process the resultset without writing awful code :p I mean, I can resolve the problem by using a "state" variable inside a block and turn it to true if it finds the table, but I guess there's a more appropriate way to handle this kind of problems. result = dbh.query("SELECT * FROM album") foo = false result.each {|row| foo = true if row.include?("Killing Joke")} if foo == true puts "HA!" end result.free This is the code I have now, UGH ! TIA, ngw