module Sequel::Access::DatabaseMethods
Constants
- DATABASE_ERROR_REGEXPS
Public Instance Methods
database_type()
click to toggle source
# File lib/sequel/adapters/shared/access.rb 16 def database_type 17 :access 18 end
rename_table(from_table, to_table)
click to toggle source
serial_primary_key_options()
click to toggle source
Access uses type Counter for an autoincrementing keys
# File lib/sequel/adapters/shared/access.rb 33 def serial_primary_key_options 34 {:primary_key => true, :type=>:Counter} 35 end
Private Instance Methods
alter_table_set_column_type_sql(table, op)
click to toggle source
# File lib/sequel/adapters/shared/access.rb 39 def alter_table_set_column_type_sql(table, op) 40 "ALTER COLUMN #{quote_identifier(op[:name])} #{type_literal(op)}" 41 end
column_schema_integer_min_max_values(column)
click to toggle source
Access’s Byte type will accept much larger values, even though it only stores 0-255. Do not set min/max values for the Byte type.
Calls superclass method
# File lib/sequel/adapters/shared/access.rb 65 def column_schema_integer_min_max_values(column) 66 return if /byte/i =~ column[:db_type] 67 super 68 end
create_table_as(name, ds, options)
click to toggle source
Access doesn’t support CREATE TABLE AS, it only supports SELECT INTO. Emulating CREATE TABLE AS using SELECT INTO is only possible if a dataset is given as the argument, it can’t work with a string, so raise an Error if a string is given.
# File lib/sequel/adapters/shared/access.rb 47 def create_table_as(name, ds, options) 48 raise(Error, "must provide dataset instance as value of create_table :as option on Access") unless ds.is_a?(Sequel::Dataset) 49 run(ds.into(name).sql) 50 end
database_error_regexps()
click to toggle source
# File lib/sequel/adapters/shared/access.rb 58 def database_error_regexps 59 DATABASE_ERROR_REGEXPS 60 end
drop_index_sql(table, op)
click to toggle source
# File lib/sequel/adapters/shared/access.rb 70 def drop_index_sql(table, op) 71 "DROP INDEX #{quote_identifier(op[:name] || default_index_name(table, op[:columns]))} ON #{quote_schema_table(table)}" 72 end
type_literal_generic_bignum_symbol(column)
click to toggle source
Access doesn’t have a 64-bit integer type, so use integer and hope the user isn’t using more than 32 bits.
# File lib/sequel/adapters/shared/access.rb 76 def type_literal_generic_bignum_symbol(column) 77 :integer 78 end
type_literal_generic_file(column)
click to toggle source
Access uses image type for blobs
# File lib/sequel/adapters/shared/access.rb 86 def type_literal_generic_file(column) 87 :image 88 end
type_literal_generic_trueclass(column)
click to toggle source
Access doesn’t have a true boolean class, so it uses bit
# File lib/sequel/adapters/shared/access.rb 81 def type_literal_generic_trueclass(column) 82 :bit 83 end