Skip to content

Commit

Permalink
Another hack for last_insert_id for MS Access vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
jmozmoz committed Sep 13, 2011
1 parent 7db2f87 commit d372dc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion activerecord-odbc-adapter.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = %q{activerecord-odbc-adapter}
s.version = "2.4.0"
s.version = "2.4.1"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Carl Blakeley", "Sytse Sijbrandij", "James Herdman", "Andrew Rollins"]
Expand Down
13 changes: 7 additions & 6 deletions lib/active_record/vendor/odbcext_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,30 @@
require 'active_record/connection_adapters/abstract_adapter'

module ODBCExt

# ------------------------------------------------------------------------
# Mandatory methods
#

# #last_insert_id must be implemented for any database which returns
# false from #prefetch_primary_key?
def last_insert_id(table, sequence_name, stmt = nil)
@logger.unknown("ODBCAdapter#last_insert_id>") if @trace
select_value("select @@IDENTITY", 'last_insert_id')
select_value("select max(#{quote_column_name(sequence_name)}) " +
"from #{quote_table_name(table)}", 'last_insert_id')
end

# ------------------------------------------------------------------------
# Method redefinitions
#
# DBMS specific methods which override the default implementation
# DBMS specific methods which override the default implementation
# provided by the ODBCAdapter core.

def add_column_options!(name, options = {})
@logger.unknown("ODBCAdapter#add_column_options overloaded>") if @trace
@logger.unknown("name=#{name}") if @trace
if options.has_key?(:default) then
options.delete(:default)
options.delete(:default)
# FIXME: Call ALTER TABLE via JetDB or something else to set default!
# see e.g. http://goo.gl/9wqH9
end
Expand All @@ -60,7 +61,7 @@ def type_to_sql(type, limit = nil, precision = nil, scale = nil) # :nodoc:
@logger.unknown("ODBCAdapter#type_to_sql overloaded>") if @trace
@logger.unknown("args=[#{type}|#{limit}|#{precision}|#{scale}]") if @trace
super(type, limit)
# FIXME: Call ALTER TABLE via ADO or something else to set
# FIXME: Call ALTER TABLE via ADO or something else to set
# precision and scale! See e.g. http://goo.gl/CPI45
rescue Exception => e
@logger.unknown("exception=#{e}") if @trace
Expand Down

0 comments on commit d372dc1

Please sign in to comment.