labrador
                                
                                 labrador copied to clipboard
                                
                                    labrador copied to clipboard
                            
                            
                            
                        Support for MSSQL
I would like to add support for MS SQL Server via the tiny_tds gem. What would be necessary to add another adapter?
Figured it out. Wasn't too bad.
I would love to see this as pull request. So long as tiny_tds builds on non MS SQL platforms there should be no reason we can't get this in. I'm sure as you have already figured out, a new adapter needs only respond to these methods:
def collections
end
def find(collection_name, options = {})
end
def create(collection_name, data = {})
end
def update(collection_name, id, data = {})
end
def delete(collection_name, id)
end
def primary_key_for(collection_name)
end
def connected?
end
def close
end
def id
end
def name
end
def schema(collection)
end
def as_json(options = nil)
end
I need to improve the documentation on the method signatures/return values and add a guide to the readme on this.
Cool. I have it more or less working. What's the format that schema should return?
#schema just returns the result of the database query as a hash similar to the #find method. ie, the mysql adapter simply returns the result of session.query("DESCRIBE #{collection_name}") as a hash. Also, use any of the sql adapter unit tests as a template for the new adapter tests. The assertions should be more or less equivalent. I'm really looking forward to this. Thanks!
Heads up: tiny_tds will build on unix, but requires FreeTDS.
I saw that FreeTDS was required. Do you know if we can automate the free-tds build process? A quick glance at the MiniPortile section of of tiny_tds suggests it may be possible. Automation is required so we can maintain the "copy/paste" install process from http://chrismccord.github.com/labrador/
If we can't automate the build process, I would still like to get this in at least on a mssql branch that we can rebase and keep current with master, as well as provide additional documentation for. MSSQL support would be great to have for those who need it. Let me know what you think.
Found a good way to test: Amazon RDS has a free tier (http://aws.amazon.com/rds/pricing/sqlserver/).
So I have a tested branch now: https://github.com/hrp/labrador/tree/mssql. Next, I want to implement a way to easily run stored procedures.
The final step would be figuring out how to maintain the simple install process. The MiniPortile approach would work but instead of doing that on the user's machine (requires a checkout of the tiny_tds source) we could create a fork of tiny_tds that comes with FreeTDS and include that gem in this project.
I also wonder if MSSQL support should be an optional add-on.
I like the optional add-on approach if we aren't able to get an automated build processes that isn't as simple as bundle install. You mentioned forking tiny_ds and including FreeTDS, would this be something that would allow a simple gem custom_tiny_tds ? If so, I would like to experiment with that approach. At minimum, we could have MYSSQL as an optional add-on from an mssql branch that we keep up to date with master and add special documentation for, so it is at least there for those who require it. My only hesitation with merging with master if we can automate the install is requiring a remote instance for testing, although that's a decent trade off. Let me think about that one. Thanks for your work so far. Browsing the branch looks like the code + tests are perfect.