dbd-sqlite3 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/dbd/SQLite3.rb +1 -1
- data/lib/dbd/sqlite3/database.rb +9 -0
- data/test/dbd/general/test_database.rb +13 -0
- data/test/dbd/sqlite3/test_database.rb +6 -0
- metadata +4 -4
data/lib/dbd/SQLite3.rb
CHANGED
data/lib/dbd/sqlite3/database.rb
CHANGED
@@ -46,6 +46,15 @@ class DBI::DBD::SQLite3::Database < DBI::BaseDatabase
|
|
46
46
|
DBI::DBD::SQLite3::Statement.new(statement, @db)
|
47
47
|
end
|
48
48
|
|
49
|
+
def database_name
|
50
|
+
st = DBI::DBD::SQLite3::Statement.new('PRAGMA database_list', @db)
|
51
|
+
st.execute
|
52
|
+
row = st.fetch
|
53
|
+
st.finish
|
54
|
+
|
55
|
+
return row[2]
|
56
|
+
end
|
57
|
+
|
49
58
|
def ping()
|
50
59
|
not @db.closed?
|
51
60
|
end
|
@@ -1,5 +1,18 @@
|
|
1
1
|
@class = Class.new(DBDConfig.testbase(DBDConfig.current_dbtype)) do
|
2
2
|
|
3
|
+
def test_last_statement
|
4
|
+
@sth = @dbh.prepare("select * from names")
|
5
|
+
@sth.finish
|
6
|
+
assert_equal "select * from names", @dbh.last_statement
|
7
|
+
|
8
|
+
@sth = @dbh.execute("select * from names")
|
9
|
+
@sth.finish
|
10
|
+
assert_equal "select * from names", @dbh.last_statement
|
11
|
+
|
12
|
+
@dbh.do("select * from names")
|
13
|
+
assert_equal "select * from names", @dbh.last_statement
|
14
|
+
end
|
15
|
+
|
3
16
|
def test_empty_query
|
4
17
|
["", " ", "\t"].each do |str|
|
5
18
|
[:do, :prepare, :execute, :select_one, :select_all].each do |call|
|
@@ -1,4 +1,10 @@
|
|
1
1
|
class TestDatabase < DBDConfig.testbase(:sqlite3)
|
2
|
+
def test_database_name
|
3
|
+
assert_nothing_raised do
|
4
|
+
assert_equal DBDConfig.get_config[dbtype]['dbname'], @dbh.database_name
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
2
8
|
def test_disconnect
|
3
9
|
assert_nil @dbh.disconnect
|
4
10
|
assert_nil @dbh.instance_variable_get("@db")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbd-sqlite3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Hollensbe
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2009-07-11 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -44,12 +44,12 @@ extra_rdoc_files:
|
|
44
44
|
- LICENSE
|
45
45
|
- ChangeLog
|
46
46
|
files:
|
47
|
-
- test/dbd/general/test_types.rb
|
48
47
|
- test/dbd/general/test_statement.rb
|
49
48
|
- test/dbd/general/test_database.rb
|
49
|
+
- test/dbd/general/test_types.rb
|
50
50
|
- test/dbd/sqlite3/base.rb
|
51
|
-
- test/dbd/sqlite3/test_statement.rb
|
52
51
|
- test/dbd/sqlite3/test_driver.rb
|
52
|
+
- test/dbd/sqlite3/test_statement.rb
|
53
53
|
- test/dbd/sqlite3/up.sql
|
54
54
|
- test/dbd/sqlite3/test_database.rb
|
55
55
|
- lib/dbd/SQLite3.rb
|