Class: DataMapper::Adapters::SqliteAdapter

Inherits:
DataObjectsAdapter show all
Defined in:
lib/database_cleaner/data_mapper/truncation.rb

Instance Method Summary collapse

Instance Method Details

#disable_referential_integrityObject

this is a no-op copied from activerecord i didn’t find out if/how this is possible activerecord also doesn’t do more here



87
88
89
# File 'lib/database_cleaner/data_mapper/truncation.rb', line 87

def disable_referential_integrity
  yield
end

#storage_names(repository = :default) ⇒ Object



69
70
71
72
73
74
75
76
77
78
# File 'lib/database_cleaner/data_mapper/truncation.rb', line 69

def storage_names(repository = :default)
  # activerecord-2.1.0/lib/active_record/connection_adapters/sqlite_adapter.rb: 177
  sql = <<-SQL.compress_lines
    SELECT name
    FROM sqlite_master
    WHERE type = 'table' AND NOT name = 'sqlite_sequence'
  SQL
  # activerecord-2.1.0/lib/active_record/connection_adapters/sqlite_adapter.rb: 181
  select(sql)
end

#truncate_table(table_name) ⇒ Object



80
81
82
# File 'lib/database_cleaner/data_mapper/truncation.rb', line 80

def truncate_table(table_name)
  execute("DELETE FROM #{quote_name(table_name)};")
end