aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-30 13:21:47 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-30 13:21:47 +0000
commit9ede45f60fd112c313840e707e1fdfebb5f6b97c (patch)
tree5dd7b831ac4d4879c0d5759efcb90d23d98c9573 /activerecord
parent90b08c5b921d608f097adcf231e13eaa870dfede (diff)
downloadrails-9ede45f60fd112c313840e707e1fdfebb5f6b97c.tar.gz
rails-9ede45f60fd112c313840e707e1fdfebb5f6b97c.tar.bz2
rails-9ede45f60fd112c313840e707e1fdfebb5f6b97c.zip
Added encoding and min_messages options for PostgreSQL #1205 [shugo]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1255 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG11
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb6
2 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index c4dacc85ff..6052c30174 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,16 @@
*SVN*
+* Added encoding and min_messages options for PostgreSQL #1205 [shugo]. Configuration example:
+
+ development:
+ adapter: postgresql
+ database: rails_development
+ host: localhost
+ username: postgres
+ password:
+ encoding: UTF8
+ min_messages: ERROR
+
* Fixed acts_as_list where deleting an item that was removed from the list would ruin the positioning of other list items #1197 [Jamis Buck]
* Added validates_exclusion_of as a negative of validates_inclusion_of
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index f9719b9f2b..9161878d5a 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -25,6 +25,8 @@ module ActiveRecord
password = config[:password].to_s
schema_order = config[:schema_order]
+ encoding = config[:encoding]
+ min_messages = config[:min_messages]
if config.has_key?(:database)
database = config[:database]
@@ -37,6 +39,8 @@ module ActiveRecord
)
pga.execute("SET search_path TO #{schema_order}") if schema_order
+ pga.execute("SET client_encoding TO '#{encoding}'") if encoding
+ pga.execute("SET client_min_messages TO '#{min_messages}'") if min_messages
pga
end
@@ -54,6 +58,8 @@ module ActiveRecord
# * <tt>:password</tt> -- Defaults to nothing
# * <tt>:database</tt> -- The name of the database. No default, must be provided.
# * <tt>:schema_order</tt> -- An optional schema order string that is using in a SET search_path TO <schema_order> call on connection.
+ # * <tt>:encoding</tt> -- An optional client encoding that is using in a SET client_encoding TO <encoding> call on connection.
+ # * <tt>:min_messages</tt> -- An optional client min messages that is using in a SET client_min_messages TO <min_messages> call on connection.
class PostgreSQLAdapter < AbstractAdapter
def select_all(sql, name = nil)
select(sql, name)