rails-sqlserver/activerecord-sqlserver-adapter — pull request #186 by delta407 (2012-04-17 15:19:33+00:00)
Title: Basic SQL Server 7 support

I need to interface with a SQL Server 7 database. I don't claim to know much about the idiosyncrasies of SQL Server -- especially with heinously out-of-date versions for which I haven't found documentation -- but I've been fixing problems as I've encountered them. So far, that's:

* `tds_version` could not be specified in database.yml and must be "42" for SQL Server 7
* SQL Server 7 was not detected by SQLServerAdapter#initialize
* Attempting to bind variables as `nvarchar(max)` fails, so I added max_varchar_length to return "max" or "255" as appropriate
* SchemaStatements#column_definitions doesn't work because `.sys.*` doesn't seem to exist. There's a new 7-specific version that doesn't handle schemas or identity columns but appears to work.
* SQL Server 7 insists on `SELECT TOP 1` instead of `SELECT TOP (1)`, so trivial TOP expressions are now rewritten to avoid parenthesis.

This was enough to get basic read access, which is all my scenario presently requires. I'm sure more things are broken, and if I hit them, I might fix them too.

If you don't want to pull this because SQL Server 7 is so old, I understand. (Also, be aware that this is the only SQL Server database I have access to, so I can't run the unit tests.) On the other hand, these changes are not particularly invasive, and it might save someone else some work, so I thought I'd shoot over a pull request anyway.