This is the first in a multi-part post on a little ruby application I wrote to generate models for LightSpeed.
The ultimate goal is to consume the entities we generate in this series with IronRuby and perform some data access.
Today I’ll post the code I wrote for creating the database connection. At this moment there is only code there to connect tho sql server. But I may want to add providers later if I decide to keep using this code. That’s why some bits are in a separate module.
This are the specs I wrote for the connection manager. The connection manager is the class that reads the database config, gets a connection and executes sql statements. I think this code is pretty simple so I won’t put a line-by-line explanation.
It uses DBI to connect to the database and reads out the results of the executed sql statement. In the next post I’ll talk about getting the metadata that is required from sql server.
- should return a connection
- should say it's an ODBC connection when a dsn is provided
- should return the correct connection string for an ODBC connection