postgres-pr 0.3.1 → 0.3.2

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.
@@ -74,7 +74,7 @@ class Connection
74
74
  end
75
75
 
76
76
  class Result
77
- attr_accessor :rows, :fields
77
+ attr_accessor :rows, :fields, :cmd_tag
78
78
  def initialize(rows=[], fields=[])
79
79
  @rows, @fields = rows, fields
80
80
  end
@@ -93,6 +93,7 @@ class Connection
93
93
  when DataRow
94
94
  result.rows << msg.columns
95
95
  when CommandComplete
96
+ result.cmd_tag = msg.cmd_tag
96
97
  when ReadyForQuery
97
98
  break
98
99
  when RowDescription
@@ -94,4 +94,17 @@ class PGresult
94
94
  def clear
95
95
  @res = @fields = @result = nil
96
96
  end
97
+
98
+ # Returns the number of rows affected by the SQL command
99
+ def cmdtuples
100
+ case @res.cmd_tag
101
+ when nil
102
+ return nil
103
+ when /^INSERT\s+(\d+)\s+(\d+)$/, /^(DELETE|UPDATE|MOVE|FETCH)\s+(\d+)$/
104
+ $2.to_i
105
+ else
106
+ nil
107
+ end
108
+ end
109
+
97
110
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.3
2
+ rubygems_version: 0.8.4
3
3
  specification_version: 1
4
4
  name: postgres-pr
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.1
7
- date: 2004-12-21
6
+ version: 0.3.2
7
+ date: 2005-01-04
8
8
  summary: A pure Ruby interface to the PostgreSQL database
9
9
  require_paths:
10
10
  - lib
@@ -30,23 +30,23 @@ files:
30
30
  - lib/binary_writer.rb
31
31
  - lib/byteorder.rb
32
32
  - lib/postgres-pr
33
+ - lib/binary_reader.rb
34
+ - lib/postgres.rb
35
+ - lib/buffer.rb
33
36
  - lib/postgres-pr/typeconv
37
+ - lib/postgres-pr/connection.rb
38
+ - lib/postgres-pr/message.rb
39
+ - lib/postgres-pr/postgres-compat.rb
34
40
  - lib/postgres-pr/typeconv/array.rb
35
41
  - lib/postgres-pr/typeconv/bytea.rb
36
42
  - lib/postgres-pr/typeconv/conv.rb
37
43
  - lib/postgres-pr/typeconv/TC_conv.rb
38
- - lib/postgres-pr/connection.rb
39
- - lib/postgres-pr/message.rb
40
- - lib/postgres-pr/postgres-compat.rb
41
- - lib/binary_reader.rb
42
- - lib/postgres.rb
43
- - lib/buffer.rb
44
44
  - test/TC_message.rb
45
45
  - examples/og
46
- - examples/og/test.rb
47
- - examples/test_connection.rb
48
46
  - examples/client.rb
49
47
  - examples/server.rb
48
+ - examples/test_connection.rb
49
+ - examples/og/test.rb
50
50
  test_files: []
51
51
  rdoc_options: []
52
52
  extra_rdoc_files: []