pg_conn 0.27.1 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pg_conn/version.rb +1 -1
- data/lib/pg_conn.rb +14 -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: 1ecec863d9bc5362325174cc0b8808850857fb6458bf7ebfe935d4c1c7fed8f1
|
4
|
+
data.tar.gz: cd377b8f0b6b52dd315643a25e5a965f14f28602ac1e804ec5f14ed65e3dc7fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8c2acce15051e71533db05379da6939882e5e077f1c002cdce9f904bc026b5c09b317d5a948ca0341ed7af1b6ef4a5a974c3dfed3edd96333aa90bc169c97d7
|
7
|
+
data.tar.gz: 827c0194d8a9897ccc27b5acb7b8c2210a0a7ca611648b9acb0852f09afd3c7378e014552256fede9e8da635f22fd475d923eb67b06231adaaf01bc5f6d5d366
|
data/lib/pg_conn/version.rb
CHANGED
data/lib/pg_conn.rb
CHANGED
@@ -31,6 +31,10 @@ module PgConn
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
# Used to mark strings as literals that should not be quoted. This is the
|
35
|
+
# case for row and record values
|
36
|
+
class Literal < String; end
|
37
|
+
|
34
38
|
# All results from the database are converted into native Ruby types
|
35
39
|
class Connection
|
36
40
|
# Make PgConn::Connection pretend to be an instance of the PgConn module
|
@@ -246,6 +250,8 @@ module PgConn
|
|
246
250
|
end
|
247
251
|
end
|
248
252
|
|
253
|
+
def literal(arg) Literal.new(arg) end
|
254
|
+
|
249
255
|
# Quote argument as an identifier. The argument should be a non-nil string
|
250
256
|
# or a symbol
|
251
257
|
def quote_identifier(s)
|
@@ -274,6 +280,7 @@ module PgConn
|
|
274
280
|
#
|
275
281
|
def quote_value(value, elem_type: nil)
|
276
282
|
case value
|
283
|
+
when Literal; value
|
277
284
|
when String; @pg_connection.escape_literal(value)
|
278
285
|
when Integer, Float; value.to_s
|
279
286
|
when true, false; value.to_s
|
@@ -363,6 +370,13 @@ module PgConn
|
|
363
370
|
value("select count(*) from (#{inner_query}) as inner_query")
|
364
371
|
end
|
365
372
|
|
373
|
+
# TODO (but breaks a lot of code)
|
374
|
+
# value 1
|
375
|
+
# value? 0 or 1
|
376
|
+
#
|
377
|
+
# values 1 or more
|
378
|
+
# values? 0 or more
|
379
|
+
|
366
380
|
# Return a single value. It is an error if the query doesn't return a
|
367
381
|
# single record with a single column.
|
368
382
|
#
|
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.28.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: 2024-11-
|
11
|
+
date: 2024-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|