spare 0.0.5 → 0.0.6
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/lib/spare/mysql_abstract_adapter.rb +12 -12
- data/lib/spare/version.rb +1 -1
- data/spec/database.yml +2 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73f2341641dfef4d4cb0e7a1ea56a12a9a310707
|
4
|
+
data.tar.gz: 587018fc4a4c7ad3ee0abf88a2fd77dc37019645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a16983bd4c41ef150e8b457be211d8fff0ff4604df3290569bd82dba6857ef080499fbe2010b15e4e73f370248931d0ac8108e06f8ee1769f5e953850f6ddd5
|
7
|
+
data.tar.gz: dd014384b47784a840dae263970f2695c1d23cea47917fce472d6ad9969dd456a2b8cd4c616be1b5b26997b0b3cd726579590dc7eef25ed1e05a8453953dca8b
|
@@ -61,22 +61,19 @@ module ActiveRecord
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def execute_stored_procedure(sp)
|
64
|
-
|
65
64
|
call_results = execute(stored_procedure_to_sql(sp))
|
66
65
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
66
|
+
clnt = instance_variable_get(:@connection)
|
67
|
+
while clnt.next_result
|
68
|
+
if result_array = clnt.store_result.to_a[0]
|
69
|
+
sp_out_params(sp).length != 0
|
70
|
+
sp_out_params(sp).each_with_index do |param,i|
|
71
|
+
sp.__send__ "#{param.name}=", result_array[i]
|
74
72
|
end
|
75
73
|
end
|
76
|
-
nil
|
77
|
-
else
|
78
|
-
call_results
|
79
74
|
end
|
75
|
+
|
76
|
+
call_results
|
80
77
|
end
|
81
78
|
|
82
79
|
private
|
@@ -102,7 +99,10 @@ module ActiveRecord
|
|
102
99
|
end
|
103
100
|
|
104
101
|
def sp_out_sql(sp)
|
105
|
-
|
102
|
+
out_vars = sp_out_params(sp).map{|param| "@#{param.name}"}.join(',')
|
103
|
+
if !out_vars.blank?
|
104
|
+
"SELECT #{sp_out_params(sp).map{|param| "@#{param.name}"}.join(',')};"
|
105
|
+
end
|
106
106
|
end
|
107
107
|
|
108
108
|
# In MySQL even with multi-statements flag set, variables must be set 1 at a time, so return an array
|
data/lib/spare/version.rb
CHANGED
data/spec/database.yml
CHANGED
@@ -2,10 +2,9 @@
|
|
2
2
|
# re-generated from your development database when you run "rake".
|
3
3
|
# Do not set this db to the same as development or production.
|
4
4
|
common: &common
|
5
|
-
pool:
|
5
|
+
pool: 1
|
6
6
|
timeout: 5000
|
7
7
|
adapter: mysql2
|
8
|
-
reconnect: true
|
9
8
|
username: root
|
10
9
|
|
11
10
|
without_db:
|
@@ -13,4 +12,4 @@ without_db:
|
|
13
12
|
|
14
13
|
test:
|
15
14
|
<<: *common
|
16
|
-
database: sp_test
|
15
|
+
database: sp_test
|