~michaelforrest/use-case-mapper/trunk

« back to all changes in this revision

Viewing changes to vendor/rails/activerecord/test/connections/native_sqlite3/in_memory_connection.rb

  • Committer: Richard Lee (Canonical)
  • Date: 2010-10-15 15:17:58 UTC
  • mfrom: (190.1.3 use-case-mapper)
  • Revision ID: richard.lee@canonical.com-20101015151758-wcvmfxrexsongf9d
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
print "Using native SQLite3\n"
2
 
require_dependency 'models/course'
3
 
require 'logger'
4
 
ActiveRecord::Base.logger = Logger.new("debug.log")
5
 
 
6
 
class SqliteError < StandardError
7
 
end
8
 
 
9
 
def make_connection(clazz, db_definitions_file)
10
 
  clazz.establish_connection(:adapter => 'sqlite3', :database  => ':memory:')
11
 
  File.read(SCHEMA_ROOT + "/#{db_definitions_file}").split(';').each do |command|
12
 
    clazz.connection.execute(command) unless command.strip.empty?
13
 
  end
14
 
end
15
 
 
16
 
make_connection(ActiveRecord::Base, 'sqlite.sql')
17
 
make_connection(Course, 'sqlite2.sql')
18
 
load(SCHEMA_ROOT + "/schema.rb")