So all this flurry around the condition interpolation made me have
another look at how quoting works in Active Record. And it took much
less time than I feared to clean it up, so now Active Record should be
generating proper SQL, like:
SELECT * FROM topics WHERE id = 5
...instead of:
SELECT * FROM topics WHERE id = ''5''
This has been a big problem for pretty much all the work done on new
adapters, so hopefully this will make it much easier to write adapters
for AR. Right now, the abstract adapter has a default implementation
for quoting that should be overwritten by the adapter to call the
connectors quoting mechanism. Like this for the MySQL adapter:
def quote_string(s)
Mysql::quote(s)
end
The beta gems are up to date with these latest changes!
--
David Heinemeier Hansson,
http://www.basecamphq.com/ -- Web-based Project Management
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://macromates.com/ -- TextMate: Code and markup editor (OS X)
http://www.loudthinking.com/ -- Broadcasting Brain
David Heinemeier Hansson wrote:> So all this flurry around the condition interpolation made me have > another look at how quoting works in Active Record. And it took much > less time than I feared to clean it up, so now Active Record should be > generating proper SQL, like: > > SELECT * FROM topics WHERE id = 5 > > ...instead of: > > SELECT * FROM topics WHERE id = ''5'' >This is really good news and probably all I need to finish the DB2 adapter. What will be the best way to integrate the changes? Checking out the current project status from CVS?
David Heinemeier Hansson
2004-Dec-07 16:10 UTC
Re: Proper database connector-based quoting!
> This is really good news and probably all I need to finish the DB2 > adapter. What will be the best way to integrate the changes? Checking > out the current project status from CVS?I''m glad to hear that. You want to checkout the latest from SVN. The Subversion repository is at http://dev.rubyonrails.org/svn/rails. Would be really nice with a whole slew of new adapters in 0.9 ;) -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://macromates.com/ -- TextMate: Code and markup editor (OS X) http://www.loudthinking.com/ -- Broadcasting Brain