postgres-pr 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/postgres-pr/connection.rb +28 -1
- data/lib/postgres-pr/postgres-compat.rb +4 -0
- data/lib/postgres-pr/version.rb +1 -1
- metadata +64 -49
@@ -18,9 +18,35 @@ class Connection
|
|
18
18
|
# A block which is called with the NoticeResponse object as parameter.
|
19
19
|
attr_accessor :notice_processor
|
20
20
|
|
21
|
+
#
|
22
|
+
# Returns one of the following statuses:
|
23
|
+
#
|
24
|
+
# PQTRANS_IDLE = 0 (connection idle)
|
25
|
+
# PQTRANS_INTRANS = 2 (idle, within transaction block)
|
26
|
+
# PQTRANS_INERROR = 3 (idle, within failed transaction)
|
27
|
+
# PQTRANS_UNKNOWN = 4 (cannot determine status)
|
28
|
+
#
|
29
|
+
# Not yet implemented is:
|
30
|
+
#
|
31
|
+
# PQTRANS_ACTIVE = 1 (command in progress)
|
32
|
+
#
|
33
|
+
def transaction_status
|
34
|
+
case @transaction_status
|
35
|
+
when ?I
|
36
|
+
0
|
37
|
+
when ?T
|
38
|
+
2
|
39
|
+
when ?E
|
40
|
+
3
|
41
|
+
else
|
42
|
+
4
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
21
46
|
def initialize(database, user, password=nil, uri = nil)
|
22
47
|
uri ||= DEFAULT_URI
|
23
48
|
|
49
|
+
@transaction_status = nil
|
24
50
|
@params = {}
|
25
51
|
establish_connection(uri)
|
26
52
|
|
@@ -61,7 +87,7 @@ class Connection
|
|
61
87
|
# TODO
|
62
88
|
#p msg
|
63
89
|
when ReadyForQuery
|
64
|
-
|
90
|
+
@transaction_status = msg.backend_transaction_status_indicator
|
65
91
|
break
|
66
92
|
else
|
67
93
|
raise "unhandled message type"
|
@@ -96,6 +122,7 @@ class Connection
|
|
96
122
|
when CommandComplete
|
97
123
|
result.cmd_tag = msg.cmd_tag
|
98
124
|
when ReadyForQuery
|
125
|
+
@transaction_status = msg.backend_transaction_status_indicator
|
99
126
|
break
|
100
127
|
when RowDescription
|
101
128
|
result.fields = msg.fields
|
data/lib/postgres-pr/version.rb
CHANGED
metadata
CHANGED
@@ -1,58 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.6
|
3
|
-
specification_version: 1
|
4
2
|
name: postgres-pr
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
- lib
|
11
|
-
email: mneumann@ntecs.de
|
12
|
-
homepage: ruby-dbi.rubyforge.org
|
13
|
-
rubyforge_project: ruby-dbi
|
14
|
-
description:
|
4
|
+
version: 0.5.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Neumann
|
15
8
|
autorequire:
|
16
|
-
default_executable:
|
17
9
|
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-11-03 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: mneumann@ntecs.de
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- lib/postgres-pr
|
26
|
+
- lib/postgres-pr/postgres-compat.rb
|
27
|
+
- lib/postgres-pr/message.rb
|
28
|
+
- lib/postgres-pr/connection.rb
|
29
|
+
- lib/postgres-pr/version.rb
|
30
|
+
- lib/postgres-pr/typeconv
|
31
|
+
- lib/postgres-pr/typeconv/conv.rb
|
32
|
+
- lib/postgres-pr/typeconv/array.rb
|
33
|
+
- lib/postgres-pr/typeconv/TC_conv.rb
|
34
|
+
- lib/postgres-pr/typeconv/bytea.rb
|
35
|
+
- lib/buffer.rb
|
36
|
+
- lib/binary_writer.rb
|
37
|
+
- lib/binary_reader.rb
|
38
|
+
- lib/byteorder.rb
|
39
|
+
- lib/postgres.rb
|
40
|
+
- test/TC_message.rb
|
41
|
+
- examples/server.rb
|
42
|
+
- examples/test_connection.rb
|
43
|
+
- examples/client.rb
|
44
|
+
- examples/og
|
45
|
+
- examples/og/test.rb
|
18
46
|
has_rdoc: false
|
19
|
-
|
47
|
+
homepage: postgres-pr.rubyforge.org
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
20
54
|
requirements:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
version:
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
25
64
|
version:
|
26
|
-
platform: ruby
|
27
|
-
authors:
|
28
|
-
- Michael Neumann
|
29
|
-
files:
|
30
|
-
- lib/binary_writer.rb
|
31
|
-
- lib/byteorder.rb
|
32
|
-
- lib/postgres-pr
|
33
|
-
- lib/binary_reader.rb
|
34
|
-
- lib/postgres.rb
|
35
|
-
- lib/buffer.rb
|
36
|
-
- lib/postgres-pr/typeconv
|
37
|
-
- lib/postgres-pr/connection.rb
|
38
|
-
- lib/postgres-pr/message.rb
|
39
|
-
- lib/postgres-pr/postgres-compat.rb
|
40
|
-
- lib/postgres-pr/version.rb
|
41
|
-
- lib/postgres-pr/typeconv/array.rb
|
42
|
-
- lib/postgres-pr/typeconv/bytea.rb
|
43
|
-
- lib/postgres-pr/typeconv/conv.rb
|
44
|
-
- lib/postgres-pr/typeconv/TC_conv.rb
|
45
|
-
- test/TC_message.rb
|
46
|
-
- examples/og
|
47
|
-
- examples/client.rb
|
48
|
-
- examples/server.rb
|
49
|
-
- examples/test_connection.rb
|
50
|
-
- examples/og/test.rb
|
51
|
-
test_files: []
|
52
|
-
rdoc_options: []
|
53
|
-
extra_rdoc_files: []
|
54
|
-
executables: []
|
55
|
-
extensions: []
|
56
65
|
requirements:
|
57
|
-
|
58
|
-
|
66
|
+
- PostgreSQL >= 7.4
|
67
|
+
rubyforge_project: postgres-pr
|
68
|
+
rubygems_version: 1.2.0
|
69
|
+
signing_key:
|
70
|
+
specification_version: 2
|
71
|
+
summary: A pure Ruby interface to the PostgreSQL (>= 7.4) database
|
72
|
+
test_files: []
|
73
|
+
|