flounder 0.11.0 → 0.11.1

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: ea885fee238d20c64364425cad9315b36a857c5a
4
- data.tar.gz: 213baa1bff13a230263f742537667474e54fecee
3
+ metadata.gz: bebf705b64f42741d7a218d8a8deec495228b9b3
4
+ data.tar.gz: f11eba4e515486212a345b17a845cdfa9b1c1cf8
5
5
  SHA512:
6
- metadata.gz: 05ecfc437a608a3e87369501f7ab3ffba0373e731752bdaa1fd4d89d7736e6479c33eea3e3ae589e6ae9ba7fb12f699e9100b3d88c763efecbda93e0c1368ae1
7
- data.tar.gz: 82059189fb7904376ca5d03bd9ceca30fe77e47f67ab61280c49f66b4f9764ac3b34b1710c6f5791f9e66c4d2df64dd2b456309a12ceba636247880714de6409
6
+ metadata.gz: 149d35c4af68907002233dda0c2aa9708852aced08a97fa13604d99974479347a1034434e48073d90c5a27bcb0847d87524809bab3c9403eedc199482cb30310
7
+ data.tar.gz: e30b31d789d5af1243faf3e4fdbe7f33944fe95ae30f29ce252c8d95d8d2c8d1a7829859a683e9ad3a4ff64008871ff64fffae7f5f873072a59298f2f9711142
data/flounder.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "flounder"
5
- s.version = '0.11.0'
5
+ s.version = '0.11.1'
6
6
  s.summary = "Flounder is a way to write SQL simply in Ruby. It deals with everything BUT object relational mapping. "
7
7
  s.email = "kaspar.schiess@technologyastronauts.ch"
8
8
  s.homepage = "https://bitbucket.org/technologyastronauts/oss_flounder"
@@ -71,6 +71,9 @@ module Flounder
71
71
  def log_sql sql
72
72
  @logger.info sql
73
73
  end
74
+ def log_bm measure
75
+ @logger.info "Query took #{measure}."
76
+ end
74
77
 
75
78
  # Define a database entity and alias it to plural and singular names that
76
79
  # will be used in the code.
@@ -1,4 +1,6 @@
1
1
 
2
+ require 'benchmark'
3
+
2
4
  module Flounder::Query
3
5
  class Base
4
6
  def initialize domain, manager_klass, entity
@@ -53,13 +55,15 @@ module Flounder::Query
53
55
  def kick connection=nil
54
56
  all = nil
55
57
 
56
- (connection || engine).exec(self.to_sql, bind_values) do |result|
57
- all = Array.new(result.ntuples, nil)
58
- result.ntuples.times do |row_idx|
59
- all[row_idx] = engine.connection.
60
- objectify_result_row(entity, result, row_idx) do |name|
61
- column_name_to_entity(name)
62
- end
58
+ measure do
59
+ (connection || engine).exec(self.to_sql, bind_values) do |result|
60
+ all = Array.new(result.ntuples, nil)
61
+ result.ntuples.times do |row_idx|
62
+ all[row_idx] = engine.connection.
63
+ objectify_result_row(entity, result, row_idx) do |name|
64
+ column_name_to_entity(name)
65
+ end
66
+ end
63
67
  end
64
68
  end
65
69
 
@@ -69,6 +73,12 @@ module Flounder::Query
69
73
  # Implement this if your column names in the query allow inferring
70
74
  # the entity and the column name. Return them as a tuple <entity, name>.
71
75
  end
76
+ def measure
77
+ measure = Benchmark.measure {
78
+ yield
79
+ }
80
+ domain.log_bm measure
81
+ end
72
82
 
73
83
  private
74
84
  # Prepares a kick - meaning an execution on the database or a transform
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flounder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaspar Schiess
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-29 00:00:00.000000000 Z
12
+ date: 2014-08-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: arel