pg_conn 0.18.0 → 0.19.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 +4 -4
- data/TODO +19 -0
- data/lib/pg_conn/version.rb +1 -1
- data/lib/pg_conn.rb +18 -1
- 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: 91bfceabfdba86eba789108cea2718e382fe6849b580ef3be3a428a8f08ab45e
|
4
|
+
data.tar.gz: 0014ae1ccc9c6cf95f63fce78d5a094b7068e711ed18d0edcdaafe35d47ef04b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6302b2051fd7a152b026ed7a412ad9025ae7fbdb6f260173c5731c123f367c7535a9522e2654ccc09950d14c9e3009c1daf6d52fa7fc3114c3b9f196e6db0570
|
7
|
+
data.tar.gz: c793534b923e08cc22121dc824c858003cb495e2453cb77cd7007672e242a62ff8819ab966f2f9d70a552f3a080da2627c1ec1211990eefcbe87bdcc1a5c06e8
|
data/TODO
CHANGED
@@ -1,4 +1,23 @@
|
|
1
1
|
TODO
|
2
|
+
o db.context(schema: app_portal, transaction: true) { ... }
|
3
|
+
db.context(set: app_portal, transaction: true) { ... }
|
4
|
+
db.context(add: app_portal, transaction: true) { ... }
|
5
|
+
|
6
|
+
o In the doc; compare a VisualBasic call to a function with PgConn's:
|
7
|
+
|
8
|
+
Set cmd = Server.CreateObject("ADODB.Command")
|
9
|
+
cmd.CommandText = "sp_nic_update_comtext"
|
10
|
+
cmd.CommandType = adCmdStoredProc
|
11
|
+
cmd.Parameters.Append cmd.CreateParameter("Id", adGUID, adParamInput, ,strId)
|
12
|
+
cmd.Parameters.Append cmd.CreateParameter("comtext", adVarWChar, adParamInput,2048 ,strComtext)
|
13
|
+
cmd.Parameters.Append cmd.CreateParameter("UserId", adGUID, adParamInput, , Site.CurrentUser.Id.ToString())
|
14
|
+
cnn.ExecuteCommandNonQuery cmd
|
15
|
+
|
16
|
+
vs
|
17
|
+
|
18
|
+
server.call :sp_nic_update_comtext, str_id, str_comtext, site.current_user.id
|
19
|
+
|
20
|
+
|
2
21
|
o Have a 'with' method that combines multiple brachet-methods:
|
3
22
|
|
4
23
|
conn.with(schema: public, transation: true) { ... }
|
data/lib/pg_conn/version.rb
CHANGED
data/lib/pg_conn.rb
CHANGED
@@ -507,7 +507,7 @@ module PgConn
|
|
507
507
|
# Returns a hash from the first field to a tuple of the remaining fields.
|
508
508
|
# If there is only one remaining field then that value is used instead of a
|
509
509
|
# tuple of that value. The optional +key+ argument sets the mapping field
|
510
|
-
def map(query, key = nil)
|
510
|
+
def map(query, key = nil) # TODO Swap arguments
|
511
511
|
r = pg_exec(query)
|
512
512
|
begin
|
513
513
|
key = (key || r.fname(0)).to_s
|
@@ -525,6 +525,23 @@ module PgConn
|
|
525
525
|
h
|
526
526
|
end
|
527
527
|
|
528
|
+
def multimap(query, key = nil)
|
529
|
+
r = pg_exec(query)
|
530
|
+
begin
|
531
|
+
key = (key || r.fname(0)).to_s
|
532
|
+
key_index = r.fnumber(key.to_s)
|
533
|
+
one = (r.nfields == 2)
|
534
|
+
rescue ArgumentError
|
535
|
+
raise Error, "Can't find column #{key}"
|
536
|
+
end
|
537
|
+
h = {}
|
538
|
+
r.each_row { |row|
|
539
|
+
key_value = row.delete_at(key_index)
|
540
|
+
(h[key_value] ||= []) << (one ? row.first : row)
|
541
|
+
}
|
542
|
+
h
|
543
|
+
end
|
544
|
+
|
528
545
|
# Return the value of calling the given function (which can be a String or
|
529
546
|
# a Symbol and can contain the schema of the function). It dynamically
|
530
547
|
# detects the structure of the result and return a value or an array of
|
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.19.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
|
+
date: 2024-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|