midori-contrib 0.1.2 → 0.1.3
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/midori-contrib.rb +1 -1
- data/lib/midori-contrib/sequel/mysql2.rb +21 -1
- data/lib/midori-contrib/sequel/postgres.rb +12 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24ed1cf3359843568ec7431474d376c138897ee1
|
4
|
+
data.tar.gz: 71af4af1b3f865c8335e3a394d858a0188227b50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78d6d9c77b55f20b8fb9eeba07624f5ffcc7cd25fb6a1466a6879971319eda2d9080f0c44f58238b1a00d1d84cabe1ca491ff87831cdfd803d14643092a9dd60
|
7
|
+
data.tar.gz: bc9ed3c3916549f2bac2ea37fbb6603a957f04440edb8e065591e5b1a5f64296f149637a891e20debd8a2c8a096e05eb53a0ad1b3f702729c1786fac07624daf
|
data/lib/midori-contrib.rb
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2017-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: murasaki
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
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.
|
26
|
+
version: '0.2'
|
27
27
|
description: Various extensions officially supported for midori
|
28
28
|
email: business@heckpsi.com
|
29
29
|
executables: []
|