Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Gerardo Santana Gómez Garrido
RE: open vs. connect [ reply ]  
2008-06-21 01:15
Hey Gerard,

You're right. Both, Informix.connect and Database.open do exactly the same thing.

If you click on "Source" in the documention for Informix.connect you'll see that it calls to Database.open.

Why have both? Well, see Informix.connect as a shortcut for Informix::Database.open. You type less. It's just more convenient.

The same thing happens with Database#cursor and Cursor.new.

Hope that helps.

And welcome to Ruby :) Don't hesitate to ask any question about Ruby or Ruby/Informix.

By: Gerard Pineda
open vs. connect [ reply ]  
2008-06-20 21:31
Hello,

I noticed many of the code snippets I've seen use 'Informix.connect'. Why isn't 'open' used more? After reviewing the rdoc, it looks like they pretty much do the same thing. Are there some situations where using 'open' makes more sense than using 'connect'?

FYI, I'm very new to Ruby, but I was an Informix 4GL developer a few years back (which means the switch to OO programming makes my head hurt).