MySQL & Ruby

M

Marcin Tyman

Here is my strange issue:

def dump(tableName)
dbh = Mysql.real_connect(SQLServerIP, SQLLogin, SQLPass, SQLDB)
rows = dbh.query("SELECT * FROM #{tableName} r;")

rows.each do |row|
theRow = row.join(" | ")
content << theRow+"\n"
end
 
T

Todd Burch

Marcin said:
Here is my strange issue:
...
First calling return unexpectedly nothing (tabe rm_pre_prov_sta has some
records). Second calling returns some records (as expected).
Command 'select* from rm_pre_prov_sta;' directly from mysql returns some
records. So what is wrong with this all.

Could anyone explain me why dumpTable("rm_pre_prov_sta") returns none of
rows?

Perhaps you are getting a non-zero SQLCODE (or SQLSTATE). Have you
checked it?

(DB2 is the database I know - I've never used MySQL. In DB2, you have
to check the SQLCODE)

Todd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,311
Members
47,986
Latest member
ColbyG935

Latest Threads

Top