pg 0.15.0-x86-mingw32 → 0.15.1-x86-mingw32

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.tar.gz.sig CHANGED
Binary file
data/ChangeLog CHANGED
@@ -1,8 +1,53 @@
1
+ 2013-04-08 Michael Granger <ged@FaerieMUD.org>
2
+
3
+ * History.rdoc:
4
+ Fix date in History
5
+ [de1cdb0f7ba6] [tip]
6
+
7
+ * .hgtags:
8
+ Added tag v0.15.1 for changeset 4692c20bcbde
9
+ [765d242ccf70]
10
+
11
+ * .hgsigs:
12
+ Added signature for changeset 0bfb6ff650be
13
+ [4692c20bcbde] [v0.15.1]
14
+
15
+ * lib/pg.rb:
16
+ Bump the patch version
17
+ [0bfb6ff650be]
18
+
19
+ * Merge with v0.15-stable
20
+ [650a853efd0d]
21
+
22
+ * ext/pg_connection.c, lib/pg/connection.rb:
23
+ Update PG::Connection documentation
24
+ [4514df7221a8]
25
+
26
+ 2013-04-05 Lars Kanis <kanis@comcard.de>
27
+
28
+ * History.rdoc:
29
+ Update History.rdoc.
30
+ [1d0173b7a077] <v0.15-stable>
31
+
32
+ * lib/pg/connection.rb, spec/pg/connection_spec.rb:
33
+ Send a shortened $0 as application_name to the server in order to
34
+ avoid warnings about truncated identifier.
35
+
36
+ Thanks to Svoop for this report.
37
+ [9a6791fe9409]
38
+
39
+ * lib/pg/connection.rb, spec/pg/connection_spec.rb:
40
+ Send a shortened $0 as application_name to the server in order to
41
+ avoid warnings about truncated identifier.
42
+
43
+ Thanks to Svoop for this report.
44
+ [134e067259ee] <v0.15-stable>
45
+
1
46
  2013-03-26 Michael Granger <ged@FaerieMUD.org>
2
47
 
3
48
  * README.rdoc:
4
49
  Update README, add Lars as maintainer
5
- [5060601d2e64] [tip]
50
+ [5060601d2e64]
6
51
 
7
52
  * ext/pg_result.c, lib/pg/exceptions.rb, sample/async_api.rb,
8
53
  sample/async_mixed.rb, sample/cursor.rb,
@@ -1,3 +1,10 @@
1
+ == v0.15.1 [2013-04-08] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Bugfixes:
4
+
5
+ - Shorten application_name to avoid warnings about truncated identifier.
6
+
7
+
1
8
  == v0.15.0 [2013-03-03] Michael Granger <ged@FaerieMUD.org>
2
9
 
3
10
  Bugfixes:
@@ -9,7 +9,7 @@ docs :: http://deveiate.org/code/pg
9
9
 
10
10
  Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
11
11
 
