[Rails] How to implement more database adapters for Active Record
Sean Leach
sleach at wiggum.com
Wed Dec 1 16:05:15 GMT 2004
Kevin Bullock wrote:
> 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.
An escape method per adaptor would be the best route as MySQL escapes
with '\', and Oracle escapes with ''' etc, or at least have a default
escape with '\', and have an adaptor override it if needed (like
Oracle). The SQL doesn't need to be built in the adaptors, that can
stay the way it is, just don't quote values that don't need to be quoted.
More information about the Rails
mailing list