Class: DataMapper::Adapters::SqliteAdapter

Inherits:
DataObjectsAdapter
  • Object
show all
Defined in:
lib/dm-sqlite-adapter/adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ SqliteAdapter

Returns a new instance of SqliteAdapter.



9
10
11
# File 'lib/dm-sqlite-adapter/adapter.rb', line 9

def initialize(name, options)
  super(name, normalize_options(options))
end

Instance Method Details

#normalize_options(options) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/dm-sqlite-adapter/adapter.rb', line 19

def normalize_options(options)
  # TODO Once do_sqlite3 accepts both a Pathname or a String,
  # normalizing database and path won't be necessary anymore
  db   = (options[:database] || options.delete('database')).to_s
  path = (options[:path    ] || options.delete('path')).to_s

  options.update(:adapter => 'sqlite3', :database => db, :path => path)
end

#supports_subquery?(query, source_key, target_key, qualify) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/dm-sqlite-adapter/adapter.rb', line 14

def supports_subquery?(query, source_key, target_key, qualify)
  # SQLite3 cannot match a subquery against more than one column
  source_key.size == 1 && target_key.size == 1
end