[Rails] How to implement more database adapters for Active Record

Kevin Bullock kbullock at ringworld.org
Wed Dec 1 15:54:14 GMT 2004


David Heinemeier Hansson wrote:

> So it seems like something must indeed be done. One of the easy ways 
> would of course be to make sure that every time a value is needed any 
> where in an SQL statement generated by Active Record, we use a quote 
> method that can be overwritten by each adapter.

This seems as though it might create more work than necessary, but I 
don't know enough about Rails' internals to say for sure. If the quoting 
were made dependent on data type, would that fix the issue for all 
databases, without having to resort to adapter-specific coding? My 
experience is mostly with MySQL and a bit with Oracle 8i, so I don't know.

'Standardized' though SQL is, implementations of it seem to vary more 
widely than nearly any other language I've seen. Perhaps this has 
improved in the past couple years, and if so it would make it easier to 
refactor how ActiveRecord writes its SQL. If not, one option might be to 
move the actual writing of SQL into the adapters. A 'default' (i.e., 
SQL92-compliant) way of doing it could be implemented in AbstractAdapter.

-- 
Kevin R. Bullock
Internet Systems Designer and Administrator
Minnesota Center Against Violence and Abuse
University of Minnesota
612.624.8796



More information about the Rails mailing list