pg_conn 0.28.0 → 0.29.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO +8 -5
- data/lib/pg_conn/version.rb +1 -1
- data/lib/pg_conn.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f795d288972f119404fe25cd22bd93eac7c7fd9d9a38e0ae58c85e50a3debd79
|
4
|
+
data.tar.gz: 0bb34a7d3c595a1c1c4fac1a9b50dcd56245e43ee18abafb11d36fdeb125ba10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b31d917f898c4caa75498b4c8afac6dd66c55c09abaf5a83138e7ce46096a9ce781cfc71250cd1886752be9b709fbe61e39bc2097932581fa3ded9ad4315f50f
|
7
|
+
data.tar.gz: 3d500cc0b5167d3d2ffeeb53e251ffb15d65c4da1a3b5ec3ccc9ebf535bb8c954fd20e510e17eba9a301a25103d5307c7168093c758374803a728fe9115a4e08
|
data/TODO
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
TODO
|
2
|
-
o Add a
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
o Add support for hstore (a hash)
|
3
|
+
|
4
|
+
o Add a <fetch>! method. Require v2
|
5
|
+
value? 0 or 1
|
6
|
+
value 1
|
7
|
+
values 0 or n
|
8
|
+
values? 0 or n
|
9
|
+
values! 1 or more
|
7
10
|
|
8
11
|
o Instrumentation of connection object
|
9
12
|
|
data/lib/pg_conn/version.rb
CHANGED
data/lib/pg_conn.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "pg"
|
2
2
|
require 'ostruct'
|
3
|
+
require 'json'
|
3
4
|
|
4
5
|
require_relative "pg_conn/version"
|
5
6
|
require_relative "pg_conn/role_methods"
|
@@ -269,6 +270,10 @@ module PgConn
|
|
269
270
|
# true/false, Time/Date/DateTime, and arrays. Other types may require
|
270
271
|
# special handling
|
271
272
|
#
|
273
|
+
# Hashes are quoted as a literal JSON expression. The result is a string
|
274
|
+
# and it is the application's responsibility to cast them to either 'json'
|
275
|
+
# or 'jsonb'
|
276
|
+
#
|
272
277
|
# Note that a tuple value (an array) must be quoted using #quote_tuple
|
273
278
|
# because #quote_value would quote the tuple as an array instead of a list
|
274
279
|
# of values
|
@@ -294,6 +299,7 @@ module PgConn
|
|
294
299
|
else
|
295
300
|
"array[#{value.map { |elem| quote_value(elem) }.join(', ')}]"
|
296
301
|
end
|
302
|
+
when Hash; "'#{value.to_json}'"
|
297
303
|
else
|
298
304
|
@pg_connection.escape_literal(value.to_s)
|
299
305
|
end
|
@@ -346,6 +352,8 @@ module PgConn
|
|
346
352
|
#
|
347
353
|
# Return true iff the query returns exactly one record. Use '!empty?' to
|
348
354
|
# check if the query returns one or more records
|
355
|
+
#
|
356
|
+
# TODO: Rename #present? and use #exists? to query schema objects
|
349
357
|
def exist?(*query)
|
350
358
|
!empty?(*query)
|
351
359
|
end
|
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.
|
4
|
+
version: 0.29.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|