Class: DataMapper::Adapters::SqliteAdapter
- Inherits:
-
DataObjectsAdapter
- Object
- DataObjectsAdapter
- DataMapper::Adapters::SqliteAdapter
- Defined in:
- lib/dm-sqlite-adapter/adapter.rb
Instance Method Summary collapse
-
#initialize(name, options) ⇒ SqliteAdapter
constructor
A new instance of SqliteAdapter.
- #normalize_options(options) ⇒ Object
- #supports_subquery?(query, source_key, target_key, qualify) ⇒ Boolean private
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, ) super(name, ()) end |
Instance Method Details
#normalize_options(options) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dm-sqlite-adapter/adapter.rb', line 19 def () # TODO Once do_sqlite3 accepts both a Pathname or a String, # normalizing database and path won't be necessary anymore # Clean out all the 'path-like' parameters in the options hash # ensuring there can only be one. # Also make sure a blank value can't possibly mask a non-blank one path = nil [:path, 'path', :database, 'database'].each do |key| db = .delete(key) unless db.nil? normalized_db = db.to_s # no Symbol#empty? on 1.8.7(ish) rubies path ||= normalized_db unless normalized_db.empty? end end .update(:adapter => 'sqlite3', :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.
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 |