spare 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eebcabc4cfa5cc1016e4792fcb33d1d3ad3f8ecc
4
- data.tar.gz: dd194a9dcb89d2b274f3bbe511d0545ff25320c9
3
+ metadata.gz: 73f2341641dfef4d4cb0e7a1ea56a12a9a310707
4
+ data.tar.gz: 587018fc4a4c7ad3ee0abf88a2fd77dc37019645
5
5
  SHA512:
6
- metadata.gz: 01199811e2ceb6df16f47ee095bc9786a7d02a65172ff4f68fbbb3ed299467f1050a2a6a9976e3a153112b9de11fd2208d32a46dfa01d117995ed0f7a27643b5
7
- data.tar.gz: 33888abe01749bd5b32c951f8e66eb7b1d5b63477417509ae41eedc0d7e643eb6bceedb1979caf4457344e57868d8d867de74c99f32c464330fc678eeed61275
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
- if sp_out_params(sp).length != 0
68
- clnt = instance_variable_get(:@connection)
69
- while clnt.next_result
70
- if result_array = clnt.store_result.to_a[0]
71
- sp_out_params(sp).each_with_index do |param,i|
72
- sp.__send__ "#{param.name}=", result_array[i]
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
- "SELECT #{sp_out_params(sp).collect{|param| "@#{param.name}"}.join(',')};"
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
@@ -1,3 +1,3 @@
1
1
  module Spare
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -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: 100
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Mckinney