postgres-pr 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,8 +17,9 @@ class PGconn
17
17
  else
18
18
  "unix:#{ host }/.s.PGSQL.#{ port }"
19
19
  end
20
-
20
+ @host = host
21
21
  @db = database
22
+ @user = user
22
23
  @conn = PostgresPR::Connection.new(database, user, auth, uri)
23
24
  end
24
25
 
@@ -26,7 +27,7 @@ class PGconn
26
27
  @conn.close
27
28
  end
28
29
 
29
- attr_reader :db
30
+ attr_reader :host, :db, :user
30
31
 
31
32
  def query(sql)
32
33
  PGresult.new(@conn.query(sql))
@@ -44,6 +45,15 @@ end
44
45
  class PGresult
45
46
  include Enumerable
46
47
 
48
+ EMPTY_QUERY = 0
49
+ COMMAND_OK = 1
50
+ TUPLES_OK = 2
51
+ COPY_OUT = 3
52
+ COPY_IN = 4
53
+ BAD_RESPONSE = 5
54
+ NONFATAL_ERROR = 6
55
+ FATAL_ERROR = 7
56
+
47
57
  def each(&block)
48
58
  @result.each(&block)
49
59
  end
@@ -93,6 +103,18 @@ class PGresult
93
103
  @result[tup_num][field_num]
94
104
  end
95
105
 
106
+ def status
107
+ if num_tuples > 0
108
+ TUPLES_OK
109
+ else
110
+ COMMAND_OK
111
+ end
112
+ end
113
+
114
+ def cmdstatus
115
+ @res.cmd_tag || ''
116
+ end
117
+
96
118
  # free the result set
97
119
  def clear
98
120
  @res = @fields = @result = nil
@@ -111,3 +133,6 @@ class PGresult
111
133
  end
112
134
 
113
135
  end
136
+
137
+ class PGError < Exception
138
+ end
@@ -1,3 +1,3 @@
1
1
  module PostgresPR
2
- Version = "0.3.6"
2
+ Version = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.4
2
+ rubygems_version: 0.8.6
3
3
  specification_version: 1
4
4
  name: postgres-pr
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.6
7
- date: 2005-01-31
6
+ version: 0.4.0
7
+ date: 2005-04-07
8
8
  summary: A pure Ruby interface to the PostgreSQL (>= 7.4) database
9
9
  require_paths:
10
10
  - lib
@@ -27,16 +27,16 @@ platform: ruby
27
27
  authors:
28
28
  - Michael Neumann
29
29
  files:
30
- - lib/postgres-pr
31
30
  - lib/binary_writer.rb
32
31
  - lib/byteorder.rb
32
+ - lib/postgres-pr
33
33
  - lib/binary_reader.rb
34
34
  - lib/postgres.rb
35
35
  - lib/buffer.rb
36
36
  - lib/postgres-pr/typeconv
37
- - lib/postgres-pr/postgres-compat.rb
38
37
  - lib/postgres-pr/connection.rb
39
38
  - lib/postgres-pr/message.rb
39
+ - lib/postgres-pr/postgres-compat.rb
40
40
  - lib/postgres-pr/version.rb
41
41
  - lib/postgres-pr/typeconv/array.rb
42
42
  - lib/postgres-pr/typeconv/bytea.rb
@@ -44,9 +44,9 @@ files:
44
44
  - lib/postgres-pr/typeconv/TC_conv.rb
45
45
  - test/TC_message.rb
46
46
  - examples/og
47
- - examples/test_connection.rb
48
47
  - examples/client.rb
49
48
  - examples/server.rb
49
+ - examples/test_connection.rb
50
50
  - examples/og/test.rb
51
51
  test_files: []
52
52
  rdoc_options: []