dbd-pg 0.3.7 → 0.3.8
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/Pg.rb +1 -1
- data/lib/dbd/pg/database.rb +4 -0
- data/test/dbd/general/test_database.rb +13 -0
- data/test/dbd/postgresql/testdbipg.rb +6 -0
- metadata +11 -12
- data/test/dbd/postgresql/base.rb.new +0 -32
data/lib/dbd/Pg.rb
CHANGED
data/lib/dbd/pg/database.rb
CHANGED
@@ -102,6 +102,10 @@ class DBI::DBD::Pg::Database < DBI::BaseDatabase
|
|
102
102
|
answer.clear if answer
|
103
103
|
end
|
104
104
|
|
105
|
+
def database_name
|
106
|
+
@connection.db
|
107
|
+
end
|
108
|
+
|
105
109
|
def tables
|
106
110
|
stmt = execute("SELECT c.relname FROM pg_catalog.pg_class c WHERE c.relkind IN ('r','v') and pg_catalog.pg_table_is_visible(c.oid)")
|
107
111
|
res = stmt.fetch_all.collect {|row| row[0]}
|
@@ -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|
|
@@ -25,6 +25,12 @@ class TestDbdPostgres < DBDConfig.testbase(:postgresql)
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def test_database_name
|
29
|
+
assert_nothing_raised do
|
30
|
+
assert_equal DBDConfig.get_config[dbtype]['dbname'], @dbh.database_name
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
28
34
|
def test_enum_type
|
29
35
|
assert_nothing_raised do
|
30
36
|
assert(@dbh.convert_types)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbd-pg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
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,27 +44,26 @@ 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
|
50
|
-
- test/dbd/
|
49
|
+
- test/dbd/general/test_types.rb
|
51
50
|
- test/dbd/postgresql/base.rb
|
52
|
-
- test/dbd/postgresql/
|
53
|
-
- test/dbd/postgresql/base.rb.new
|
54
|
-
- test/dbd/postgresql/test_blob.rb
|
51
|
+
- test/dbd/postgresql/testdbipg.rb
|
55
52
|
- test/dbd/postgresql/test_async.rb
|
53
|
+
- test/dbd/postgresql/test_arrays.rb
|
56
54
|
- test/dbd/postgresql/down.sql
|
57
|
-
- test/dbd/postgresql/test_transactions.rb
|
58
55
|
- test/dbd/postgresql/up.sql
|
59
|
-
- test/dbd/postgresql/test_arrays.rb
|
60
|
-
- test/dbd/postgresql/testdbipg.rb
|
61
56
|
- test/dbd/postgresql/test_bytea.rb
|
57
|
+
- test/dbd/postgresql/test_transactions.rb
|
58
|
+
- test/dbd/postgresql/test_ping.rb
|
59
|
+
- test/dbd/postgresql/test_timestamp.rb
|
60
|
+
- test/dbd/postgresql/test_blob.rb
|
62
61
|
- lib/dbd/Pg.rb
|
63
|
-
- lib/dbd/pg/database.rb
|
64
62
|
- lib/dbd/pg/tuples.rb
|
63
|
+
- lib/dbd/pg/database.rb
|
65
64
|
- lib/dbd/pg/statement.rb
|
66
|
-
- lib/dbd/pg/exec.rb
|
67
65
|
- lib/dbd/pg/type.rb
|
66
|
+
- lib/dbd/pg/exec.rb
|
68
67
|
- test/DBD_TESTS
|
69
68
|
- README
|
70
69
|
- LICENSE
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
DBDConfig.set_testbase(:postgresql, Class.new(Test::Unit::TestCase) do
|
5
|
-
|
6
|
-
def dbtype
|
7
|
-
"postgresql"
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_base
|
11
|
-
assert_equal(@dbh.driver_name, "Pg")
|
12
|
-
assert_kind_of(DBI::DBD::Pg::Database, @dbh.instance_variable_get(:@handle))
|
13
|
-
end
|
14
|
-
|
15
|
-
def set_base_dbh
|
16
|
-
config = DBDConfig.get_config['postgresql']
|
17
|
-
@dbh = DBI.connect("dbi:Pg:#{config['dbname']}", config['username'], config['password'])
|
18
|
-
end
|
19
|
-
|
20
|
-
def setup
|
21
|
-
set_base_dbh
|
22
|
-
DBDConfig.inject_sql(@dbh, dbtype, "dbd/postgresql/up.sql")
|
23
|
-
end
|
24
|
-
|
25
|
-
def teardown
|
26
|
-
@sth.finish if @sth && !@sth.finished?
|
27
|
-
config = DBDConfig.get_config['postgresql']
|
28
|
-
DBDConfig.inject_sql(@dbh, dbtype, "dbd/postgresql/down.sql")
|
29
|
-
@dbh.disconnect
|
30
|
-
end
|
31
|
-
end
|
32
|
-
)
|