Class: DataMapper::Adapters::SqliteAdapter

Inherits:
DataObjectsAdapter show all
Defined in:
lib/adapters.rb

Instance Method Summary collapse

Instance Method Details

#disable_referential_integrityObject

this is a no-op copied from activerecord since SQLite 3.6.19 the database engine has included the capability to enforce foreign key constraints but this functionality is disabled by default



81
82
83
# File 'lib/adapters.rb', line 81

def disable_referential_integrity
  yield
end

#storage_names(repository = :default) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'lib/adapters.rb', line 62

def storage_names(repository = :default)
  # activerecord-2.1.0/lib/active_record/connection_adapters/sqlite_adapter.rb: 177
  sql = <<-SQL
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



73
74
75
76
# File 'lib/adapters.rb', line 73

def truncate_table(table_name)
  execute("DELETE FROM #{quote_name(table_name)};")
  execute("DELETE FROM sqlite_sequence where name = '#{table_name}';")
end