aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-11-01 20:28:48 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-11-01 20:28:48 +0000
commit70840d4b7fcd16c45b7be69c51b0bd1d27c7cbff (patch)
treeb56f01e4586c05e69d1575a986ae59cfa640460e /activerecord/lib/active_record/connection_adapters/abstract
parentc1c96d55d754e6de1572e35bc9bc68cc896655bf (diff)
downloadrails-70840d4b7fcd16c45b7be69c51b0bd1d27c7cbff.tar.gz
rails-70840d4b7fcd16c45b7be69c51b0bd1d27c7cbff.tar.bz2
rails-70840d4b7fcd16c45b7be69c51b0bd1d27c7cbff.zip
Oracle: resolve test failures, use prefetched primary key for inserts, check for null defaults. Factor out some common methods from all adapters. Closes #6515.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5384 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb23
1 files changed, 19 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
index d91b919116..7d7c22c74b 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -4,11 +4,14 @@ module ActiveRecord
# Returns an array of record hashes with the column names as keys and
# column values as values.
def select_all(sql, name = nil)
+ select(sql, name)
end
# Returns a record hash with the column names as keys and column values
# as values.
def select_one(sql, name = nil)
+ result = select(sql, name)
+ result.first if result
end
# Returns a single value from a record
@@ -25,19 +28,24 @@ module ActiveRecord
end
# Executes the SQL statement in the context of this connection.
- # This abstract method raises a NotImplementedError.
def execute(sql, name = nil)
raise NotImplementedError, "execute is an abstract method"
end
# Returns the last auto-generated ID from the affected table.
- def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) end
+ def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
+ raise NotImplementedError, "insert is an abstract method"
+ end
# Executes the update statement and returns the number of rows affected.
- def update(sql, name = nil) end
+ def update(sql, name = nil)
+ execute(sql, name)
+ end
# Executes the delete statement and returns the number of rows affected.
- def delete(sql, name = nil) end
+ def delete(sql, name = nil)
+ update(sql, name)
+ end
# Wrap a block in a transaction. Returns result of block.
def transaction(start_db_transaction = true)
@@ -110,6 +118,13 @@ module ActiveRecord
def reset_sequence!(table, column, sequence = nil)
# Do nothing by default. Implement for PostgreSQL, Oracle, ...
end
+
+ protected
+ # Returns an array of record hashes with the column names as keys and
+ # column values as values.
+ def select(sql, name = nil)
+ raise NotImplementedError, "select is an abstract method"
+ end
end
end
end