pg_conn 0.36.0 → 0.38.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d6940809a3f62bfad5cd2a94566a76bcd1944ad5b6ded6df2be159a010b2169
4
- data.tar.gz: 6f213cb288ba5a85205fd5054fb498e6200b0319eee8c2bbc8c60515705410f7
3
+ metadata.gz: bd242e10678e8e9d925e6322f45ea737acb41924cd6982d769c24cb05dbe326d
4
+ data.tar.gz: bb8c08e465fff1b39f5f8c7cae7316d3a7ff3b03a0287f7b14ba1e131f59b9df
5
5
  SHA512:
6
- metadata.gz: a90dab6c75eb2cfd7a99b39676a4aa0dc167462e37e9229d96ed30517b4ff0c691f6b4389ceb6d26c3f2562d7ce4e7dd2be17d054f1e61369989fb9f8c3db8e1
7
- data.tar.gz: f91893227ef9697eb236051728d509727b2d20b5d9efd7c6f848cf2e887b1abc0e5c8a48da291914372049ab25aee6580b9b74fd422d269c3e7813928032dd23
6
+ metadata.gz: 1777ddc1e093ffd1b5e677a130e6ddbc24bb20a9cbcfa2a83e9c460e9f95a38c33ab4ed0f42cd17dd32bef529ce9356feb46196cec6d51e7a209dd86acd4ca2a
7
+ data.tar.gz: 4d0ef38a2fe075b3259b77a919da927596a9eefe16bc6ab855a1bbe08bbacbbc5c79953a1dc487d2697ae833c0c1c67d86989020ec1c093a9d90ab76981a3f96
data/TODO CHANGED
@@ -1,11 +1,12 @@
1
1
  TODO
2
+ o Drop existing SQL output interface and instead implement a SQL logger
3
+
2
4
  o Add support for hstore (a hash)
3
5
 
4
6
  o Add a <fetch>! method. Require v2
5
7
  value? 0 or 1
6
8
  value 1
7
9
  values 0 or n
8
- values? 0 or n
9
10
  values! 1 or more
10
11
 
11
12
  o Instrumentation of connection object
@@ -43,10 +44,6 @@ TODO
43
44
 
44
45
  server.call :sp_nic_update_comtext, str_id, str_comtext, site.current_user.id
45
46
 
46
- o Have a 'with' method that combines multiple brachet-methods:
47
-
48
- conn.with(schema: public, transation: true) { ... }
49
-
50
47
  o Create aliases
51
48
  tuple -> array
52
49
  tuples arrays
@@ -120,6 +117,9 @@ TODO
120
117
  composition of anonymous record types
121
118
 
122
119
  + Quote methods (value, identier, ... -> Postgres string)
120
+ + Have a 'with' method that combines multiple brachet-methods:
121
+ conn.with(schema: public, transation: true) { ... }
122
+
123
123
 
124
124
  REFACTOR
125
125
  #!/usr/bin/env ruby
@@ -98,6 +98,11 @@ module PgConn
98
98
  conn.execute "set session session_replication_role = replica"
99
99
  end
100
100
 
101
+ # Executes block without triggers
102
+ def without_triggers(&block)
103
+ triggers(false) { yield }
104
+ end
105
+
101
106
  # Execute block with session triggers on or off
102
107
  def triggers(on_off, &block)
103
108
  begin
@@ -1,3 +1,3 @@
1
1
  module PgConn
2
- VERSION = "0.36.0"
2
+ VERSION = "0.38.0"
3
3
  end
data/lib/pg_conn.rb CHANGED
@@ -133,7 +133,7 @@ module PgConn
133
133
 
134
134
  # Name of user
135
135
  def user() @pg_connection.user end
136
- alias_method :username, :user # Obsolete FIXME Is it?
136
+ alias_method :username, :user # Obsolete FIXME Is it? No it is not!
137
137
 
138
138
  # Name of database
139
139
  def name() @pg_connection.db end
@@ -263,12 +263,13 @@ module PgConn
263
263
  # The possible keys of the connection hash are :host, :port, :dbname, :user,
264
264
  # and :password. The connection string can either be a space-separated list
265
265
  # of <key>=<value> pairs with the same keys as the hash, or a URI with the
266
- # format 'postgres[ql]://[user[:password]@][host][:port][/name]
266
+ # format 'postgres[ql]://[user[:password]@][host][:port][/name]. TODO Also
267
+ # allow :database and :username
267
268
  #
268
269
  # If given an array argument, PgConn will not connect to the database and
269
270
  # instead write its commands to the array. In this case, methods extracting
270
271
  # values from the database (eg. #value) will return nil or raise an
271
- # exception
272
+ # exception. TODO: Remove
272
273
  #
273
274
  # The last variant is used to establish a PgConn from an existing
274
275
  # connection. It doesn't change the connection settings and is not
@@ -430,7 +431,8 @@ module PgConn
430
431
  end
431
432
  end
432
433
 
433
- # Mark string argument as already being quoted
434
+ # Mark string argument as already being quoted. This is done automatically
435
+ # by all quote_* methods
434
436
  def literal(arg) Literal.new(arg) end
435
437
 
436
438
  # Connection member method variations of the PgConn quote class methods
@@ -784,6 +786,8 @@ module PgConn
784
786
  # There is no variant that takes a single tuple because it would then be
785
787
  # impossible to have array or hash field values
786
788
  def insert(*args, upsert: nil, **opts)
789
+ # Normalize arguments
790
+
787
791
  # Add options to args except the special :upsert option
788
792
  args << opts if !opts.empty?
789
793
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_conn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.0
4
+ version: 0.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-23 00:00:00.000000000 Z
11
+ date: 2025-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg