Forum: Ruby MySQL & Ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
024df81c5a19da7762f694e801518af5?d=identicon&s=25 Marcin Tyman (sirtyman)
on 2007-07-20 15:45
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
  .
  .
  .
  puts("None records in #{tableName}!!!") if dbh.affected_rows == 0
  dbh.close
end

dumpTable("rm_pre_prov_sta")
dumpTable("rm_active_sta")


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?
13b511cd4fff9f72326e38526b9701fa?d=identicon&s=25 Todd Burch (toddburch)
on 2007-07-21 01:14
Marcin Tyman wrote:
> 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
This topic is locked and can not be replied to.