Sha256: ce0eaad732fa19c9ed1186ce4ea9b2e286ca738587b9cee01fe2829df9b5deb4
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
require 'data_mapper/adapters/data_object_adapter' begin require 'do_sqlite3' rescue STDERR.puts <<-EOS You must install the DataObjects::SQLite3 driver. rake dm:install:sqlite3 EOS exit end module DataMapper module Adapters class Sqlite3Adapter < DataObjectAdapter TYPES.merge!({ :integer => 'INTEGER'.freeze, :string => 'TEXT'.freeze, :text => 'TEXT'.freeze, :class => 'TEXT'.freeze }) TABLE_QUOTING_CHARACTER = '"'.freeze COLUMN_QUOTING_CHARACTER = '"'.freeze def create_connection conn = DataObject::Sqlite3::Connection.new("dbname=#{@configuration.database}") conn.open return conn end module Mappings class Table def to_exists_sql @to_exists_sql || @to_exists_sql = <<-EOS.compress_lines SELECT "name" FROM "sqlite_master" WHERE "type" = "table" AND "name" = #{@adapter.quote_value(name)} EOS end end # class Table class Column def serial_declaration "AUTOINCREMENT" end def size nil end end # class Column end # module Mappings end # class Sqlite3Adapter end # module Adapters end # module DataMapper
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
datamapper-0.2.0 | lib/data_mapper/adapters/sqlite3_adapter.rb |