Class: DataMapper::Adapters::Sqlite3Adapter
- Object
- DataMapper::Adapters::AbstractAdapter
- DataMapper::Adapters::DataObjectsAdapter
- DataMapper::Adapters::Sqlite3Adapter
Included Modules
Constructor Summary
This class inherits a constructor from DataMapper::Adapters::DataObjectsAdapter.
Public Visibility
Public Class Method Summary
| type_map |
TypeMap for SQLite 3 databases. Returns: |
|---|
Public Instance Method Summary
| #field_exists?(storage_name, column_name) |
TODO: move to dm-more/dm-migrations (if possible). |
|---|---|
| #storage_exists?(storage_name) |
TODO: move to dm-more/dm-migrations (if possible). |
Public Instance Methods Inherited from DataMapper::Adapters::DataObjectsAdapter
avg, count, create, create_model_storage, delete, destroy_model_storage, execute, max, min, query, read_set, sum, transaction_primitive, update, upgrade_model_storage
Public Instance Methods Inherited from DataMapper::Adapters::AbstractAdapter
alter_model_storage, alter_property_storage, create_property_storage, current_transaction, delete_set, destroy_property_storage, pop_transaction, push_transaction, read, read_one, within_transaction?
Public Instance Methods Inherited from Object
Public Class Method Details
type_map
TypeMap for SQLite 3 databases.
12 13 14 15 16 17 18 19 20
# File 'dm-core/lib/dm-core/adapters/sqlite3_adapter.rb', line 12 def self.type_map @type_map ||= TypeMap.new(super) do |tm| tm.map(Integer).to('INTEGER') tm.map(Class).to('VARCHAR') end end
Public Instance Method Details
field_exists?
TODO: move to dm-more/dm-migrations (if possible)
28 29 30 31 32
# File 'dm-core/lib/dm-core/adapters/sqlite3_adapter.rb', line 28 def field_exists?(storage_name, column_name) query_table(storage_name).any? do |row| row.name == column_name end end
storage_exists?
TODO: move to dm-more/dm-migrations (if possible)
20 21 22
# File 'dm-core/lib/dm-core/adapters/sqlite3_adapter.rb', line 20 def storage_exists?(storage_name) query_table(storage_name).size > 0 end
Protected Visibility
Protected Instance Method Summary
| #normalize_uri(uri_or_options) |
|---|
Protected Instance Methods Inherited from DataMapper::Adapters::DataObjectsAdapter
Protected Instance Method Details
normalize_uri
36 37 38 39 40
# File 'dm-core/lib/dm-core/adapters/sqlite3_adapter.rb', line 36 def normalize_uri(uri_or_options) uri = super uri.path = File.join(Dir.pwd, File.dirname(uri.path), File.basename(uri.path)) unless File.exists?(uri.path) or uri.path == ':memory:' uri end