In hindsight, it is rather humorous the time one may spend trying to learn how to do the simplest of things programmatically. While it is happening, it can be the most frustrating experience you've had.
As noted earlier, we are working on a web app here at work using Ruby. This project is going to not be using the Ruby on Rails framework. It is going to be a series of web services developed with Ruby and a few Ajax enabled web pages that call and use these services.
Prior to starting this project I worked with the Ruby MySQL module found here and determined that it was impossible to call stored procedures using it. Yesterday, I stumbled across an article from Planet MySQL showing how wrong I was, it is possible. They displayed the following code:
dbh=Mysql.init
dbh.real_connect("127.0.0.1", "root", "secret", "prod",3306,nil,Mysql::CLIENT_MULTI_RESULTS)
which fixed the problem completely. They explained:
If you try to call a stored procedure that returns a result set, you'll at first get a "procedure foo() can't return a result set in the given context error". This is because the CLIENT_MULTI_RESULTS flag is not set by default when the connection is created
Such is the frustration of learning a new language, you aren't aware of all of the little nuances that are used to make it work well.
That being said, I'm still very excited about using the Ruby language. It is going well!
Post a Comment