On 2/24/07, Anthony Eden <[EMAIL PROTECTED]> wrote: > > Following up on Koz's suggestion to discuss how plugin developers are > monkey patching AR, I'd like to share some of things my coworkers and > I have done. > > 1.) Truncate. Currently implemented in ActiveWarehouse ETL for MySQL.
truncate as in 'truncate table foo'? > 2.) Bulk import and export using the DB's tool (for example, bulk > import with LOAD DATA INFILE for MySQL or BCP for SQL Server). > ActiveWarehouse ETL currently implements the import functionality for > MySQL only. This stuff should definitely remain in plugins > 3.) Views support. I've redefined tables, created a new method for > views and a new method to get the SQL query used for the view, and > added a supports_views? method. This is implemented in the Rails SQL > Views plugin. > One other thing I would like to see is for the following methods to be > moved out of AR::Base if possible and moved into the adapter layer or > into their own module so they can be reused easier: > > sanitize_sql > replace_bind_variables > replace_named_bind_variables > quote_bound_value > raise_if_bind_arity_mismatch I think this is one of the messier areas of the current query generation code. Because we do replace_bind_variables on each of the [string, val, val] blocks we're passed, we can't use prepared statements. Now while this doesn't matter for mysql or postgresql, in the big commercial databases it makes a huge difference. If we were instead to build up some in memory structure representing the query, then pass it to the adapters to convert to a SQL string, adapters which need prepared statements could utilise them. Chances are the code would improve too. -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
