On Apr 15, 5:14 pm, Florent <[email protected]> wrote:
> I forked sequel on github, added this feature but I am not at ease
> with rspec
> I can't make DummyDatabase working with any special adapter supporting
> temporary table: temporary table syntax is different so I put the code
> inside the mssql, oracle, mysql, postgresql and sqlite adapters,
> overloading create_table_sql_list method in DatabaseMethods Module.
> I don't know if there is an easier way but I didn't want to break
> anything forcing a common syntax not supported by all the databases.

First, thanks for working on the patch.  I'd like to refactor it
slightly before I merge it to reduce the amount of duplication.

Try adding a Database#temporary_table_sql private method in database/
schema_sql.rb:

  def temporary_table_sql
    "TEMPORARY "
  end

Then modify create_table_sql_list in the same file:

  sql = ["CREATE #{temporary_table_sql if options[:temp]}TABLE #
{quote_schema_table(name)} (#{column_list_sql(columns)})"]

You'll have to override temporary_table_sql in the Oracle and MSSQL
shared adapters, and modify create_table_sql_list in the MySQL and
Firebird adapters, but those should be the only changes required.  I
think this is better than overriding create_table_sql list in a
similar way in all adapters.

Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" 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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to