diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-06-26 13:34:50 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-26 22:37:45 +0200 |
commit | 100d2282e306f68d8ce0324128da1506eafc43a2 (patch) | |
tree | 9685879e9c4e7100a5fb14d61b374db1dd3f3716 /activerecord/lib/active_record | |
parent | 5b91c97763f1183f131e46e51ed33129c6b1edcc (diff) | |
download | rails-100d2282e306f68d8ce0324128da1506eafc43a2.tar.gz rails-100d2282e306f68d8ce0324128da1506eafc43a2.tar.bz2 rails-100d2282e306f68d8ce0324128da1506eafc43a2.zip |
adding adapter tests, avoiding private apis, fixing code in 1.9 [#4986 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index f295af16f0..0d9a86a1ea 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -6,6 +6,10 @@ module ActiveRecord def self.sqlite3_connection(config) # :nodoc: parse_sqlite_config!(config) + unless 'sqlite3' == config[:adapter] + raise ArgumentError, 'adapter name should be "sqlite3"' + end + unless self.class.const_defined?(:SQLite3) require_library_or_gem(config[:adapter]) end @@ -24,13 +28,13 @@ module ActiveRecord module ConnectionAdapters #:nodoc: class SQLite3Adapter < SQLiteAdapter # :nodoc: - + # Returns the current database encoding format as a string, eg: 'UTF-8' def encoding if @connection.respond_to?(:encoding) - @connection.encoding[0]['encoding'] + @connection.encoding.to_s else - encoding = @connection.send(:get_query_pragma, 'encoding') + encoding = @connection.execute('PRAGMA encoding') encoding[0]['encoding'] end end |