dbd-sqlite3 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,7 +50,7 @@ module DBI
50
50
  # Only things that extend DBI's results are documented.
51
51
  #
52
52
  module SQLite3
53
- VERSION = "1.2.4"
53
+ VERSION = "1.2.5"
54
54
  DESCRIPTION = "SQLite 3.x DBD for DBI"
55
55
 
56
56
  #
@@ -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
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: 2008-12-15 00:00:00 -08:00
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