Skip to content

Commit

Permalink
Add new private method to DatabaseCollation to retrieve db encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
lizconlan committed Feb 7, 2017
1 parent 857ee1c commit 2b39cf4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/database_collation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ def supported_collations
map { |row| row['collname'] }
end

def database_encoding
@database_encoding ||= connection.execute("SELECT encoding FROM " \
"pg_database WHERE datname = " \
"'#{connection.current_database}';").
first["encoding"]
end

def adapter_name
@adapter_name ||= connection.adapter_name
end
Expand Down

0 comments on commit 2b39cf4

Please sign in to comment.