12
- It works with {PostgreSQL 8.3 and later}[http://bit.ly/6AfPhm].
12
+ It works with {PostgreSQL 8.4 and later}[http://www.postgresql.org/support/versioning/].
13
13
 
14
14
  A small example usage:
15
15
 
@@ -34,10 +34,11 @@ A small example usage:
34
34
 
35
35
  == Requirements
36
36
 
37
- * Ruby 1.8.7-p371, 1.9.3-p392, or 2.0.0-p0.
38
- * PostgreSQL 8.3.x (with headers, -dev packages, etc).
37
+ * Ruby 1.9.3-p392, or 2.0.0-p0.
38
+ * PostgreSQL 8.4.x or later (with headers, -dev packages, etc).
39
39
 
40
- It may work with earlier versions of Ruby as well, but those are not regularly tested.
40
+ It may work with earlier versions of Ruby/PostgreSQL as well, but those are
41
+ not regularly tested.
41
42
 
42
43
 
43
44
  == How To Install
@@ -76,16 +77,18 @@ After checking out the source, run:
76
77
  This task will install any missing dependencies, run the tests/specs, and
77
78
  generate the API documentation.
78
79
 
79
- The current maintainer is Michael Granger <ged@FaerieMUD.org>.
80
+ The current maintainers are Michael Granger <ged@FaerieMUD.org> and
81
+ Lars Kanis <lars@greiz-reinsdorf.de>.
80
82
 
81
83
 
82
84
  == Copying
83
85
 
84
- Copyright (c) 1997-2012 by the authors.
86
+ Copyright (c) 1997-2013 by the authors.
85
87
 
86
88
  * Jeff Davis <ruby-pg@j-davis.com>
87
89
  * Guy Decoux (ts) <decoux@moulon.inra.fr>
88
90
  * Michael Granger <ged@FaerieMUD.org>
91
+ * Lars Kanis <lars@greiz-reinsdorf.de>
89
92
  * Dave Lee
90
93
  * Eiji Matsumoto <usagi@ruby.club.or.jp>
91
94
  * Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -7,23 +7,6 @@
7
7
  #include "pg.h"
8
8
 
9
9
 
10
- /********************************************************************
11
- *
12
- * Document-class: PG::Connection
13
- *
14
- * The class to access PostgreSQL RDBMS, based on the libpq interface,
15
- * provides convenient OO methods to interact with PostgreSQL.
16
- *
17
- * For example, to send query to the database on the localhost:
18
- * require 'pg'
19
- * conn = PG::Connection.open(:dbname => 'test')
20
- * res = conn.exec('SELECT $1 AS a, $2 AS b, $3 AS c',[1, 2, nil])
21
- * # Equivalent to:
22
- * # res = conn.exec('SELECT 1 AS a, 2 AS b, NULL AS c')
23
- *
24
- * See the PG::Result class for information on working with the results of a query.
25
- *
26
- */
27
10
  VALUE rb_cPGconn;
28
11
 
29
12
  static PQnoticeReceiver default_notice_receiver = NULL;
@@ -147,10 +147,10 @@ pgresult_get(VALUE self)
147
147
 
148
148
 
149
149
  /********************************************************************
150
- *
150
+ *
151
151
  * Document-class: PG::Result
152
152
  *
153
- * The class to represent the query result tuples (rows).
153
+ * The class to represent the query result tuples (rows).
154
154
  * An instance of this class is created as the result of every query.
155
155
  * You may need to invoke the #clear method of the instance when finished with
156
156
  * the result for better memory performance.
@@ -162,7 +162,7 @@ pgresult_get(VALUE self)
162
162
  * res.getvalue(0,0) # '1'
163
163
  * res[0]['b'] # '2'
164
164
  * res[0]['c'] # nil
165
- *
165
+ *
166
166
  */
167
167
 
168
168
  /**************************************************************************
@@ -209,7 +209,7 @@ pgresult_res_status(VALUE self, VALUE status)
209
209
  * call-seq:
210
210
  * res.error_message() -> String
211
211
  *
212
- * Returns the error message of the command as a string.
212
+ * Returns the error message of the command as a string.
213
213
  */
214
214
  static VALUE
215
215
  pgresult_error_message(VALUE self)
@@ -240,7 +240,7 @@ pgresult_error_message(VALUE self)
240
240
  * * +PG_DIAG_SOURCE_FUNCTION+
241
241
  *
242
242
  * An example:
243
- *
243
+ *
244
244
  * begin
245
245
  * conn.exec( "SELECT * FROM nonexistant_table" )
246
246
  * rescue PG::Error => err
@@ -259,10 +259,10 @@ pgresult_error_message(VALUE self)
259
259
  * result.error_field( PG::Result::PG_DIAG_SOURCE_FUNCTION ),
260
260
  * ]
261
261
  * end
262
- *
262
+ *
263
263
  * Outputs:
264
- *
265
- * ["ERROR", "42P01", "relation \"nonexistant_table\" does not exist", nil, nil,
264
+ *
265
+ * ["ERROR", "42P01", "relation \"nonexistant_table\" does not exist", nil, nil,
266
266
  * "15", nil, nil, nil, "path/to/parse_relation.c", "857", "parserOpenTable"]
267
267
  */
268
268
  static VALUE
@@ -381,7 +381,7 @@ pgresult_ftable(VALUE self, VALUE column_number)
381
381
  int col_number = NUM2INT(column_number);
382
382
  PGresult *pgresult = pgresult_get(self);
383
383
 
384
- if( col_number < 0 || col_number >= PQnfields(pgresult))
384
+ if( col_number < 0 || col_number >= PQnfields(pgresult))
385
385
  rb_raise(rb_eArgError,"Invalid column index: %d", col_number);
386
386
 
387
387
  n = PQftable(pgresult, col_number);
@@ -392,7 +392,7 @@ pgresult_ftable(VALUE self, VALUE column_number)
392
392
  * call-seq:
393
393
  * res.ftablecol( column_number ) -> Fixnum
394
394
  *
395
- * Returns the column number (within its table) of the table from
395
+ * Returns the column number (within its table) of the table from
396
396
  * which the column _column_number_ is made up.
397
397
  *
398
398
  * Raises ArgumentError if _column_number_ is out of range or if
@@ -406,7 +406,7 @@ pgresult_ftablecol(VALUE self, VALUE column_number)
406
406
 
407
407
  int n;
408
408
 
409
- if( col_number < 0 || col_number >= PQnfields(pgresult))
409
+ if( col_number < 0 || col_number >= PQnfields(pgresult))
410
410
  rb_raise(rb_eArgError,"Invalid column index: %d", col_number);
411
411
 
412
412
  n = PQftablecol(pgresult, col_number);
@@ -419,7 +419,7 @@ pgresult_ftablecol(VALUE self, VALUE column_number)
419
419
  *
420
420
  * Returns the format (0 for text, 1 for binary) of column
421
421
  * _column_number_.
422
- *
422
+ *
423
423
  * Raises ArgumentError if _column_number_ is out of range.
424
424
  */
425
425
  static VALUE
@@ -428,7 +428,7 @@ pgresult_fformat(VALUE self, VALUE column_number)
428
428
  PGresult *result = pgresult_get(self);
429
429
  int fnumber = NUM2INT(column_number);
430
430
  if (fnumber < 0 || fnumber >= PQnfields(result)) {
431
- rb_raise(rb_eArgError, "Column number is out of range: %d",
431
+ rb_raise(rb_eArgError, "Column number is out of range: %d",
432
432
  fnumber);
433
433
  }
434
434
  return INT2FIX(PQfformat(result, fnumber));
@@ -442,14 +442,14 @@ pgresult_fformat(VALUE self, VALUE column_number)
442
442
  *
443
443
  * The integer returned is the internal +OID+ number (in PostgreSQL)
444
444
  * of the type. To get a human-readable value for the type, use the
445
- * returned OID and the field's #fmod value with the format_type() SQL
445
+ * returned OID and the field's #fmod value with the format_type() SQL
446
446
  * function:
447
- *
447
+ *
448
448
  * # Get the type of the second column of the result 'res'
449
449
  * typename = conn.
450
450
  * exec( "SELECT format_type($1,$2)", [res.ftype(1), res.fmod(1)] ).
451
451
  * getvalue( 0, 0 )
452
- *
452
+ *
453
453
  * Raises an ArgumentError if _column_number_ is out of range.
454
454
  */
455
455
  static VALUE
@@ -467,9 +467,9 @@ pgresult_ftype(VALUE self, VALUE index)
467
467
  * call-seq:
468
468
  * res.fmod( column_number )
469
469
  *
470
- * Returns the type modifier associated with column _column_number_. See
470
+ * Returns the type modifier associated with column _column_number_. See
471
471
  * the #ftype method for an example of how to use this.
472
- *
472
+ *
473
473
  * Raises an ArgumentError if _column_number_ is out of range.
474
474
  */
475
475
  static VALUE
@@ -479,7 +479,7 @@ pgresult_fmod(VALUE self, VALUE column_number)
479
479
  int fnumber = NUM2INT(column_number);
480
480
  int modifier;
481
481
  if (fnumber < 0 || fnumber >= PQnfields(result)) {
482
- rb_raise(rb_eArgError, "Column number is out of range: %d",
482
+ rb_raise(rb_eArgError, "Column number is out of range: %d",
483
483
  fnumber);
484
484
  }
485
485
  modifier = PQfmod(result,fnumber);
@@ -688,7 +688,7 @@ pgresult_oid_value(VALUE self)
688
688
  * call-seq:
689
689
  * res[ n ] -> Hash
690
690
  *
691
- * Returns tuple _n_ as a hash.
691
+ * Returns tuple _n_ as a hash.
692
692
  */
693
693
  static VALUE
694
694
  pgresult_aref(VALUE self, VALUE index)
@@ -752,7 +752,7 @@ pgresult_each_row(VALUE self)
752
752
  rb_ary_store( new_row, field, Qnil );
753
753
  }
754
754
  else {
755
- VALUE val = rb_tainted_str_new( PQgetvalue(result, row, field),
755
+ VALUE val = rb_tainted_str_new( PQgetvalue(result, row, field),
756
756
  PQgetlength(result, row, field) );
757
757
 
758
758
  #ifdef M17N_SUPPORTED
@@ -795,7 +795,7 @@ make_column_result_array( VALUE self, int col )
795
795
 
796
796
  #ifdef M17N_SUPPORTED
797
797
  /* associate client encoding for text format only */
798
- if ( 0 == PQfformat(result, col) ) {
798
+ if ( 0 == PQfformat(result, col) ) {
799
799
  ASSOCIATE_INDEX( val, self );
800
800
  } else {
801
801
  rb_enc_associate( val, rb_ascii8bit_encoding() );
@@ -813,7 +813,7 @@ make_column_result_array( VALUE self, int col )
813
813
  * call-seq:
814
814
  * res.column_values( n ) -> array
815
815
  *
816
- * Returns an Array of the values from the nth column of each
816
+ * Returns an Array of the values from the nth column of each
817
817
  * tuple in the result.
818
818
  *
819
819
  */
Binary file
Binary file
Binary file
data/lib/pg.rb CHANGED
@@ -19,7 +19,7 @@ end
19
19
  module PG
20
20
 
21
21
  # Library version
22
- VERSION = '0.15.0'
22
+ VERSION = '0.15.1'
23
23
 
24
24
  # VCS revision
25
25
  REVISION = %q$Revision$
@@ -2,7 +2,21 @@
2
2
 
3
3
  require 'pg' unless defined?( PG )
4
4
 
5
- # The PG connection class.
5
+ # The PostgreSQL connection class. The interface for this class is based on
6
+ # {libpq}[http://www.postgresql.org/docs/9.2/interactive/libpq.html], the C
7
+ # application programmer's interface to PostgreSQL. Some familiarity with libpq
8
+ # is recommended, but not necessary.
9
+ #
10
+ # For example, to send query to the database on the localhost:
11
+ #
12
+ # require 'pg'
13
+ # conn = PG::Connection.open(:dbname => 'test')
14
+ # res = conn.exec_params('SELECT $1 AS a, $2 AS b, $3 AS c', [1, 2, nil])
15
+ # # Equivalent to:
16
+ # # res = conn.exec('SELECT 1 AS a, 2 AS b, NULL AS c')
17
+ #
18
+ # See the PG::Result class for information on working with the results of a query.
19
+ #
6
20
  class PG::Connection
7
21
 
8
22
  # The order the options are passed to the ::connect method.
@@ -27,7 +41,8 @@ class PG::Connection
27
41
  # Parameter 'fallback_application_name' was introduced in PostgreSQL 9.0
28
42
  # together with PQescapeLiteral().
29
43
  if PG::Connection.instance_methods.find{|m| m.to_sym == :escape_literal }
30
- appname = PG::Connection.quote_connstr( $0 )
44
+ appname = $0.sub(/^(.{30}).{4,}(.{30})$/){ $1+"..."+$2 }
45
+ appname = PG::Connection.quote_connstr( appname )
31
46
  connopts = ["fallback_application_name=#{appname}"]
32
47
  else
33
48
  connopts = []
@@ -4,8 +4,8 @@ require 'pg' unless defined?( PG )
4
4
 
5
5
 
6
6
  module PG
7
-
7
+
8
8
  class Error < StandardError; end
9
-
9
+
10
10
  end # module PG
11
11
 
@@ -11,7 +11,7 @@ TIMEOUT = 5.0 # seconds to wait for an async operation to complete
11
11
 
12
12
  # Print 'x' continuously to demonstrate that other threads aren't
13
13
  # blocked while waiting for the connection, for the query to be sent,
14
- # for results, etc. You might want to sleep inside the loop or
14
+ # for results, etc. You might want to sleep inside the loop or
15
15
  # comment this out entirely for cleaner output.
16
16
  progress_thread = Thread.new { loop { print 'x' } }
17
17
 
@@ -82,7 +82,7 @@ conn.send_query( "SELECT * FROM pg_stat_activity" )
82
82
  loop do
83
83
  output_progress " waiting for a response"
84
84
 
85
- # Buffer any incoming data on the socket until a full result is ready.
85
+ # Buffer any incoming data on the socket until a full result is ready.
86
86
  conn.consume_input
87
87
  while conn.is_busy
88
88
  select( [socket], nil, nil, TIMEOUT ) or
@@ -5,7 +5,7 @@ require 'pg'
5
5
  $stdout.sync = true
6
6
 
7
7
  # This is a example of how to mix and match synchronous and async APIs. In this case,
8
- # the connection to the server is made syncrhonously, and then queries are
8
+ # the connection to the server is made syncrhonously, and then queries are
9
9
  # asynchronous.
10
10
 
11
11
  TIMEOUT = 5.0 # seconds to wait for an async operation to complete
@@ -36,7 +36,7 @@ conn.send_query( "SELECT * FROM pg_stat_activity" )
36
36
  loop do
37
37
  output_progress " waiting for a response"
38
38
 
39
- # Buffer any incoming data on the socket until a full result is ready.
39
+ # Buffer any incoming data on the socket until a full result is ready.
40
40
  conn.consume_input
41
41
  while conn.is_busy
42
42
  output_progress " waiting for data to be available on %p..." % [ socket ]
@@ -8,7 +8,7 @@ require 'pg'
8
8
  $stderr.puts "Opening database connection ..."
9
9
  conn = PG.connect( :dbname => 'test' )
10
10
 
11
- #
11
+ #
12
12
  conn.transaction do
13
13
  conn.exec( "DECLARE myportal CURSOR FOR select * from pg_database" )
14
14
  res = conn.exec( "FETCH ALL IN myportal" )
@@ -42,7 +42,7 @@ def report( opts )
42
42
  # -----------------------------------------
43
43
 
44
44
  db_info = db.exec %Q{
45
- SELECT
45
+ SELECT
46
46
  count(oid) AS num_relations,
47
47
  pg_size_pretty(pg_database_size('#{opts.database}')) AS dbsize
48
48
  FROM
@@ -416,7 +416,7 @@ rsync: /usr/bin/rsync
416
416
  ssh: /usr/bin/ssh
417
417
  ssh_timeout: 10
418
418
 
419
- destinations:
419
+ destinations:
420
420
 
421
421
  - label: rsync-example
422
422
  port: 2222
@@ -150,7 +150,7 @@ class PGWarehouse
150
150
  #
151
151
  self.db.exec( query ) do |res|
152
152
  res.each do |row|
153
- relations[ row['oid'] ] = {
153
+ relations[ row['oid'] ] = {
154
154
  :name => row['name'],
155
155
  :tablespace => row['tspace'],
156
156
  :indexes => [],
@@ -42,8 +42,7 @@ module PG::TestingHelpers
42
42
  def ansi_code( *attributes )
43
43
  attributes.flatten!
44
44
  attributes.collect! {|at| at.to_s }
45
- # $stderr.puts "Returning ansicode for TERM = %p: %p" %
46
- # [ ENV['TERM'], attributes ]
45
+
47
46
  return '' unless /(?:vt10[03]|xterm(?:-color)?|linux|screen)/i =~ ENV['TERM']
48
47
  attributes = ANSI_ATTRIBUTES.values_at( *attributes ).compact.join(';')
49
48
 
@@ -574,6 +574,16 @@ describe PG::Connection do
574
574
  PG::Connection.parse_connect_args( 'dbname=test' ).should include( $0 )
575
575
  end
576
576
 
577
+ it "sets a shortened fallback_application_name on new connections" do
578
+ old_0 = $0
579
+ begin
580
+ $0 = "/this/is/a/very/long/path/with/many/directories/to/our/beloved/ruby"
581
+ PG::Connection.parse_connect_args( 'dbname=test' ).should match(/\/this\/is\/a.*\.\.\..*\/beloved\/ruby/)
582
+ ensure
583
+ $0 = old_0
584
+ end
585
+ end
586
+
577
587
  it "calls the block supplied to wait_for_notify with the notify payload if it accepts " +
578
588
  "any number of arguments" do
579
589
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- hash: 35
4
+ hash: 33
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 15
9
- - 0
10
- version: 0.15.0
9
+ - 1
10
+ version: 0.15.1
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - Michael Granger
@@ -36,7 +36,7 @@ cert_chain:
36
36
  mMFp4kPUHbWOqCp2mz9gCA==
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2013-03-26 00:00:00 Z
39
+ date: 2013-04-08 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hoe-mercurial
@@ -133,7 +133,7 @@ dependencies:
133
133
  description: |-
134
134
  Pg is the Ruby interface to the {PostgreSQL RDBMS}[http://www.postgresql.org/].
135
135
 
136
- It works with {PostgreSQL 8.3 and later}[http://bit.ly/6AfPhm].
136
+ It works with {PostgreSQL 8.4 and later}[http://www.postgresql.org/support/versioning/].
137
137
 
138
138
  A small example usage:
139
139
 
metadata.gz.sig CHANGED
Binary file