prick 0.39.10 → 0.39.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prick/builder/batch.rb +9 -8
- data/lib/prick/builder/node.rb +4 -1
- data/lib/prick/builder/parser.rb +1 -1
- data/lib/prick/version.rb +1 -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: ad50ce31807638ac2ae6641f51d77ed2b27fc4649dcfb103760f807c73b9abdd
|
4
|
+
data.tar.gz: e017f2e426eb63b8af62c1b5e88d39b662dac8a256db92274335edc50cf75aad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23e42576bc05d4326feaffcbee16786be1957535d511959062036b7f6bb38ba43bb368ac2304c138b6cd23b40ba447c10f1a0a1b3dc5c00f4f03dee787c9843e
|
7
|
+
data.tar.gz: e0ef1c1700bf783efedbb37c20aad0c6e162543edf4bf5f2b889b8872f1282a1441a11725f8410c9c922388c1853dd12a496772332d16240ba432ba57b125837
|
data/lib/prick/builder/batch.rb
CHANGED
@@ -35,23 +35,24 @@ module Prick
|
|
35
35
|
def execute
|
36
36
|
# puts "#execute"
|
37
37
|
super {
|
38
|
-
|
39
|
-
|
40
|
-
file = nil
|
41
|
-
node = nil
|
38
|
+
file = nil
|
39
|
+
node = nil
|
42
40
|
|
41
|
+
begin
|
43
42
|
# A SQL batch allows the first node to be an evaluated or executed node
|
44
43
|
if nodes.first.is_a?(CommandNode)
|
45
44
|
node = nodes.shift
|
46
|
-
|
45
|
+
conn.execute [node.source], silent: true
|
47
46
|
end
|
47
|
+
rescue PG::Error => ex
|
48
|
+
error, line, char = conn.err
|
49
|
+
raise PostgresError.new("Error from #{node.to_s} at #{line}:#{char} - #{error}")
|
50
|
+
end
|
48
51
|
|
49
|
-
|
52
|
+
begin
|
50
53
|
for node in nodes # This is marginally faster than concatenating all nodes
|
51
|
-
# puts node.source
|
52
54
|
conn.execute node.source, silent: true
|
53
55
|
end
|
54
|
-
|
55
56
|
rescue PG::Error => ex
|
56
57
|
error, line, char = conn.err
|
57
58
|
file = nil
|
data/lib/prick/builder/node.rb
CHANGED
@@ -123,6 +123,7 @@ module Prick
|
|
123
123
|
def self.objects() @@objects end
|
124
124
|
end
|
125
125
|
|
126
|
+
# Virtual base class for EvalNode and ExecNode
|
126
127
|
class CommandNode < Node
|
127
128
|
alias_method :command, :to_s
|
128
129
|
|
@@ -146,14 +147,16 @@ module Prick
|
|
146
147
|
end
|
147
148
|
end
|
148
149
|
|
150
|
+
# EvalNode executes the command and feeds the output into the database
|
149
151
|
class EvalNode < CommandNode
|
150
152
|
def read_source
|
151
153
|
sql = execute_command
|
152
154
|
@source_lines = 1 + 1 + sql.count("\n")
|
153
|
-
["set search_path to #{schema}, pg_temp
|
155
|
+
["set search_path to #{schema}, pg_temp", sql.join("\n")]
|
154
156
|
end
|
155
157
|
end
|
156
158
|
|
159
|
+
# ExecNode executes the command and ignores its output
|
157
160
|
class ExecNode < CommandNode
|
158
161
|
def read_source
|
159
162
|
execute_command
|
data/lib/prick/builder/parser.rb
CHANGED
@@ -57,7 +57,7 @@ module Prick
|
|
57
57
|
unit = make_build_unit(parent, path)
|
58
58
|
entries = YAML.load(File.read(path)) || []
|
59
59
|
entries.each { |entry|
|
60
|
-
if entry.is_a?(Hash) && (entry.size != 1 || entry.first.first
|
60
|
+
if entry.is_a?(Hash) && (entry.size != 1 || !%w(call sql exec eval).include?(entry.first.first))
|
61
61
|
entry.each { |key, value|
|
62
62
|
if key == "schema"
|
63
63
|
unit.schema = value
|
data/lib/prick/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.39.
|
4
|
+
version: 0.39.11
|
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-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semantic
|