midori-contrib 0.1.2 → 0.1.3

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: 7ac8d9faf8ee2376a7f357a76db44ac8ce962329
4
- data.tar.gz: 191d2c51018b09cd62cbf79c315c2147ca032afc
3
+ metadata.gz: 24ed1cf3359843568ec7431474d376c138897ee1
4
+ data.tar.gz: 71af4af1b3f865c8335e3a394d858a0188227b50
5
5
  SHA512:
6
- metadata.gz: 5902d0c3e451d32ead116df690e9415f479eb60fb2ec751e5b3f67e51641a979de967f2a28942f150064e75ff5ef094d968a6697d5e924f849c453743ab66f34
7
- data.tar.gz: da8bf901d5abb6600fc9164e6509a46e0ac6526472e0f7cb1e1b79570494ed064825de32db658f95666be6555aed68974a141f3309ffd311dd7b052224614022
6
+ metadata.gz: 78d6d9c77b55f20b8fb9eeba07624f5ffcc7cd25fb6a1466a6879971319eda2d9080f0c44f58238b1a00d1d84cabe1ca491ff87831cdfd803d14643092a9dd60
7
+ data.tar.gz: bc9ed3c3916549f2bac2ea37fbb6603a957f04440edb8e065591e5b1a5f64296f149637a891e20debd8a2c8a096e05eb53a0ad1b3f702729c1786fac07624daf
@@ -3,7 +3,7 @@ module Midori
3
3
  # Midori Contrib Module
4
4
  module Contrib
5
5
  # Current Version Code
6
- VERSION = '0.1.2'.freeze
6
+ VERSION = '0.1.3'.freeze
7
7
  end
8
8
  end
9
9
 
@@ -11,6 +11,26 @@ module Sequel
11
11
  module Mysql2
12
12
  # Midori Extension of sequel MySQL through meta programming
13
13
  class Database
14
+ alias_method :_execute_block, :_execute
15
+
16
+ # Execute the given SQL on the given connection. If the :type
17
+ # option is :select, yield the result of the query, otherwise
18
+ # yield the connection if a block is given.
19
+ # @param [Mysql2::Client] conn connection to database
20
+ # @param [String] sql sql query
21
+ # @param [Hash] opts optional options
22
+ # @return [Mysql2::Result] MySQL results
23
+ def _execute(conn, sql, opts, &block)
24
+ # _execute_nonblock(conn, sql, opts, &block)
25
+ if Fiber.current == EventLoop.root_fiber
26
+ # Block usage
27
+ return _execute_block(conn, sql, opts, &block)
28
+ else
29
+ # Nonblock usage
30
+ return _execute_nonblock(conn, sql, opts, &block)
31
+ end
32
+ end
33
+
14
34
  # Execute the given SQL on the given connection. If the :type
15
35
  # option is :select, yield the result of the query, otherwise
16
36
  # yield the connection if a block is given.
@@ -18,7 +38,7 @@ module Sequel
18
38
  # @param [String] sql sql query
19
39
  # @param [Hash] opts optional options
20
40
  # @return [Mysql2::Result] MySQL results
21
- def _execute(conn, sql, opts) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
41
+ def _execute_nonblock(conn, sql, opts) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
22
42
  begin
23
43
  # :nocov:
24
44
  stream = opts[:stream]
@@ -11,7 +11,19 @@ class Sequel::Postgres::Adapter
11
11
  # @param [String] sql sql request
12
12
  # @param [Array] args args to send
13
13
  # @return [Array] sql query result
14
+ alias_method :execute_query_block, :execute_query
15
+
14
16
  def execute_query(sql, args)
17
+ if Fiber.current == EventLoop.root_fiber
18
+ # Block usage
19
+ return execute_query_block(sql, args)
20
+ else
21
+ # Nonblock usage
22
+ return execute_query_nonblock(sql, args)
23
+ end
24
+ end
25
+
26
+ def execute_query_nonblock(sql, args)
15
27
  @db.log_connection_yield(sql, self, args) do
16
28
  if POSTGRES_SOCKETS[self].nil?
17
29
  POSTGRES_SOCKETS[self] = IO::open(socket)
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midori-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - HeckPsi Lab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-15 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: midori.rb
14
+ name: murasaki
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.4'
19
+ version: '0.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.4'
26
+ version: '0.2'
27
27
  description: Various extensions officially supported for midori
28
28
  email: business@heckpsi.com
29
29
  executables: []