We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b98034d + efc0103 commit d94c42bCopy full SHA for d94c42b
2 files changed
lib/sqlite3/database.rb
@@ -65,6 +65,7 @@ def quote( string )
65
def initialize file, options = {}, zvfs = nil
66
mode = Constants::Open::READWRITE | Constants::Open::CREATE
67
68
+ file = file.to_path if file.respond_to? :to_path
69
if file.encoding == ::Encoding::UTF_16LE || file.encoding == ::Encoding::UTF_16BE || options[:utf16]
70
open16 file
71
else
test/test_database.rb
@@ -45,6 +45,17 @@ def test_filename_with_attachment
45
tf.unlink if tf
46
end
47
48
+
49
+ def test_filename_to_path
50
+ tf = Tempfile.new 'thing'
51
+ pn = Pathname tf.path
52
+ db = SQLite3::Database.new pn
53
+ assert_equal pn.expand_path.to_s, File.expand_path(db.filename)
54
+ ensure
55
+ tf.close! if tf
56
+ end
57
58
59
def test_error_code
60
begin
61
db.execute 'SELECT'
0 commit comments